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/)
-   -   coded auxiliary k-epsilon calculations and got: received a fatal signal(Segmentation) (https://www.cfd-online.com/Forums/fluent-udf/154553-coded-auxiliary-k-epsilon-calculations-got-received-fatal-signal-segmentation.html)

Jeric June 17, 2015 03:17

coded auxiliary k-epsilon calculations and got: received a fatal signal(Segmentation)
 
Hi, everyone .
Recently,I according an equations write a UDF about the K-epsilon .but when I interpreted to the fluent.it can't calculation.I spent lots of time to find what reason result in .but don't any finging.so I want someone to help me .
this is my code.
#include"udf.h"
#define min(x,y)(x<y?x:y)
const real C_MU=0.09;
const real C_X=0.61;
const real SIG_K=1.0;
const real SIG_E=1.3;
const real C1_D=1.44;
const real C2_D=1.92;
const real C_N=2.0;
const real BET_B=0.002;
enum
{
K,E
};
real L_K(cell_t c,Thread *t)
{
return pow(C_MU_L(c,t),3/4)/pow(C_UDSI(c,t,K),1/4);
}
real L_I(cell_t c,Thread *t)
{
return pow(C_UDSI(c,t,K),3/2)/C_UDSI(c,t,E);
}
real L_C(cell_t c,Thread *t)
{
real vol;
vol=C_VOLUME(c,t);
return C_X*pow(vol,1/3);
}
real F_r(cell_t c,Thread *t)
{
return min(1.0,pow((1.0-exp(-BET_B*L_C(c,t)/L_K(c,t)))/(1.0-exp(-BET_B*L_I(c,t)/L_K(c,t))),C_N));
}
DEFINE_UDS_UNSTEADY(kun_time,cell,thread,i,apu,su)
{
real physical_dt,vol,rho,phi_old;
physical_dt=RP_Get_Real("physical-time-step");
vol=C_VOLUME(cell,thread);
rho=C_R(cell,thread);
*apu=-rho*vol/physical_dt;
phi_old=C_STORAGE_R(cell,thread,SV_UDS_I(K));
*su=rho*vol*phi_old/physical_dt;
}
DEFINE_UDS_UNSTEADY(eun_time,cell,thread,i,apu,su)
{
real physical_dt,vol,rho,phi_old;
physical_dt=RP_Get_Real("physical-time-step");
vol=C_VOLUME(cell,thread);
rho=C_R(cell,thread);
*apu=-rho*vol/physical_dt;
phi_old=C_STORAGE_R(cell,thread,SV_UDS_I(E));
*su=rho*vol*phi_old/physical_dt;
}
DEFINE_SOURCE(k_source,c,t,ds,eqn)
{
real source;
ds[eqn]=0.0;
source=C_MU_T(c,t)*C_STRAIN_RATE_MAG(c,t)*C_STRAIN _RATE_MAG(c,t)-C_R(c,t)*C_UDSI(c,t,E);
return source;
}
DEFINE_SOURCE(e_source,c,t,ds,eqn)
{
real source;
ds[eqn]=C1_D*C_MU_T(c,t)*C_STRAIN_RATE_MAG(c,t)*C_STRAIN_ RATE_MAG(c,t)/C_UDSI(c,t,K)-2.*C2_D*C_R(c,t)*C_UDSI(c,t,E)/C_UDSI(c,t,K);
source=C_UDSI(c,t,E)/C_UDSI(c,t,K)*(C1_D*C_MU_T(c,t)*C_STRAIN_RATE_MAG( c,t)*C_STRAIN_RATE_MAG(c,t)-C2_D*C_R(c,t)*C_UDSI(c,t,E));
return source;
}
DEFINE_DIFFUSIVITY(ke_diffusivity,c,t,i)
{
real diff;
real mu_t;
int nscalar=i;
mu_t=C_R(c,t)*C_MU*F_r(c,t)*C_UDSI(c,t,K)*C_UDSI(c ,t,K)/C_UDSI(c,t,E);
if(nscalar==K)
diff=mu_t/SIG_K+C_MU_L(c,t);
else
diff=mu_t/SIG_E+C_MU_L(c,t);
return diff;
}
DEFINE_TURBULENT_VISCOSITY(turb,c,t)
{
real mu_t;
mu_t=F_r(c,t)*C_R(c,t)*C_MU*C_UDSI(c,t,K)*C_UDSI(c ,t,K)/C_UDSI(c,t,E);
return mu_t;
}

pakk June 17, 2015 06:24

When you say "it can't calculation", it is not clear what you mean. Can you be more clear about the problem?

Do you get errors? If so, which errors?
Do you get warnings? If so, which warnings?
Do you get results? If so, what is wrong with them?

Jeric June 17, 2015 06:56

can help me
 
Quote:

Originally Posted by pakk (Post 550734)
When you say "it can't calculation", it is not clear what you mean. Can you be more clear about the problem?

Do you get errors? If so, which errors?
Do you get warnings? If so, which warnings?
Do you get results? If so, what is wrong with them?

thanks ,When I import it into the FLUENT and initialize it when everything prepared.Its will tip the error:received a fatal signal(Segmentation fault) and Error Object:#f. I don't you know the mean.


All times are GMT -4. The time now is 09:16.