CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   pb with my UDF (https://www.cfd-online.com/Forums/fluent/45828-pb-my-udf.html)

Florent CHAMPET August 23, 2007 11:01

pb with my UDF
 
Hi, I have a problem with my UDF for mass transfert. There is no pb during the compilation but at the beginning of the first iteration, a fatal signal (segmentation violation) occurred. Is someone able to help me ? Great thanks. This is my UDF #include "udf.h" #include "sg_mphase.h" #define T_SAT 418.2 #define LAT_HT 500 /* ID species : liquid1 = 2 ; vapor1 = 3 ; species3 = 5 ; liquid2 = 6 */

/************************************************** ************************************************** *******************/ /******************** Modelisation de la reaction chimique du liquide1 en liquide2****************************/ /************************************************** ************************************************** *******************/

DEFINE_MASS_TRANSFER(reaction_chimiq,cell,pri_th,f rom_0,from_3,to_1,to_6) /*from_phase_index, from_species_index,to_phase_index, to_species_index */ { real masse_transfert; /* [kg/s] */

Thread *mix_th, *sec_th; mix_th = THREAD_SUPER_THREAD(pri_th); sec_th = THREAD_SUB_THREAD(mix_th,1);

real pnt = C_T(cell,sec_th); real density = C_R(cell,sec_th); /* definition du taux de conversion du styrene X */

real w = C_YI(cell,sec_th,0); /* w is the mass fraction of liquid1 at current time step */ real w0 = 0.9; /* w0 is initial mass fraction of liquid1 at the inlet */ real X = 1.-w/w0; /* definition of the production rate Rp */ real Kd = 5.48*pow(10,15)*exp(-18240/pnt); real Kp = 6346*exp(-2600/pnt); real Ki = 212*exp(-15005/pnt); /* [s-1] */ real f = 0.7; real Ktc0 = 1.205*pow(10,7)*exp(-844/pnt); real A1 = 2.57-0.00505*pnt; real A2 = 9.56-0.0176*pnt; real A3 = -3.03+0.00785*pnt; real Ktc = Ktc0*exp(A1*X+A2*X*X+A3*X*X*X); /* [l.mol-1.s-1] */ real Rp = Kp*density*w*sqrt((2*Ki*(density*w0)*(density*w0)* (density*w0))/Ktc); /* [kg/m3/s] */

masse_transfert = Rp*CURRENT_TIMESTEP; /* [kg/m3] */

return masse_transfert;

}


Joe August 23, 2007 19:50

Re: pb with my UDF
 
Repost enclosing the code using the HTML tags: pre and /pre


All times are GMT -4. The time now is 05:52.