CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

coded auxiliary k-epsilon calculations and got: received a fatal signal(Segmentation)

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 17, 2015, 03:17
Unhappy coded auxiliary k-epsilon calculations and got: received a fatal signal(Segmentation)
  #1
New Member
 
Jeric zhang
Join Date: May 2015
Posts: 3
Rep Power: 10
Jeric is on a distinguished road
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;
}
Jeric is offline   Reply With Quote

Old   June 17, 2015, 06:24
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
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?
pakk is offline   Reply With Quote

Old   June 17, 2015, 06:56
Default can help me
  #3
New Member
 
Jeric zhang
Join Date: May 2015
Posts: 3
Rep Power: 10
Jeric is on a distinguished road
Quote:
Originally Posted by pakk View Post
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.
Jeric is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 22:41.