|
[Sponsors] |
October 25, 2002, 16:12 |
Iteration Variable!
|
#1 |
Guest
Posts: n/a
|
Hi;
Does anybody know the variable where the current iteration number is stored? I'm trying to code a udf which has to be accessed every 5-10 iterations. Thanks... Ugur |
|
October 27, 2002, 11:02 |
Re: Iteration Variable!
|
#2 |
Guest
Posts: n/a
|
I know that there is no global fluent variable containing the current iteration value. Here is my quick&dirty workaround coded in the UDF's.
/********************************************/ static int my_iter_counter = 0; static int exec_my_udf = 0; DEFINE_INIT(...) { my_iter_counter = exec_my_udf = 0; ... init something else here ... } /* called after each iteration */ DEFINE_ADJUST(...) { /* * switch UDF exec on at each 10th iteration, * else off, start with on (iteration 0) */ exec_my_udf = (my_iter_counter++ % 10) == 0; ... adjust something else here ... } /* called for each cell/thread.. it depends */ DEFINE_SOURCE/PROPERTY/ETC(...) { if (!exec_my_udf) return; /* or return 0 or whatever */ ... execute UDF ... } /********************************************/ This works fine. With best regards Carsten Dehning |
|
October 27, 2002, 17:52 |
Re: Iteration Variable!
|
#3 |
Guest
Posts: n/a
|
Thanks for your reply, By the way I have found that the iteration variable is stored in a vector called count2[nres-1]. To use this you can define a variable, such as int itervar=(nres==0)?(1)(int)count2[nres-1]); Thanks
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
emag beta feature: charge density | charlotte | CFX | 4 | March 22, 2011 10:14 |
error in COMSOL:'ERROR:6164 Duplicate Variable' | bhushas | COMSOL | 1 | May 30, 2008 05:35 |
Parallel runs slower with MTU=9000 than MTU=1500 | Javier Larrondo | FLUENT | 0 | October 28, 2007 23:30 |
Env variable not set | gruber2 | OpenFOAM Installation | 5 | December 30, 2005 05:27 |
Replace periodic by inlet-outlet pair | lego | CFX | 3 | November 5, 2002 21:09 |