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

A Loop problem when running UDF in the batch mode

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread 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


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
Running FLUENT in batch mode for Windows OS Jake Lee FLUENT 7 June 29, 2016 08:38
Running fluent with udf in batch mode zonexo Fluent UDF and Scheme Programming 2 March 10, 2012 07:50
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 Fidelity CFD 2 March 26, 2003 15:41


All times are GMT -4. The time now is 11:26.