CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   About The fatal error ACCEss violation (http://www.cfd-online.com/Forums/fluent/74595-about-fatal-error-access-violation.html)

sosososo1114 April 4, 2010 02:31

About The fatal error ACCEss violation
 
Dear all, would u help me about this fatal error. When I use the mixture model to simulate the condensation process of the moisture air, I compile this UDF program and set up the species transfer model to set the fraction of water vapor in air. UDF seems ok while compiling. Yet when I try to initialize the case , the fluent message me that:
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: ()
:(

what's wrong with my case? thx u!

And here is my UDF program:

#include "udf.h" /*include general macros*/
#include "sg_mphase.h" /*include volume macros*/
#include "mem.h"
#define LAT_HT 2260 /*define the latent heat of water vapor*/
#define pi 3.1415
#define R 8.314 /*gas constant 8.314j/mol.K*/
#define moleweight 0.018 /*SI unit water mole weight 0.018kg/mol */
#define A 7.19621
#define B 1730.63
#define C 233.426
#define Ra 287
#define Rhon2 1.138
#define Rhoo2 0.649961
real p_t;
real p_v(real temp,real p_t)/*calculate the pressure of water vapor in the air */
{ real p_v;
p_v=p_t-(Rhon2+Rhoo2)*Ra*temp;
return p_v;
}
DEFINE_SOURCE(liq_src, cell, pri_th, dS, eqn) /*define the source term of water liquid*/
{
Thread *mix_th, *sec_th; /* pionter to the mixture and that to the second phase, air */
real m_dot_l; /*define the evaportation rate*/
real P_SAT, p_t ;
mix_th = THREAD_SUPER_THREAD(pri_th); /*the pointor to the mixture*/
sec_th = THREAD_SUB_THREAD(mix_th, 1); /* the pointor to air*/
P_SAT=exp(A-B/(C_T(cell,pri_th)+C-273.15))*1e3; /*define the satured pressure of water vapor,antoine Equation*/
p_t=C_P(cell,mix_th)+101325;/*define the absolute pressure of mixture in a cell*/
if(p_v(C_T(cell,mix_th),p_t)< P_SAT) /*whether the pressure of water vapor is greater than the saturation pressure*/
{if(C_YI(cell,mix_th,0)) /*find whether there are liquids*/
{m_dot_l = -(P_SAT-p_v(C_T(cell,mix_th),p_t))*sqrt(moleweight)*(2*pi* R*C_T(cell,pri_th)); /* if there is liquids, mass transfer from condensation to air */
dS[eqn]= sqrt(moleweight)*(2*pi*R*C_T(cell,pri_th));
}
else /* if there is no liquid, no mass transfer occurs*/
{
m_dot_l=0;
}
}
else
{m_dot_l = (P_SAT-p_v(C_T(cell,mix_th),p_t))*sqrt(moleweight)*(2*pi* R*C_T(cell,pri_th));
dS[eqn] = 0;
}
return m_dot_l;
}
DEFINE_SOURCE(vap_src, cell, sec_th, dS, eqn)
{
Thread *mix_th, *pri_th;
real m_dot_v;
real P_SAT ;
real p_t;
mix_th = THREAD_SUPER_THREAD(sec_th);
pri_th = THREAD_SUB_THREAD(mix_th, 0);
P_SAT=exp(A-B/(C_T(cell,pri_th)+C-273.15))*1e3;
p_t=C_P(cell,mix_th)+101325;
if(p_v(C_T(cell,mix_th),p_t)< P_SAT)
{if(C_YI(cell,mix_th,0)) /*find whether there are liquids*/
{
m_dot_v = (P_SAT-p_v(C_T(cell,mix_th),p_t))*sqrt(moleweight)*(2*pi* R*C_T(cell,pri_th));
dS[eqn] =0;
}
else
m_dot_v=0; /* if there is no liquid, no mass transfer occurs*/
}
else
{m_dot_v = -(P_SAT-p_v(C_T(cell,mix_th),p_t))*sqrt(moleweight)*(2*pi* R*C_T(cell,pri_th)); /*mass transfer from vapor to water*/
dS[eqn]=sqrt(moleweight)*(2*pi*R*C_T(cell,pri_th));
}
return m_dot_v;
}
DEFINE_SOURCE(enrg_src, cell, mix_th, dS, eqn)
{
Thread *pri_th,*sec_th;
real m_dot;
real P_SAT;
real p_t;
pri_th=THREAD_SUB_THREAD(mix_th,0);
sec_th=THREAD_SUB_THREAD(mix_th,1);
P_SAT=exp(A-B/(C_T(cell,pri_th)+C-273.15))*1e3;
p_t=C_P(cell,mix_th)+101325;
if(p_v(C_T(cell,mix_th),p_t)< P_SAT)
{
if(C_YI(cell,mix_th,0))
{
m_dot =- (P_SAT-p_v(C_T(cell,mix_th),p_t))*sqrt(moleweight)*(2*pi* R*C_T(cell,pri_th));
dS[eqn]=sqrt(moleweight)*(2*pi*R*C_T(cell,pri_th));
}
else
m_dot=0;
}
else
{
m_dot = (P_SAT-p_v(C_T(cell,mix_th),p_t))*sqrt(moleweight)*(2*pi* R*C_T(cell,pri_th));
dS[eqn]=-sqrt(moleweight)*(2*pi*R*C_T(cell,pri_th));
}
return LAT_HT*m_dot;
}

thank u

sosososo1114 April 6, 2010 22:00

Hi, dear all, , I have cacthed some light with the problems above. THe fatal error is caused by the specieces mass fraction macro C_YI in the UDF. When I delete the macro, the case can be initialized.

But I do need this macro in my program to make sure mass transfer occures only when water liquid exists, scince at the beginning of the process there is no liquid water.

So how should I cite this macro correctly in my UDF? If u know, please tell me. THX!


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