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

Segmentation violation error...why???

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 6, 2011, 17:01
Default Segmentation violation error...why???
  #1
New Member
 
Enrico Bezzi
Join Date: Aug 2011
Posts: 9
Rep Power: 14
be89 is on a distinguished road
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;
}
be89 is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
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


All times are GMT -4. The time now is 11:38.