CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   Scheme and Fluent UDF? (

Arthur Valais January 12, 2000 03:26

Scheme and Fluent UDF?
Dear All,

I'd like to be able export my data in format specified by File/Export, at every iteration. If I run a macro, then the file is overwritten each time (%i etc only work with autosave [!]). Looking at the macro in scheme, I would like to change the filename 'data' to 'data-current-time-in seconds' to make each file unique (or some other method). Can anyone help for this simple procedure in scheme?

Thank You,

Arthur Valais

Attached is the macro:

(cx-macro-define '((macro-1 . "(cx-gui-do cx-activate-item \"MenuBar*FileMenu*Export...\")\n(cx-gui-do cx-activate-item \"Export*PanelButtons*PushButton1(OK)\")\n;PATHNAM E \"d:\cfd2000\raw-data\\"\n(cx-gui-do cx-set-text-entry \"Select File*Text\" \"data\")\n(cx-gui-do cx-activate-item \"Select File*OK\")\n(cx-gui-do cx-activate-item \"Export*PanelButtons*PushButton2(Cancel)\")\n( cx-gui-do cx-activate-item \"Monitor Commands*PanelButtons*PushButton1(End Macro)\")\n")


Chris January 12, 2000 15:57

Re: Scheme and Fluent UDF?
I find that filenames with %i does work in File/Export macros using Fluent 5.3.18, so maybe it has been fixed. I don't think there is a variable for time, though, just iteration and time step.

Anyway, I think replacing \"data\" in your macro with something like (format #f \"data-~f\" (rpgetvar 'flow-time)) might do what you want.

Arthur Valais January 12, 2000 19:18

Re: Scheme and Fluent UDF?
Thanks Chris,

It was a good idea, but fluent stops with...

Error: malformed pair: too many objects in CDR Error Object: (macro-1 . "(cx-gui-do cx-activate-item \"MenuBar*FileMenu*Export...\")\n(cx-gui-do cx-activate-item \"Export*PanelButtons*PushButton1(OK)\")\n;PATHNAM E \"d:\cfd2000\raw-data\")

I was using 5.2.3. Editing is also a pain as fluent just won't let go of the macros.scm file once its read it for further editing.



Paul Malan January 13, 2000 11:41

Re: Scheme and Fluent UDF?
Here's how I would do it. I would define a text interface command something like this:

/file export fieldview myfile-%t xvel yvel q

Note that the above command is entered manually inside the line "Command" in the command monitors panel. It exports x and y velocity in Fieldview format. The resulting file names look like:

myfile-5107.fvc myfile-5107.fvd myfile-5108.fvc myfile-5108.fvd


Note that %t appends the time step number. You can also use %i for iteration number and %n for a consecutive file name numbers. This is explained in the online help.

Also, if you want to save different data, or in a different format, you can experiment with different text interface commands in the console window.

Hope this helps.

Chris January 14, 2000 14:29

Re: Scheme and Fluent UDF?
That message would imply that you are missing a backslash \ to escape one of the double quotes " (the double quotes need to be escaped so they are not seen as the end of the macro definition string).

LunSheng Pan January 25, 2000 22:24

Re: Scheme and Fluent UDF?
Dear friends, I am a CFD engineer and now encounter a problem on UDF. In my project, one of the boundaries is a curve plate moving in its tangential direction. Hence components of velocity on the boundary change with position (or cell). The Fluent UDF specifying boundary condition can only define one function (or one component). I am very grateful to you If you are willing to help me to overcome this difficulty.

Joe Maruszewski January 26, 2000 14:14

Re: Scheme and Fluent UDF?
Fluent 5 allows you to use UDFs for the wall velocities. In the wall boundary condition select "Moving Wall", then select "Components". You can then specify a UDF for x-, y-, or z-velocity.

LunSheng Pan January 26, 2000 20:32

Re: Scheme and Fluent UDF?
Thank you, Joe Maruszewski. I will try it.

LunSheng Pan January 26, 2000 22:20

Re: Scheme and Fluent UDF?
Hi, Dr. Joe Maruszewski, I have tried it according to your suggestion. But after selecting "moving wall", the components of velocity on the wall must be constant, can not change with position (or cell on the wall). Although the speed of wall is same every where, the wall is curve plate and the components change whit the cell on the wall. Thank you previously.

Paul Malan January 28, 2000 14:47

Re: Scheme and Fluent UDF?
Hi LunSheng Pan:

If you select "Components" as Dr. Maruszewski suggested, you will get a drop-down list next to each of the components. This is where you specify the UDF function.

LunSheng Pan January 31, 2000 05:15

Re: Scheme and Fluent UDF?
Thank you, Paul Malan for your responce. I tried it already. But if choosing as Dr. Joe and you suggested, the components must be constants, and can input different user defined functions for different components. Thank you anyway and wish you to give me a help continuely.

Best regards.


Joe Maruszewski January 31, 2000 14:19

Re: Scheme and Fluent UDF?
You will be able to set it to something other than "constant" after you read a profile file or a user defined function (UDF). Please see the manual for more details on how to use profile boundary conditions or UDFs.

All times are GMT -4. The time now is 02:43.