CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   FLUENT received fatal signal (ACCESS_VIOLATION) (http://www.cfd-online.com/Forums/fluent/46584-fluent-received-fatal-signal-access_violation.html)

samy November 10, 2007 14:09

FLUENT received fatal signal (ACCESS_VIOLATION)
 
Hallo I am trying to code for equation turbulence model by means of UDF and UDS. Now I can complie my UDF very well but when I try to initialize the following error message is displyed Error: FLUENT received fatal signal (ACCESS_VIOLATION) 1. Note exact events leading to error. 2. Save case/data under new name. 3. Exit program and restart to continue. 4. Report error to your distributor. Error Object: Then I searched the internet, I found UDF written for low Re k-e model. I checked the code and it is appear correct. after compiling the UDF and hoocking the function as given in the UDF manual the same error message appeared. also the UDS number was increased to 2 from define.....> user-defined....>scalers. following the UDF code

#include "udf.h" #include "sg_udms.h"

/* Turbulence model constants */ const real C_MU=0.09; const real SIG_K=1.0; const real SIG_D=1.3; const real C1_D=1.44; const real C2_D=1.92; /*DEFINE_EXECUTE_ON_LOADING(onloading,libudf) { void Set_User_Scaler_Name(int 0,char K); void Set_User_Scaler_Name(int 1,char D); }*/

/* User-defined scalars */ enum { K, D, N_REQUIRED_UDS };

/* Reynolds number definitions */ real Re_y(cell_t c, Thread *t) { real c_k = C_UDSI(c,t,K); real rr= C_R(c,t)*sqrt(c_k)*C_WALL_DIST(c,t)/C_MU_L(c,t); return rr; }

real Re_t(cell_t c, Thread *t) { real c_k, c_d;

c_k = C_UDSI(c,t,K); c_d = C_UDSI(c,t,D);

return C_R(c,t)*SQR(c_k)/C_MU_L(c,t)/c_d; }

/* Damping Functions */ real f_mu(cell_t c, Thread *t) { real dd= tanh(0.008*Re_y(c,t))*(1.+4/pow(Re_t(c,t),0.75)); return dd; }

real f_1(cell_t c, Thread *t) { return 1.; }

real f_2(cell_t c, Thread *t) { real ee= (1.-2/9*exp(-MIN(Re_t(c,t)*Re_t(c,t)/36,10))) *(1.-exp(-MIN(Re_y(c,t)/12,10))); return ee; }

DEFINE_SOURCE(k_source, c, t, dS, eqn) { real c_k, c_d; real mu_t, G_k, source;

c_k = C_UDSI(c,t,K); c_d = C_UDSI(c,t,D);

mu_t = C_MU_T(c,t) + C_MU_L(c,t)*1.0E-10; G_k = C_MU_T(c,t)*SQR(Strainrate_Mag(c,t));

dS[eqn] = -2.*C_R(c,t)*C_R(c,t)*C_MU*f_mu(c,t)*c_k/mu_t; source= G_k - C_R(c,t)*C_R(c,t)*C_MU*f_mu(c,t)*SQR(c_k)/mu_t; return source; }

DEFINE_SOURCE(d_source, c, t, dS, eqn) { real c_k, c_d; real G_k;

c_k = C_UDSI(c,t,K); c_d = C_UDSI(c,t,D);

G_k = C_MU_T(c,t)*SQR(Strainrate_Mag(c,t));

dS[eqn] = C1_D*f_1(c,t)*G_k/c_k - 2.*C2_D*f_2(c,t)*C_R(c,t)*c_d/c_k; return C1_D*f_1(c,t)*G_k*c_d/c_k - C2_D*f_2(c,t)*C_R(c,t)*SQR(c_d)/c_k; }

DEFINE_DIFFUSIVITY(ke_diffusivity, c, t, eqn) { real diff; real mu = C_MU_L(c,t); /* real mu_t = C_MU_T(c,t); */ real c_k = C_UDSI(c,t,K); real c_d = C_UDSI(c,t,D); real mu_t = C_R(c,t)*C_MU*f_mu(c,t)*SQR(c_k)/c_d;

switch (eqn) { case K: diff = mu_t/SIG_K + mu; break; case D: diff = mu_t/SIG_D + mu; break; default: diff = mu_t + mu; } return diff; }

DEFINE_TURBULENT_VISCOSITY(ke_mut, c, t) /* Set the turbulent viscosity */ { real c_k = C_UDSI(c,t,K); real c_d = C_UDSI(c,t,D); real mu_t = C_R(c,t)*C_MU*f_mu(c,t)*SQR(c_k)/c_d;

return mu_t; }

/*DEFINE_ADJUST(turb_adjust, domain) { /* do something... */ /*}*/

DEFINE_INIT(turb_init, dom) { cell_t c; Thread *t; thread_loop_c(t,dom) { begin_c_loop(c,t) { C_UDSI(c,t,K)=0.07*20*20; C_UDSI(c,t,D)=1; } end_c_loop(c,t) } }

DEFINE_PROFILE(wall_d_bc, t, position) { face_t f; cell_t c0; Thread *t0 = t->t0; /* t0 is cell thread */ real xw[ND_ND], xc[ND_ND], dx[ND_ND], rootk, dy, dro, drootkdy;

/* Do nothing if wall distance not computed or not in fluid zone */ if (!Data_Valid_P() || !FLUID_THREAD_P(t0)) return;

begin_f_loop(f,t) { c0 = F_C0(f,t); rootk = sqrt(MAX(C_UDSI(c0,t0,K), 0.)); F_CENTROID(xw,f,t); C_CENTROID(xc,c0,t0); NV_VV(dx, =, xc, -, xw); dy = ND_MAG(dx[0], dx[1], dx[2]); drootkdy = rootk/dy; F_PROFILE(f,t,position) = 2.*C_MU_L(c0,t0)/C_R(c0,t0)*drootkdy*dro; } end_f_loop(f,t) }

----------- please help me to overcome this problem thanks in advance


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