CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   How to combine UDF and Scheme? (http://www.cfd-online.com/Forums/fluent-udf/86310-how-combine-udf-scheme.html)

 ali hemmati March 19, 2011 04:06

How to combine UDF and Scheme?

Hello Fluenters! :)
I am simulating the trajectory of a fast revolving ball moving in a fluid. I used a circular wall as ball at the center of containing tank and meshed it. Because the problem is unsteady, I need to solve it by thousands of time steps. I didn't used moving mesh, but Fluent has an option for rotating wall. It's just enough to determine angular velocity and center of rotation of the wall.
The problem for me is how to gain force (pressure and viscous force) and moment on the wall (ball) and determine new angular velocity and new center of rotation for the next time step.
I know that using a UDF which contains DEFINE_EXECUTE_AT _END will do that, but it's hard for me to gain forces and moment on the wall and also set new boundary condition (new angular vel. and center of rotation of the wall).
On the other hand, I think by using Scheme Programming it is easier to set new boundary condition and extract force and moment. (But I don't know how?)
My challenging problem is how to combine these two facts (about UDF and Scheme) to solve the problem. In fact, I want to use Scheme at the end of every time step.

 Amir March 19, 2011 10:01

Hi Ali,
for your case, it doesn't need to use UDF. with a simple FORTRAN code generate a scheme or journal file that computes forces at the end of each time step and makes some changes.

 ali hemmati March 19, 2011 12:56

Thank you Amir,
Would you please tell me how to assign force and moment to a variable? By entering
report / forces / wall-forces yes 1 0 yes "Output directory" ,
I can just write forces to a txt file. But I want to assign force to a variable in order to calculate the next velocity by manipulating that variable.
Is there any way for this?

I have another Q: When I save a *.scm file which contains report / forces / wall-forces yes 1 0 yes "Output directory", fluent shows an error. Is this a correct syntax?

Thanks.

 Amir March 19, 2011 15:45

if you choose a file name without any space it doesn't show any error.(save as *.frp)!
to assign the force to a variable, you need some scheme programming. e.g. to obtain a flow time you can easily use (rpgetvar 'flow-time) but for force and moment I don't have any idea! you can ask other guys that may have some experiences in.
also here is a list of schemes that includes wall forces but I didn't try them before:
http://www.cfd-online.com/Wiki/Fluent_environment

 All times are GMT -4. The time now is 05:28.