CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   ACCESS_VIOLATION problem (https://www.cfd-online.com/Forums/fluent/46503-access_violation-problem.html)

kim November 4, 2007 01:17

ACCESS_VIOLATION problem
 
hi!

I met ACCESS_VIOLATION error during UDF adaption. what's wrong?

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: ()

i want modeling of chlorine gas absoption in water as chlorine-liquid form.

-----------------------------------

#include "udf.h" #include "sg_mphase.h" #define K_G 0.000000002 /* unit : [kmol/m2-s-Pa] */ #define HEN 67583775.0 /* henry constant of chlorine, [Pa] */ #define M_W 71.0 /* molecular weight of solute(chlorine), unit : [kg/kmol] */

DEFINE_SOURCE(liq_src,cell,liq_cl,dS,eqn) {

real m_lq; /* unit : [kg/m3-s] */

real iarea; /* interfacial area, [1/m]*/

real f_vf; /* fuction of volume fraction, [-] */

real p_p; /* patial pressure of chlorine gas, [Pa] */

real x_i; /* chlorine fraction in liquid phase, [-]*/

Thread *mix_th = THREAD_SUPER_THREAD(liq_cl); /* mixture thread */

Thread *gas_cl = THREAD_SUB_THREAD(mix_th, 3); /* gas phase chlorine thread ID equal 3 */

Thread *gas_n = THREAD_SUB_THREAD(mix_th, 5); /* gas phase nitrogen thread ID equal 5 */

Thread *liq_wat = THREAD_SUB_THREAD(mix_th, 2); /* liquid phase water thread ID equal 2 */

if ((C_VOF(cell,gas_cl)+C_VOF(cell,gas_n)) > 0.5)

{

f_vf = 1.0-(C_VOF(cell,gas_cl)+C_VOF(cell,gas_n));

}

else {

f_vf = C_VOF(cell,gas_cl)+C_VOF(cell,gas_n);

}

iarea = 2.0*(sqrt(f_vf/C_VOLUME_2D(cell, mix_th)));

if (C_VOF(cell,gas_cl)+C_VOF(cell,gas_n) > 0.0)

{

p_p = C_P(cell,mix_th)*C_VOF(cell,gas_cl)/(C_VOF(cell,gas_cl)+C_VOF(cell,gas_n));

}

else {

p_p = 0.0;

}

if (C_VOF(cell,liq_cl)+C_VOF(cell,liq_wat)> 0.0)

{

x_i = C_VOF(cell,liq_cl)/(C_VOF(cell,liq_cl)+C_VOF(cell,liq_wat));

}

else {

x_i = 0.0;

}

if (p_p-(HEN*x_i) > 0.0)

{

m_lq = K_G*iarea*(p_p-(HEN*x_i))*M_W;

dS[eqn] = K_G*iarea*M_W;

}

else {

m_lq = 0.0;

dS[eqn] = 0.0;

}

return m_lq; }

DEFINE_SOURCE(gas_src,cell,gas_cl,dS,eqn) {

real m_ga; /* unit : [kg/m3-s] */

real iarea; /* interfacial area, [1/m]*/

real f_vf; /* fuction of volume fraction, [-] */

real p_p; /* patial pressure of chlorine gas, [Pa] */

real x_i; /* chlorine fraction in liquid phase, [-]*/

Thread *mix_th = THREAD_SUPER_THREAD(gas_cl); /* mixture thread */

Thread *liq_cl = THREAD_SUB_THREAD(mix_th, 6); /* liquid phase chlorine thread ID equal 6 */

Thread *gas_n = THREAD_SUB_THREAD(mix_th, 5); /* gas phase nitrogen thread ID equal 5 */

Thread *liq_wat = THREAD_SUB_THREAD(mix_th, 2); /* liquid phase water thread ID equal 2 */

if ((C_VOF(cell,gas_cl)+C_VOF(cell,gas_n)) > 0.5)

{

f_vf = 1.0-(C_VOF(cell,gas_cl)+C_VOF(cell,gas_n));

}

else {

f_vf = C_VOF(cell,gas_cl)+C_VOF(cell,gas_n);

}

iarea = 2.0*(sqrt(f_vf/C_VOLUME_2D(cell, mix_th)));

if (C_VOF(cell,gas_cl)+C_VOF(cell,gas_n) > 0.0)

{

p_p = C_P(cell,mix_th)*C_VOF(cell,gas_cl)/(C_VOF(cell,gas_cl)+C_VOF(cell,gas_n));

}

else {

p_p = 0.0;

}

if (C_VOF(cell,liq_cl)+C_VOF(cell,liq_wat)> 0.0)

{

x_i = C_VOF(cell,liq_cl)/(C_VOF(cell,liq_cl)+C_VOF(cell,liq_wat));

}

else {

x_i = 0.0;

}

if (p_p-(HEN*x_i) > 0.0)

{

m_ga = -K_G*iarea*(p_p-(HEN*x_i))*M_W;

dS[eqn] = -K_G*iarea*M_W;

}

else {

m_ga = -0.0;

dS[eqn] = 0.0;

}

return m_ga; }


All times are GMT -4. The time now is 06:51.