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/)
-   -   Segmentation Error during solution initialization using F_FLUX(f,t) Command (https://www.cfd-online.com/Forums/fluent-udf/191312-segmentation-error-during-solution-initialization-using-f_flux-f-t-command.html)

Navier Stoke August 7, 2017 00:52

Segmentation Error during solution initialization using F_FLUX(f,t) Command
 
Hi, I am trying to write UDF regarding diameter distribution of secondary phase in multiphase Simulation. I have two phases in my case. Primary phase is gas and secondary phase is liquid. The relation used needs mass flow rate of both liquid and gas phase to calculate the diameter of liquid droplet in each cell. Fluent successfully compiles the UDF. Also, UDF successfully hooks to the secondary phase diameter. But it gives following error whenever I initialized solution.
"received a fatal signal (Segmentation fault).Error Object: #f"
I have checked each line of code by commenting others. The problem I found is with C_FLUX(f,t).

Below is the code for refrence:

Code:

#include "udf.h"
#include "math.h"

#define SIGMA 0.07286            /*surface tension coefficient */


DEFINE_PROPERTY(liq_dia,cell,liq)
{
Thread *mix, *gas;
mix = THREAD_SUPER_THREAD(liq);  /*getting mixture thread*/
gas = THREAD_SUB_THREAD(mix,0); /*primary(gas) thread using mixture thread*/

/*----------------------------------------------------------------------------------------------------*/

double dia=0,v_fg=0,v_f=0,v_g=0,mass_gas=0,mass_liq=0;
double NV_VEC(v);                /*A vector*/
double ro_f=C_R(cell,liq);        /*Density of liquid phase in the cell*/
double mu_f=C_MU_EFF(cell,liq);  /*Effective viscosity of liquid in a cell*/ /*C_MU_L(cell,liq) */
double ro_g=C_R(cell,gas);        /*Density of gas phase in the cell*/

/*----------------------------------------------------------------------------------------------------*/

NV_DD(v,=,C_U(cell,gas),C_V(cell,gas),C_W(cell,gas),-,C_U(cell,liq),C_V(cell,liq),C_W(cell,liq));        /*relative velocity vector*/
v_fg = NV_MAG(v);                                /*relative velocity magnitude*/

v_f=sqrt(C_U(cell,liq)*C_U(cell,liq)+C_V(cell,liq)*C_V(cell,liq)+C_W(cell,liq)*C_W(cell,liq));        /*liquid velocity magnitude*/
v_g=sqrt(C_U(cell,gas)*C_U(cell,gas)+C_V(cell,gas)*C_V(cell,gas)+C_W(cell,gas)*C_W(cell,gas));        /*Gas velocity magnitude*/

/*----------------------------------------------------------------------------------------------------*/

int ng,nl;
face_t fg;
face_t fl;
Thread *tg;
Thread *tl;

c_face_loop(cell,gas,ng)
{
fg=C_FACE(cell,gas,ng);
tg=C_FACE_THREAD(cell,gas,ng);
mass_gas +=F_FLUX(fg,tg);        /*Gas flow rate calculation loop over all the faces*/       
}

c_face_loop(cell,liq,nl)
{
fl=C_FACE(cell,liq,nl);               
tl=C_FACE_THREAD(cell,liq,nl);                               
mass_liq +=F_FLUX(fl,tl);          /*Liquid flow rate calculation loop over all the faces*/                                                                                         
}

dia;        /*Here comes the relation for droplet diameter calculation*/

return(dia);
}


benjamin710 September 17, 2019 15:23

I have the same problem, it doesnot work


All times are GMT -4. The time now is 01:19.