CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   Parallel INIT UDF trouble (http://www.cfd-online.com/Forums/fluent-udf/83350-parallel-init-udf-trouble.html)

mil3st3g December 24, 2010 03:29

Parallel INIT UDF trouble
 
I've written a udf to patch in volume fractions on a simple rectangular, uniform grid, which works well in serial. However, it crashes fluent when interpreting it in the parallel solver (have to end process to get rid of it actually). Have made sure the cell loops use the parallel macro, but that didn't make much difference. Am wondering if anybody has seen a similar error, or has any hints on what exactly is causing it.

Here's the error message (full udf is below that):

cpp -I"C:\PROGRA~1\ANSYSI~1\v120\fluent\fluent12.0.1 6/src" -I"C:\PROGRA~1\ANSYSI~1\v120\fluent\fluent12.0.1 6/cortex/src" -I"C:\PROGRA~1\ANSYSI~1\v120\fluent\fluent12.0.1 6/client/src" -I"C:\PROGRA~1\ANSYSI~1\v120\fluent\fluent12.0.1 6/multiport/src" -I. -
UDFCONFIG_H="<udfconfig-host.h>" "E:\Numerical Studies\Linear Theory\phase_init_function_case4.c"
E:\\Numerical Studies\\Linear Theory\\phase_init_function_case4.c:2: math.h: No such file or directory
mixture_domain definition shadows previous definition
Warning: E:\\Numerical Studies\\Linear Theory\\phase_init_function_case4.c: line 6:
999999 (..\src\mpsystem.c@1148): mpt_read: failed: errno = 10054
999999: mpt_read: error: read failed trying to read 4 bytes: No such file or directory
MPI Application rank 0 exited before MPI_Finalize() with status -1073741819



The offending UDF:

#include "udf.h"
#include "math.h"
/* domain pointer that is passed by init function is mixture domain */
DEFINE_INIT(phase_init_function_case4, mixture_domain)
{
int phase_domain_index;
cell_t cell;
Thread *cell_thread;
Domain *subdomain;
real xc[ND_ND];
double yamp;
double dx = 0.01/4;
/* loop over all subdomains (phases) in the superdomain (mixture) */
sub_domain_loop(subdomain, mixture_domain, phase_domain_index)
{
/* loop if secondary phase */
if (DOMAIN_ID(subdomain) == 3)

/* loop over all cell threads in the secondary phase domain */
thread_loop_c (cell_thread, subdomain)
{
/*loop over all cells in secondary phase cell threads */
begin_c_loop_int (cell, cell_thread)
{
C_CENTROID(xc,cell,cell_thread);
yamp = 0.0001*cos(2*3.14159625*xc[0]/0.01);
if (xc[1] > 0)
if (xc[1] < dx & yamp > 0)
C_VOF(cell,cell_thread) = yamp/dx;
else
C_VOF(cell,cell_thread) = 0;
else
if (xc[1] > -dx & yamp <= 0)
C_VOF(cell,cell_thread) = 1 + yamp/dx;
else
C_VOF(cell,cell_thread) = 1;
}
end_c_loop_int (cell,cell_thread)
}
/* loop if primary phase */
else if (DOMAIN_ID(subdomain) == 2)
/* loop over all cell threads in the secondary phase domain */
thread_loop_c (cell_thread, subdomain)
{
/*loop over all cells in secondary phase cell threads */
begin_c_loop_int (cell, cell_thread)
{
C_CENTROID(xc,cell,cell_thread);
yamp = 0.0001*cos(2*3.14159625*xc[0]/0.01);
if (xc[1] > 0)
if (xc[1] < dx & yamp > 0)
C_VOF(cell,cell_thread) = 1 - yamp/dx;
else
C_VOF(cell,cell_thread) = 1;
else
if (xc[1] > -dx & yamp <= 0)
C_VOF(cell,cell_thread) = -yamp/dx;
else
C_VOF(cell,cell_thread) = 0;
}
end_c_loop_int (cell,cell_thread)
}
}
}

dmoroian January 6, 2011 12:50

Try this:
Code:

#include "udf.h"
#include "math.h"
/* domain pointer that is passed by init function is mixture domain */
DEFINE_INIT(phase_init_function_case4, mixture_domain)
{
int phase_domain_index;
cell_t cell;
Thread *cell_thread;
Domain *subdomain;
real xc[ND_ND];
double yamp;
double dx = 0.01/4;

#if !RP_HOST
/* loop over all subdomains (phases) in the superdomain (mixture) */
sub_domain_loop(subdomain, mixture_domain, phase_domain_index)
{
/* loop if secondary phase */
if (DOMAIN_ID(subdomain) == 3)
 
/* loop over all cell threads in the secondary phase domain */
thread_loop_c (cell_thread, subdomain)
{
/*loop over all cells in secondary phase cell threads */
begin_c_loop_int (cell, cell_thread)
{
C_CENTROID(xc,cell,cell_thread);
yamp = 0.0001*cos(2*3.14159625*xc[0]/0.01);
if (xc[1] > 0)
if (xc[1] < dx & yamp > 0)
C_VOF(cell,cell_thread) = yamp/dx;
else
C_VOF(cell,cell_thread) = 0;
else
if (xc[1] > -dx & yamp <= 0)
C_VOF(cell,cell_thread) = 1 + yamp/dx;
else
C_VOF(cell,cell_thread) = 1;
}
end_c_loop_int (cell,cell_thread)
}
/* loop if primary phase */
else if (DOMAIN_ID(subdomain) == 2)
/* loop over all cell threads in the secondary phase domain */
thread_loop_c (cell_thread, subdomain)
{
/*loop over all cells in secondary phase cell threads */
begin_c_loop_int (cell, cell_thread)
{
C_CENTROID(xc,cell,cell_thread);
yamp = 0.0001*cos(2*3.14159625*xc[0]/0.01);
if (xc[1] > 0)
if (xc[1] < dx & yamp > 0)
C_VOF(cell,cell_thread) = 1 - yamp/dx;
else
C_VOF(cell,cell_thread) = 1;
else
if (xc[1] > -dx & yamp <= 0)
C_VOF(cell,cell_thread) = -yamp/dx;
else
C_VOF(cell,cell_thread) = 0;
}
end_c_loop_int (cell,cell_thread)
}
}

#endif
}


mil3st3g January 6, 2011 14:07

Ok, I should have just posted this when I found it a while ago, just forgot about it while running a bunch of stuff in fluent, but I managed to solve the error following the instructions here: compiling udfs in win 64

Turns out this solved the issues I was having, and after doing this, I was able to load the existing code as compiled, rather than interpreted, and it worked just like it did in the serial version, without having to modify the function from what is in the original post.

Edit, nevermind, I did end up adding the #if !RP_HOST and #endif as you suggested dmoroian, so that in combination with using the .net sdk command prompt to start fluent.


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