CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT

Iteration Variable!

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 25, 2002, 16:12
Default Iteration Variable!
  #1
Ugur
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
  Reply With Quote

Old   October 27, 2002, 11:02
Default Re: Iteration Variable!
  #2
Carsten Dehning
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

  Reply With Quote

Old   October 27, 2002, 17:52
Default Re: Iteration Variable!
  #3
Ugur
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
  Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 13:45.