I'm currently working on the UDF of a VOF model involving water and oil phase. The code is really simple which is trying to patch a oil droplet in the 2d domain. The code shows as following

#include "udf.h"

DEFINE_INIT(my_init_func,d)

{

cell_t c;

Thread *t;

real xc[ND_ND];

/* loop over all cell threads in the domain */

thread_loop_c(t,d)

{

/* loop over all cells */

begin_c_loop_all(c,t)

{

C_CENTROID(xc,c,t);

if (sqrt(ND_SUM(pow(xc[0] - 2.,2.),

pow(xc[1] - 2.,2.),

pow(xc[2] - 2.,2.))) < 1.)

C_VOF(c,1) = 1.;

else

C_VOF(c,1) = 0.;

}

end_c_loop_all(c,t)

}

}

During interpretation, no error was reported while the "segmentation fault " shows after the initialization.

What's more, if i compiled the code, something is wrong with the problem of ‘xcopy'. Load the C file, "The UDF library you are trying to load (libudf) is not compiled for 2d on the current platform (win64)." is presented.

If anybody can help me? Thank you so much!!!

Similar questions and discussions