CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Error running UDF for water evaporation-condensation problem

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

LinkBack Thread Tools Search this Thread Display Modes
Old   July 5, 2023, 23:28
Default Error running UDF for water evaporation-condensation problem
New Member
Join Date: Jan 2017
Posts: 23
Rep Power: 9
mataus is on a distinguished road
I am encountering an error while trying to run a UDF in ANSYS Fluent for a water evaporation-condensation problem. The purpose of the UDF is to calculate the saturation pressure. In my simulation, phase 1 represents water in the liquid state, while the other phase represents a mixture of air and water vapor.

I have successfully compiled the UDF code without any errors or warnings. Additionally, I have assigned the saturation temperature in the "Saturation" tab within the "Evaporation-Condensation" settings. However, when I attempt to perform the initialization step, I encounter the following error:

Node 0: Process 28764: Received signal SIGSEGV.
The fl process could not be started.

Based on my understanding of the problem, I believe that the error might be occurring within the "mixture_species_loop" of my UDF. Interestingly, everything seems to work fine before this part. I would greatly appreciate any insights or suggestions regarding the possible reasons behind this error.

#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_temp,c,t) /* t: mixture thread, c: cell variable, Cell volume*/

real vol = C_VOLUME(c, t);

Thread *pt = THREAD_SUB_THREAD(t, 0); /* Primary phase thread-water*/
Thread *st = THREAD_SUB_THREAD(t, 1); /* Secondary phase thread-air-vapour mixture template*/

real vf_s = C_VOF(c, st); /* Get the volume fraction of secondary phases*/
real vf_p = 1 - vf_s; /* Get the volume fraction of primary phases*/

real p_mix = C_P(c, t); /* Get the pressure of the mixture */
real p_op = RP_Get_Real("operating-pressure"); /* Get the operating pressure*/
real rho_p = C_R(c, pt); /* Primary phase density*/

/* Get mass fractions in primary phase*/
real mf[2]; /*to store mass fractions*/
Material *m = THREAD_MATERIAL(pt);
Material *sp = NULL;
int i; /* Species index - 0 for water vapor and 1 for air+vapour*/
mixture_species_loop(m, sp, i)
mf[i] = C_YI(c, pt, i);
real p_w; /* Water vapor pressure for the cell*/
if (vf_s == 1) /* If secondary phase only*/
p_w = p_mix + p_op;
else /* If primary phase or mixture of phases*/
/* Find the partial pressure of water vapour, partial pressure = cell pressure * water mole fraction*/
real m_prim = rho_p * vol * vf_p; /* mass of primary phase in cell*/
real m_wv = mf[0] * m_prim; /* mass of water vapour in cell*/
real m_air = m_prim - m_wv; /* mass of air in cell*/
real N_wv = m_wv / MOLAR_MASS_WATER; /* No of moles in water vapour*/
real N_air = m_air / MOLAR_MASS_AIR; /* No of moles in air*/
real N_total = N_wv + N_air; /* total moles*/
p_w = (C_P(c, t)+ p_op)* (N_wv / N_total); /* water vapour partial pressure*/
real t_sat;
t_sat = (1730.63 / (10.196 - log10(p_w))) + 39.724; /* Calculate saturation temperature*/
return t_sat;
mataus is offline   Reply With Quote


evaporation condensation, mixture model., multiphase, saturation temeprature

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
Mixture Model with Condensation and Evaporation on Vertical Wall gartz89 FLUENT 3 March 20, 2020 09:16
SU2-7.0.1 on ubuntu 18.04 hyunko SU2 Installation 7 March 16, 2020 04:37
Problem condensation/ evaporation (condensate water vapor) bigfoot47 FLUENT 0 October 21, 2019 08:07
UDF compiling problem Wouter Fluent UDF and Scheme Programming 6 June 6, 2012 04:43
parallel UDF problem kerem FLUENT 2 June 20, 2006 06:56

All times are GMT -4. The time now is 05:09.