CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   access violation error in vof,please help me ?! (http://www.cfd-online.com/Forums/fluent/42134-access-violation-error-vof-please-help-me.html)

Asghari August 25, 2006 03:57

access violation error in vof,please help me ?!
 
I use from following udf for definition heat and mass source terms in vof model. then i hook this source terms to fluent .

But as soon as i start run,i face with access violation error in relation with hooking macro of energy source define in mixture level phase.

/********Defining mass source term for secondary phase*****/

DEFINE_SOURCE(source_mass,cell,cell_thread,ds,eqn)

{

real T_SAT= a value;

real Source ;

Thread *tm=THREAD_SUPER_THREAD(cell_thread);

Thread **pt=THREAD_SUB_THREADS(tm);

Source=0.0;

if(C_T(cell,pt[1])>=T_SAT)

{ Source=-0.1*C_VOF(cell,pt[1])*C_R(cell,pt[1])*fabs(C_T(cell,pt[1]-T_SAT)/T_SAT); }

if((Source=0.0)&&(C_T(cell,pt[1])<=T_SAT))

{ Source=0.1*C_VOF(cell,pt[0])*C_R(cell,pt[0])*fabs(C_T(cell,pt[0]-T_SAT)/T_SAT); }

ds[eqn]=0.0; return Source;

}

ERROR HAPPENED IN FOLLOWING DEFINE_SOURCE MACRO for energy source!!!

/********Defining enthalpy source term for mixture*****/

DEFINE_SOURCE(source_mass,cell,cell_thread,ds,eqn)

{

real T_SAT= a value;

real Source ;

Thread *tm=THREAD_SUPER_THREAD(cell_thread);

Thread **pt=THREAD_SUB_THREADS(tm);

Source=0.0;

if(C_T(cell,pt[1])>=T_SAT)

{ Source=-0.1*C_VOF(cell,pt[1])*C_R(cell,pt[1])*fabs(C_T(cell,pt[1]-T_SAT)/T_SAT); }

if((Source=0.0)&&(C_T(cell,pt[1])<=T_SAT))

{ Source=0.1*C_VOF(cell,pt[0])*C_R(cell,pt[0])*fabs(C_T(cell,pt[0]-T_SAT)/T_SAT); }

ds[eqn]=0.0;

SOURCE_ENERGY=Source*2443000

return SOURCE_ENERGY;

}

Can everybody explain why this access violation error happen in hooking energy define_source in mixture phase?

Best regards;


RoM August 28, 2006 06:52

Re: access violation error in vof,please help me ?
 
If you hook the energy source to the mixture then cell_thread will be the mixture thread.

Thread *tm=THREAD_SUPER_THREAD(cell_thread);

will probably cause the crash because cell_thread already refers to the mixture. Delete this line and change the following

Thread **pt=THREAD_SUB_THREADS(tm);

to

Thread **pt=THREAD_SUB_THREADS(cell_thread);

RoM


All times are GMT -4. The time now is 18:29.