Parallel udfs

Simple UDFs can be properly compiled for the parallel solver but the compiled library cannot be successfully linked to the case.
No error message appears neither while compiling nor while opening .so files.
Still the udfs are not accessible from the boundary condition panel.
The udfs can be interpreted in parallel with the socket communicator but not with the default one (I get a 'input in flex scanner failed' error message).
Here are the udfs:
*********************************
#include "udf.h"

DEFINE_PROFILE (portata_a, thread, position)
{
real mass_flux;
real t;
#if !RP_NODE
{
t = RP_Get_Real("flow-time");
if (t<=0.068)
mass_flux = 10.0 + 3206.0*t;
else if (0.068<t<=0.13)
mass_flux = -7375.0 + 111806.0*t;
else if (0.13<t<=0.50)
mass_flux = 7648.5 - 3756.8*t;
else if (0.50<t<=0.80)
mass_flux = 35818.0 - 87572.0*t + 54875.0*t*t;
else
mass_flux = 2780.0 - 2400.0*t;
}
#endif

host_to_node_real_1(t);
host_to_node_real_1(mass_flux);

#if !RP_HOST
{
face_t f;
begin_f_loop_int (f,thread)
{
F_PROFILE(f, thread, position) =mass_flux;
}
end_f_loop_int (f,thread)
}
#endif
}
**************************************
#include "udf.h"


DEFINE_PROFILE (portata_r, thread, position)
{
real mass_flux;
real t;
#if !RP_NODE
{
t = RP_Get_Real("flow-time");
if (t<=0.068)
mass_flux = 8.0 + 2559.0*t;
else if (0.068<t<=0.13)
mass_flux = -5892.0 + 89323.0*t;
else if (0.13<t<=0.50)
mass_flux = 6112.0 - 3013.5*t;
else if (0.50<t<=0.80)
mass_flux = 28569.0 - 69835.0*t + 43750.0*t*t;
else
mass_flux = 2205.0 - 1900.0*t;
}
#endif

host_to_node_real_1(t);
host_to_node_real_1(mass_flux);


#if !RP_HOST
{
face_t f;
begin_f_loop_int (f,thread)
{
F_PROFILE(f, thread, position) = mass_flux;
}
end_f_loop_int (f,thread)
}
#endif
}

The Profile UDFs dont get called on the HOST process, only the NODE processes.

They are not like the Adjust function.

The workaround is to create a global static real variable :

static real flow_time;

and an adjust function that sets this value in the HOST process and sends it to the NODE processes.

The profile UDF can then access flow_time as if it were any other global variable.





Show Form
No comments yet. Be the first to add a comment!