CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   A UDF Problem in Parallel Mode (https://www.cfd-online.com/Forums/fluent/48861-udf-problem-parallel-mode.html)

Jun July 24, 2008 19:52

A UDF Problem in Parallel Mode
 
This problem only occurs when I run it in the parallel mode on the supercomputer.

this is a test code,

#include "udf.h"

DEFINE_ADJUST(comput_mass_heat,domain) {

int i=1;

double number=2.0;

#if !RP_HOST

Thread *thrd;

cell_t c;

#endif

#if !RP_HOST

thrd=Lookup_Thread(domain,2);

begin_c_loop(c, thrd)

i=i+2;

end_c_loop(c,thrd)

number=number/i;

Message("%g\n", i);

#endif

}

I expected the output of i to be a very large integer. But the value of i remained 1.

Then I change the code like this:

#include "udf.h"

DEFINE_ADJUST(comput_mass_heat,domain) {

int i;

double number=2.0;

#if !RP_HOST

Thread *thrd;

cell_t c;

#endif

#if !RP_HOST

thrd=Lookup_Thread(domain,2);

begin_c_loop(c, thrd)

i=i+2;

end_c_loop(c,thrd)

number=number/i;

Message("%g\n", i);

#endif

}

This time, the output of i value is constantly 12.

Again

#include "udf.h"

DEFINE_ADJUST(comput_mass_heat,domain) {

int i;

double number=2.0;

#if !RP_HOST

Thread *thrd;

cell_t c;

#endif

#if !RP_HOST

thrd=Lookup_Thread(domain,2);

begin_c_loop(c, thrd)

i=2;

end_c_loop(c,thrd)

number=number/i;

Message("%g\n", i);

#endif

}

I got i=2 for the output

And for

#include "udf.h"

DEFINE_ADJUST(comput_mass_heat,domain) {

int i=1;

double number=2.0;

#if !RP_HOST

Thread *thrd;

cell_t c;

#endif

#if !RP_HOST

thrd=Lookup_Thread(domain,2);

begin_c_loop(c, thrd)

i=i+2;

end_c_loop(c,thrd)

number=number/i;

Message("%g\n", i);

#endif

}

I could only got i=1 according to the output file.

Anybody could help me? Thanks a lot.

Jun

sfotovati October 26, 2011 12:49

I have the same problem,
I wanna loop over the faces of a cell in a UDF with DPM_SCALAR_UPDATE macro, it works when I am running sequential, but as it becomes parallel, the values related to the cell faces become zero. I do not know how should I take care of the UDF in parallel form. any help?


All times are GMT -4. The time now is 02:18.