# How to combine UDF and Scheme?

 Register Blogs Members List Search Today's Posts Mark Forums Read

 March 19, 2011, 03:06 How to combine UDF and Scheme? #1 New Member   Ali Join Date: Mar 2011 Posts: 27 Rep Power: 15 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. Please help me how to solve it. Thanks for your time… Last edited by ali hemmati; March 19, 2011 at 07:04.

 March 19, 2011, 09:01 #2 Senior Member     Amir Join Date: May 2009 Location: Montreal, QC Posts: 735 Blog Entries: 1 Rep Power: 23 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.

 March 19, 2011, 11:56 #3 New Member   Ali Join Date: Mar 2011 Posts: 27 Rep Power: 15 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.

 March 19, 2011, 14:45 #4 Senior Member     Amir Join Date: May 2009 Location: Montreal, QC Posts: 735 Blog Entries: 1 Rep Power: 23 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

 Tags rotating wall, scheme, udf