CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

UDF segmentation violation error

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 30, 2011, 03:48
Default UDF segmentation violation error
  #1
New Member
 
Enrico Bezzi
Join Date: Aug 2011
Posts: 9
Rep Power: 14
be89 is on a distinguished road
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?
be89 is offline   Reply With Quote

Old   December 21, 2012, 03:07
Default
  #2
Member
 
Indrajit
Join Date: Nov 2012
Posts: 33
Rep Power: 13
IndrajitW is on a distinguished road
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
IndrajitW is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[OpenFOAM] Native ParaView Reader Bugs tj22 ParaView 270 January 4, 2016 11:39
Compile problem ivanyao OpenFOAM Running, Solving & CFD 1 October 12, 2012 09:31
c++ libraries and solver compiling vaina74 OpenFOAM Installation 13 February 3, 2012 17:43
Version 15 on Mac OS X gschaider OpenFOAM Installation 113 December 2, 2009 10:23
OpenFOAM on MinGW crosscompiler hosted on Linux allenzhao OpenFOAM Installation 127 January 30, 2009 19:08


All times are GMT -4. The time now is 10:53.