|
[Sponsors] |
August 30, 2011, 04:48 |
UDF segmentation violation error
|
#1 |
New Member
Enrico Bezzi
Join Date: Aug 2011
Posts: 9
Rep Power: 15 |
I wrote the following UDF to define the condensation in a multiphase model from moist air water vapor to liquid water:
#include "udf.h" #include "mem.h" #include "math.h" #include "sg.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.))); } Domain *d; DEFINE_MASS_TRANSFER(vap_condensation,c,t,from_pha se_index,from_species_index,to_phase_index,to_spec ies_index) { real m_lg; int i; Material *m=THREAD_MATERIAL(t), *sp; real x_h2o, x_sat, w_sat; /* w=mv/ma; x=mv/(ma+mv) */ #define p 101325 thread_loop_c(t,d) { begin_c_loop(c,t) { 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(C_T(c,t))/(p-H2O_Saturation_Pressure(C_T(c,t))); 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; } end_c_loop(c,t) } } Then I compiled it in Fluent receiving no error, but I can't initialize the calculation because Fluent gives a "segmentation violation error" when trying to do it. Can anyone help me, please? |
|
December 21, 2012, 04:07 |
|
#2 |
Member
Indrajit
Join Date: Nov 2012
Posts: 33
Rep Power: 14 |
Hi Enrico Bezzi,
I am facing the same problem for a different case.When I compile there isn't any error however when I try to initialise it gives me segmentation violation error. Since it has been an year, did you solve the problem??? What was going wrong? Regards, Indrajit |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[OpenFOAM] Native ParaView Reader Bugs | tj22 | ParaView | 270 | January 4, 2016 12:39 |
Compile problem | ivanyao | OpenFOAM Running, Solving & CFD | 1 | October 12, 2012 10:31 |
c++ libraries and solver compiling | vaina74 | OpenFOAM Installation | 13 | February 3, 2012 18:43 |
Version 15 on Mac OS X | gschaider | OpenFOAM Installation | 113 | December 2, 2009 11:23 |
OpenFOAM on MinGW crosscompiler hosted on Linux | allenzhao | OpenFOAM Installation | 127 | January 30, 2009 20:08 |