CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Error: udf received a fatal signal(segmentation fault) (https://www.cfd-online.com/Forums/fluent-udf/183573-error-udf-received-fatal-signal-segmentation-fault.html)

BIANBOSHEN February 7, 2017 09:56

Error: udf received a fatal signal(segmentation fault)
 
Dear all,
when I try to use the following udf code to define droplet diameter, the 'error: udf received a fatal signal(segmentation fault)' is appeared.
DEFINE_PROPERTY(droplet_diam, c, mix_th)
{
real bubble_diam;
real max_size,min_size;
real vg;
real Reg;
Thread *pri_th, *sec_th;
pri_th = THREAD_SUB_THREAD(mix_th,0);
sec_th = THREAD_SUB_THREAD(mix_th,1);
max_size=1e-1;
min_size=1e-6;
vg=sqrt(pow(C_U(c,pri_th),2)+pow(C_V(c,pri_th),2)+ pow(C_W(c,pri_th),2));// vapor_v
Reg=C_R(c,pri_th)*vg*0.008/C_MU_EFF(c,pri_th);// Reynolds number
bubble_diam=0.00796*0.026/C_R(c,pri_th)/pow(C_VOF(c,pri_th)*vg,2)*pow(Reg,2/3)*pow(C_R(c,pri_th)/C_R(c,sec_th),-1/3)*pow(C_MU_EFF(c,pri_th)/C_MU_EFF(c,sec_th),2/3);
if (bubble_diam > max_size)
{
bubble_diam = max_size;
}
else if (bubble_diam < min_size)
{
bubble_diam = min_size;
}

return bubble_diam;
}

KevinZ09 February 7, 2017 10:36

Not easy to see what it could be caused, but some advices:

1. Check the correctness of your formula. There's a lot of multiplications and divisions in the bubble_diam equation and I don't see any brackets so it may not be doing what you'd want it to do.
2. Change powers such as 2/3 to their real counterparts, i.e., 2./3., otherwise you'll just get 0.
3. Include messages, or print statements, so you can see at what line it crashes.

pakk February 8, 2017 03:54

You are asking information from Fluent (with the macro's "C_U(c,pri_th)" and so on).
At least one of them is not present in your model.

To find out which one it is: replace them one by one by a number (for example 2.3), and see if the same error still occurs. If the error disappears, you have found the problematic macro.

How to fix the problem, depends on which macro is the problem.


All times are GMT -4. The time now is 14:45.