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

A Loop problem when running UDF in the batch mode

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   July 14, 2008, 22:50
Default A Loop problem when running UDF in the batch mode
  #1
Jun Geng
Guest
 
Posts: n/a
The UDF is something like this:

#include "udf.h"

DEFINE_ADJUST(comput_mass_heat,domain) {

#if !RP_HOST

Thread *thrd; cell_t tc;

#endif

int i=1;

#if !RP_HOST thrd=Lookup_Thread(domain,2); printf("%d\n",i); begin_c_loop(tc, thrd)

i=2;

end_c_loop(tc,thrd) #endif printf("%d\n",i); }

I am using the supercomputer of our school When I run the Fluent in the interactive mode, everything worked well. But when I run it in the batch mode, it seems that the part between begin_c_loop and end_c_loop was not executed at all.

Anybody know what the reason is? Thanks a lot.
  Reply With Quote

Old   July 15, 2008, 03:19
Default Re: A Loop problem when running UDF in the batch m
  #2
max
Guest
 
Posts: n/a
hello Jun Geng,

the error occurs because of your printf command. Running in batch mode fluent does not know where to print the output, which is the GUI in interacticve mode by default. Thus either comment this out or use fprintf to direct the output to a file.

cheers

Max

  Reply With Quote

Old   July 15, 2008, 19:26
Default Re: A Loop problem when running UDF in the batch m
  #3
Jun Geng
Guest
 
Posts: n/a
Thanks, Max.

But seems like it is not a output problem. The supercomputer automatically generated a output file and I've copied part of it here:

iter time time/iter

1 solution is converged

1 0.0000e+00 0:00:22 5

1 1

2 0.0000e+00 0:00:17 4

1 1

3 0.0000e+00 0:00:14 3

1 1

4 0.0000e+00 0:00:10 2

1 1

5 0.0000e+00 0:00:05 1

1 1

6 0.0000e+00 0:00:00 0

This indicates that the value of i remained unchanged during the execution. I guess the only reason for this is that

begin_c_loop(tc,thrd) i=2; end_c_loop(tc,thrd)

was not executed at all. But this did not happen when I run it under the interactive mode. I cannot figure out what the reason is since, anyway, the code is so simple that could hardly be wrong....

Anybody can help? Thanks a lot.
  Reply With Quote

Old   July 16, 2008, 08:34
Default Re: A Loop problem when running UDF in the batch m
  #4
max
Guest
 
Posts: n/a
Hello again,

i guess if you put your second printf-command inside the compiler directive, i.e. just before #endif RP_HOST, you will see, that on your compute-node i=2. By now your second printf is executed by the host which still has i set to 1 as he never enters the c-loop because of #if !RP_HOST

cheers Max
  Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Running fluent with udf in batch mode zonexo Fluent UDF and Scheme Programming 2 March 10, 2012 08:50
Running FLUENT in batch mode for Windows OS Jake Lee FLUENT 5 June 27, 2009 00:41
Running Job in Batch mode (EFD) Nick Sessions FloEFD, FloWorks & FloTHERM 0 April 16, 2008 16:44
problem with running UDF in batch mode James FLUENT 0 June 6, 2006 06:49
Running FINE on Batch Mode Chze Yeong Tang NUMECA 2 March 26, 2003 16:41


All times are GMT -4. The time now is 21:55.