CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   Time-consuming UDF "ADJUST" (http://www.cfd-online.com/Forums/fluent/28138-time-consuming-udf-adjust.html)

Dmitriy Makarov January 11, 2001 12:26

Time-consuming UDF "ADJUST"
 
Hi all,

My UDF (DEFINE_ADJUST) is very time consuming. If someone has this experience: (1) is it possible to execute DEFINE_ADJUST once per several iterations? (2) or if it is possible to re-define UDS's inside of body of any other UDF (like POFILE UDF, which can be executed once per several iterations)? I found that initialization of DOMAIN variable (if it is not passed to UDF from FLUENT) leads to fatal error in my case.

Thanks in advance,

Dmitriy

Greg Perkins January 11, 2001 18:00

Re: Time-consuming UDF "ADJUST"
 
See my post 6th March 2000 repeated here:

current_iter gets the current iteration number from Fluent which you can use to decide whether to compute or not.

int current_iter = (nres == 0) ? (0) : ((int) count2[nres - 1]);

This works fine. For your transient case you'll probably need to check something else with the timestep, flowtime etc.

To check whether you're UDF is called again at the same iteration or at a new iteration use a static variable. Here is some code I'm using to do something every 25 iterations (current_iter as defined above):-

static int disp = FALSE;

if ((current_iter % 25) == 0)

{

if (disp == FALSE)

{

/* --- do what ever you like */

disp = TRUE;

}

}

else disp = FALSE;

You can change the number 25 to whatever you like...

Hope it helps!

Regards Greg

Dmitriy Makarov January 12, 2001 05:11

Re: Time-consuming UDF "ADJUST"
 
Greg,

Thank you! You give me a hope again.

Dmitriy


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