|
[Sponsors] |
November 4, 2007, 02:17 |
ACCESS_VIOLATION problem
|
#1 |
Guest
Posts: n/a
|
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; } |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF compiling problem | Wouter | Fluent UDF and Scheme Programming | 6 | June 6, 2012 05:43 |
Gambit - meshing over airfoil wrapping (?) problem | JFDC | FLUENT | 1 | July 11, 2011 06:59 |
natural convection problem for a CHT problem | Se-Hee | CFX | 2 | June 10, 2007 07:29 |
Adiabatic and Rotating wall (Convection problem) | ParodDav | CFX | 5 | April 29, 2007 20:13 |
Is this problem well posed? | Thomas P. Abraham | Main CFD Forum | 5 | September 8, 1999 15:52 |