|
[Sponsors] |
September 6, 2011, 17:01 |
Segmentation violation error...why???
|
#1 |
New Member
Enrico Bezzi
Join Date: Aug 2011
Posts: 9
Rep Power: 15 |
I wrote this UDF for the simulation of water vapor condensation as a mass transfer in a multiphase problem.
I compiled the UDF in Fluent, but when I try to run the calculation I receive a "segmentation violation error". I think that the error comes from the line "w_sat=.....", but I don't know how to correct it. The UDF is this: #include "udf.h" #include "prop.h" /* for function: Saturation_Pressure() (of water) */ real H2O_Saturation_Pressure(real T) { real ratio, aTmTp; aTmTp = .01 * (T - 338.15); ratio = (647.286/T - 1.) * (-7.419242 + aTmTp*(.29721 + aTmTp*(-.1155286 + aTmTp*(8.685635e-3 + aTmTp*(1.094098e-3 + aTmTp*(-4.39993e-3 + aTmTp*(2.520658e-3 - aTmTp*5.218684e-4))))))); return (22.089e6 * exp(MIN(ratio,35.))); } DEFINE_MASS_TRANSFER(vap_condensation,c,t,from_pha se_index,from_species_index,to_phase_index,to_spec ies_index) { real m_lg; real T_temp=C_T(c,t); int i; Material *m=THREAD_MATERIAL(t), *sp; real x_h2o, x_sat, w_sat; /* w=mv/ma; x=mv/(ma+mv) */ real p=101325.; if(MATERIAL_TYPE(m)==MATERIAL_MIXTURE) { mixture_species_loop(m,sp,i) { if (0 == strcmp(MIXTURE_SPECIE_NAME(m,i),"h2o") || (0 == strcmp(MIXTURE_SPECIE_NAME(m,i),"H2O"))) { x_h2o = C_YI(c,t,i); } } } w_sat=.622*H2O_Saturation_Pressure(T_temp)/(p-H2O_Saturation_Pressure(T_temp)); x_sat=w_sat/(1+w_sat); m_lg = 0.; if (x_h2o > x_sat) { m_lg=-(x_h2o-x_sat)*C_R(c,t); } return m_lg; } |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Segmentation violation | louiza | FLUENT | 16 | June 27, 2017 16:41 |
Segmentation Violation | Corentin | FLUENT | 1 | February 13, 2011 02:07 |
Defining Multiphase by text and by gui = different result and Segmentation Violation | RPJones | FLUENT | 0 | June 9, 2009 17:24 |
segmentation violation | wasan | FLUENT | 0 | December 23, 2008 12:37 |
SEGMENTATION VIOLATION | kROZ | FLUENT | 1 | May 4, 2006 10:12 |