A Loop problem when running UDF in the batch mode
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. |
Re: A Loop problem when running UDF in the batch m
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 |
Re: A Loop problem when running UDF in the batch m
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. |
Re: A Loop problem when running UDF in the batch m
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 |
All times are GMT -4. The time now is 12:03. |