CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   User defined functions (

Juan Carlos February 17, 2010 13:53

User defined functions
Hi, to Flunet users,
I need to describe a three way flapper valve motion.
Mi intention is to simulate the arm and clapper move like a rigid body motion with dynamic mesh and user defined functions (udfs).
I have the geometry definite but, Iīm not experience using udfs in fluent.
Does anyone have any suggestions?
Thanks so much!
Juan C.

usman naseer February 17, 2010 23:38

Hi carlos,,
First of all understand the physics of your body motion.I mean to say that whether you have to assign a certain path to your body which is to be followed during its motion OR the flow will move your body by exerting some forces on it.
2. There are different types of "Macros" available in Fluent to describe different types of motion.Choose one of them according to your body motion.I will suggest you to use "DEFINE_CG_MOTION" if you have to assign a path to your body.
3. Install Visual studio alongwith Fluent and write a simple function in C++ by calling those Macros.Fluent manual will help you a lot in this regard.
4. Compile your UDF in Fluent and start your simulation.
Start working on your UDF & you will come to know about all these things with the passage of time.
Good Luck

Juan Carlos February 18, 2010 10:02

Hi Usman
Thanks for you replay.
Respect to the physics of the problem, in this case the flow move the valve by exerting forces on it.
I will treat to reproduce the body motion of the valve due to hinge moment produced by the flow forces actuating on it.
I was reading the manual, particularly the dynamic mesh topics, and I agree with you to use "DEFINE_CG_MOTION" Macro to specify the flow driven rigid body motion, but I really don’t know how it does.
Juan C.

usman naseer February 22, 2010 01:07

hi carlos,,
In the beginning ,you will face difficulties because everything regarding udf is new for you.But with the passage of time ,you will become familiar with it.
I would suggest you to try to understand the examples completely in Fluent manual regarding "DEFINE_CG_MOTION".This will help you a lot in writing your own udf.Let me know if it works.Then I will send you my own udf of the same macro.
But first try it yourself.
Good Luck

nishith February 22, 2010 01:33

hi usman i think u are dealing with udfs n all... this one is my problem please through some light..... I am studying R T instability and for that i have written UDF for creating a sinusoidal interface between the two liquids, the udf was interpreted well and after hooking i can see the sinusoidal interface by contours-----> phase. After doing all this when i start iterations, just after the first iteration all the things are getting vanished, in the sense now the lower fluid has taken place in all over the domain by vanishing the upper one, now i don't know the problem.

may be i am lagging some where in defining UDF but i have used UDF in only initialization and as i can see the sinusoidal interface i think its working well but if its working well then whats the problem ????????????

Please help,


usman naseer February 22, 2010 10:08

hi nishith,
I am really sory.I am unable to help you in this regard.
Don't have any idea about this particular area.

meb February 24, 2010 06:25

UDF solution
We did it for reed valves:

I'm currently exploring how to solve the problem using mesh morphing ( and modal superposition. In fact using mesh morphing we can directly prescribe the motion acting on solutions weight (open loop) or we can calculate it on the basis of CFD results (closed loop as for FSI).


Juan Carlos March 25, 2010 10:48

Hi Usman
I was analyzing my problem of valve simulation and I can see that to reproduce the body motion of the valve due to hinge moment, I need determinate the magnitude and point of force application.
In the udf, I can use Compute_Force_And_Moment function to determinate the force, but I donīt know how find the position of the force application.
Do you have any suggestions that can help me?
Thanks so much!
Juan C.

All times are GMT -4. The time now is 22:03.