|
[Sponsors] |
March 22, 2011, 10:54 |
UDF "running frequency"
|
#1 |
New Member
Join Date: Mar 2011
Posts: 10
Rep Power: 15 |
Hello everyone,
I'm using the UDF DEFINE_CG_MOTION for simulating a check valve. i want the UDF to run one time per time step. Currently, the UDF runs four times per time step what is not appropriate for this case. As I've noticed this UDF "running frequency" does not depend on the max iterations per time step but I have no clue where to change it. Thanks for any answers Daniel |
|
March 24, 2011, 04:44 |
|
#2 |
New Member
Join Date: Mar 2011
Posts: 10
Rep Power: 15 |
I solved my problem using the UDF DEFINE_EXECUTE_AT_END.
Regards Daniel |
|
October 13, 2011, 04:50 |
Regarding DEFINE_EXECUTE_AT_THE_END
|
#3 |
New Member
Josy
Join Date: Mar 2009
Location: India
Posts: 29
Rep Power: 17 |
Hi,
I have a DEFINE_CG_MOTION UDF which has a sin function to move the walls of the geometry in my problem. But like you said, the UDF is running 4 times per time step. I want it to run one time each timestep. How do you input the DEFINE_EXECUTE_AT_END in this case? Thank you. |
|
October 14, 2011, 06:05 |
|
#4 |
New Member
Join Date: Mar 2011
Posts: 10
Rep Power: 15 |
At the meantime, I found out, that DEFINE_CG_MOTION is repeated for every wall you want to move (in your case you have also 4 walls, I guess).
Define the velocity of your walls as a global variable and calculate it within a void function. Call the void function with DEFINE_EXECUTE_AT_END. Example: #include <udf.h> /* Define Constants */ #define amplitude 0.02; #define pi 3.14; /* Define Global Variables */ real vel /* velocity */ void fun_velocity(real flowtime) { vel = amplitude * 2 * pi * cos(2*pi*flowtime); /* calculating current velocity */ } DEFINE_EXECUTE_AT_END(yourUDFname) { real flowtime = CURRENT_TIME; /* Passing current flow time from solver to udf */ fun_velocity(flowtime); /* Calling void function 'fun_velocity' and passing current flowtime */ } DEFINE_CG_MOTION(yourUDFname2,dthread,velocity,ang ular_velocity,ftime,dtime) { velocity[0] = vel; /* passing value of vel to x-component of 'velocity'*/ } I didn't test this small UDF but I hope it will make it clear to you. Regards d |
|
October 14, 2011, 07:57 |
|
#5 |
New Member
Join Date: Mar 2011
Posts: 10
Rep Power: 15 |
I should add to my previous comment, that I solve a equation of motion numerically to gain the angular velocity of the flap. Thus, the velocity depends on the current pressure field.
If I put this calculation within the DEFINE_CG_MOTION UDF, every wall would receive a slightly different angular velocity, as the pressure field changes during the iterations. At some point of time my model would break apart. This is the reason, why I use DEFINE_EXECUTE_AT_END to get one velocity for all walls. If you calculate the velocity, say with a sin function, the velocity depends only from the flow time. As the flow time remains equal during the iterations of one time step, the velocity will be the same for all walls. To cut a long story short, the use of DEFINE_EXECUTE_AT_END is not necessary for case, Josyula. DEF_CG_MOTION runs 4 times, because you probably have 4 walls to move. Regards d |
|
October 21, 2011, 01:39 |
|
#6 |
New Member
Josy
Join Date: Mar 2009
Location: India
Posts: 29
Rep Power: 17 |
D,
Thanks for the reply. My geometry is a straight rectangular microchannel. There are only 2 walls which need to be moved i.e. the top and bottom. Left and Right are specified as Pressure inlet and Pressure outlet B.C. respectively. I have a question though: Is there a way we can decide the amplitude based on the time step size? Because, the wall movement is visible only when I give A = 0.1 or A = 0.5. The time step size I am specifying is 1e-07 s. But being a microchannel channel, the phase lag i.e. +ve to -ve will happen after a very long time. Instead, what I am looking for is this: for one time step I need a +ve phase lag (i.e. the walls expand) and the next time step, I need a -ve phase lag (i.e. the walls contract). Sinusoidal profile is really not working well for this. Any suggestions? |
|
October 21, 2011, 11:20 |
|
#7 |
New Member
Join Date: Mar 2011
Posts: 10
Rep Power: 15 |
I'm not quite sure whether I fully understand your intention.
Basically speaking, you can obtain information about the current time step, flow time etc. with the "time dependent macros" . You can use this information in your UDF within an if-condition or whatever to control the amplitude or the velocity of the walls. I don't know if that really answers your question but keep in mind, that the path that the moving walls will pass during one time step, might be pretty tiny due to your very small time step. |
|
Tags |
frequency, time steps, udf |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Dynamic Mesh UDF | Qureshi | FLUENT | 7 | March 23, 2017 08:37 |
UDF parallel error: chip-exec: function not found????? | shankara.2 | Fluent UDF and Scheme Programming | 1 | January 16, 2012 23:14 |
How to add a UDF to a compiled UDF library | kim | FLUENT | 3 | October 26, 2011 22:38 |
UDF...UDF...UDF...UDF | Luc SEMINEL | FLUENT | 0 | November 25, 2002 05:03 |
UDF, UDF, UDF, UDF | Luc SEMINEL | Main CFD Forum | 0 | November 25, 2002 05:01 |