SIGSEGV error at all the nodes while using parallel simulation
Hello,
I am trying to create a UDF which can solve an additional equation for a UDS. It gives segmentation error no matter what changes I do to the code. I have compiled and defined the UDFs correctly. (No problem there).
The UDF Code:
#include "udf.h"
#include "header.h"
DEFINE_ADJUST(normalization_coefficient,d)
{
real Normalization_coeff;
real sum_mod_grad_alpha = 0;
real sum_mod_alpha_l_grad_alpha = 0;
#if !RP_HOST
int zone_ID = 2;
Thread *tc = Lookup_Thread(d,zone_ID);
cell_t c;
Domain *dom;
begin_c_loop_int(c,tc)
{
sum_mod_grad_alpha += (NV_MAG(C_VOF_G(c,tc))*C_VOLUME(c,tc));
sum_mod_alpha_l_grad_alpha += (0.5*NV_MAG(C_VOF_G(c,tc))*C_VOLUME(c,tc));
}
end_c_loop_int(c,tc)
#endif /* !RP_HOST */
sum_mod_grad_alpha = PRF_GRSUM1(sum_mod_grad_alpha);
sum_mod_alpha_l_grad_alpha = PRF_GRSUM1(sum_mod_alpha_l_grad_alpha);
node_to_host_real_2(sum_mod_grad_alpha, sum_mod_alpha_l_grad_alpha);
#if !RP_NODE
Normalization_coeff = sum_mod_grad_alpha/sum_mod_alpha_l_grad_alpha;
#endif/* RP_NODE */
host_to_node_real_1(Normalization_coeff);
#if !RP_HOST
begin_c_loop_int(c, tc)
{
C_UDMI(c, tc, 0) = Normalization_coeff;
}
end_c_loop_int(c, tc)
#endif /* !RP_HOST */
}
DEFINE_SOURCE(phi_source,c,t,dS,eqn)
{
#if !RP_HOST
face_t f;
real con;
real s;
real kinetic_mobility, Normalization_coeff;
Normalization_coeff = C_UDMI(c,t,0);
kinetic_mobility = (2.*SIGMA /(2.-SIGMA))*(sqrt(MOL_MASS/(2.*PI*R*T_SAT)))*RHO_V*H_LV / T_SAT;
con = Normalization_coeff*H_LV*kinetic_mobility;
if PRINCIPAL_FACE_P(f,t)
{
return 0;
}
else
{
s = con*(NV_MAG(C_VOF_G(c,t)))*C_VOF(c,t)*(C_T(c,t)-T_SAT)-C_UDSI(c,t,0);
dS[eqn] = -1;
return s;
}
#endif
}
The Error:
Node 6: Process 5984: Received signal SIGSEGV.
Comments
Have you set the secondary(?) gradients to be retained during the calculation? Otherwise they're not available in UDFs.
What exactly do you mean by secondary gradients? is it C_VOF_G(c,t)?
Yes, there's a text command to ensure some of these are retained:
/solve/set expert no yes no
Then try the UDF again.
If that doesn't help it's something in your coding so add messages into the UDF to try and trace the issue: maybe switch some of the equations for constants to narrow down the cause.
I am using a parallel mode of fluent, so I have to keep the temp memory from being freed. And I tried putting message after every step but the code doesn't even run to show the message. Now it's giving the 999999: mpt accept error. Which means the host is doing some process that it should not. I tried dropping the gradient term altogether but that, too, doesn't work.
You'll need to work through the code and figure out which bit is causing this: check phase domain too as I can't see the definition.
Are there any conditions to use the macro C_VOF(c,t)? I checked my code line by line, apparently, C_VOF(c,t) creates the problem. Other cell parameters such as C_T(c,t) work fine.
I think you need the phase thread rather than cell thread depending on how it's used. Search C_VOF in the Fluent Customisation Manual for examples and definition.
Hi gunjanauti, I have a similar issue with you.
Have you alreadly found a solution on 'How to calculate gradient of volume fraction in parallel mode?'.
well in my case I need to calculate gradient of temperature (C_T_G(c,t)).
Hi rwoolhou, I have a similar problem.
on the case of 'Expert option for not freeing temporary solver memory is incompatible with adaption in both paralel and serial...', how can I calculate the gradient of temperature (C_T_G(c,t))?