-
-
February 16, 2022 at 10:07 am
pavankonchada123
SubscriberWhen I try to use below mentioned udf at interface of water and watervapor/air mixture for saturation pressure it is giving floating point exception
#include "udf.h"
#define MOLAR_MASS_WATER 18.01534 //g/mol
#define MOLAR_MASS_AIR 28.97 // g/mol
#define RHO_WV 0.5542 // kg/m3
#define RHO_AIR 1.225 // kg/m3
DEFINE_PROPERTY(saturation_pressure,c,t)
{
real z,sat_p,p_w;
real vapor_p;
//#!RP_HOST
real vol = C_VOLUME(c, t);
real temp = C_T(c,t);//300K
real p_op = RP_Get_Real ("operating-pressure");
Thread *pt = THREAD_SUB_THREAD(t, 0); // Primary phase thread
Thread *st = THREAD_SUB_THREAD(t, 1); // Secondary phase thread
// Get the volume fraction of both phases
real vf_p = C_VOF(c, pt);
real vf_s = 1 - vf_p;
real rho_s = C_R(c, st);
//vapor_p = static_p + operating_p; // absolute pressure = static pressure + operating pressure
z=8.07131-(1730.63/((temp-273.15)+233.426));
sat_p = pow(10,z)*133; // Pressure in Pa to mmHg (Yaws 35320pa
if (vf_p == 1)
{
p_w = sat_p + p_op;
}
// If primary phase or mixture of phases
elseÂ
{
// Find the partial pressure of water vapour
// partial pressure = cell pressure * water mole fraction
// mass of primary phase in cell
real m_sec = rho_s * vol * vf_s;
// mass of water vapour and air in cell
real m_wv = C_YI(c, st, 0) * m_sec;
real m_air = m_sec - m_wv;
// No of moles in water vapour and air
real N_wv = m_wv / MOLAR_MASS_WATER;
real N_air = m_air / MOLAR_MASS_AIR;
real N_total = N_wv + N_air;
// water vapour partial pressure
p_w = (sat_p+ p_op)* (N_wv / N_total);
//Message("Pressure %f %f %f ",p_w,sat_p,(N_wv / N_total));
}
//#endif
return p_w;
}
February 16, 2022 at 1:50 pmRob
Forum ModeratorAs a general tip, set all the real definitions at the top, don't scatter them through the code. Also note that Fluent will return SI units only, so check the equations are in kmol etc. Due to some Americanisms creeping into the software a kgmol is a kmol, which can cause some confusion.
Viewing 1 reply thread- The topic ‘Problem with saturation pressure udf for mixture flow’ is closed to new replies.
Ansys Innovation SpaceTrending discussionsTop Contributors-
3572
-
1193
-
1076
-
1063
-
952
Top Rated Tags© 2025 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.
-

Ansys Assistant

Welcome to Ansys Assistant!
An AI-based virtual assistant for active Ansys Academic Customers. Please login using your university issued email address.

Hey there, you are quite inquisitive! You have hit your hourly question limit. Please retry after '10' minutes. For questions, please reach out to ansyslearn@ansys.com.
RETRY