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

UDF Condensation

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 2, 2017, 03:43
Default UDF Condensation
  #1
New Member
 
Sebastian
Join Date: Apr 2017
Posts: 2
Rep Power: 0
PaRa is on a distinguished road
Hi,
IŽd like to calculate the phase change mass transfer of condensating water vapor using a UDF.
The UDF is compiled and loaded without error, but it doesnt seem to work properly.
When i print the calculated saturation temperature its only returning the value "-109.8".
I think there is something wrong with the way I try to get the relative humidity.
Any ideas, how i have to change the UDF, or maybe another aproach i could try?

Thanks in advance!
Quote:
#include "udf.h"
#include "math.h"


/* Humidity */
real H2O_Saturation_Pressure(real T)
{
real pot;
real psat;
pot = exp((17.62*(T-273.15))/(243.12+(T-273.15))); /* T in °C */
psat = 611.2 * pot;
return psat;
}

real myHumidity(cell_t c, Thread *t)
{
int i;
Material *m = THREAD_MATERIAL(t), *sp;
real yi_h2o = 0; /* water mass fraction */
real r_mix = 0.0; /* sum of [mass fraction / mol. weight] over all species */
int h2o_index = 0;
real mw_h2o = 18.01534;
real humidity;

if ((MATERIAL_TYPE(m) == MATERIAL_MIXTURE) && (FLUID_THREAD_P(t)))
{
yi_h2o = C_YI(c, t, h2o_index); /* water vapor mass fraction */
mixture_species_loop(m, sp, i)
{
r_mix += C_YI(c,t,i) / MATERIAL_PROP(sp, PROP_mwi);
}

humidity = op_pres * yi_h2o / (mw_h2o * r_mix) / H2O_Saturation_Pressure(C_T(c,t));
return humidity;
}
else
return 0.;

}

DEFINE_MASS_TRANSFER(cond, c, t, from_index, from_species_index, to_index, to_species_index)
{


/* T_SAT & Masstranser */

real m_lg;
real T_SAT;
Thread *vap;
Thread *liq;
vap = THREAD_SUB_THREAD(t, from_index);
liq = THREAD_SUB_THREAD(t, to_index);
m_lg = 0.0;

T_SAT = pow(relative_humidity(c,t), 0.124688279)*(109.8+C_T(c,t))-109.8;
if (C_T(c, liq) > T_SAT)
{ /* Evaporating */
m_lg = -0.1*C_VOF(c,liq)*C_R(c,liq)*(C_T(c,liq)-T_SAT)/T_SAT;
}

else if (C_T(c,vap) < T_SAT)
{ /* Condensing */
m_lg = 0.1*C_VOF(c,vap)*C_R(c,vap)*(T_SAT-C_T(c,vap))/T_SAT;
}
Message("T_SAT: %g\n",T_SAT);

return (m_lg);

}
PaRa 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
Facing issue in UDF initialization used for steam distribution & condensation. shan12 Fluent UDF and Scheme Programming 0 July 27, 2016 00:54
UDF code for condensation Dae Whan Kim Fluent UDF and Scheme Programming 3 May 8, 2012 23:17
udf for boiling and condensation brusly FLUENT 0 November 22, 2006 23:17
udf for boiling and condensation brusly FLUENT 0 November 20, 2006 02:10
UDF condensation two gases Thaony A. FLUENT 0 July 1, 2004 15:04


All times are GMT -4. The time now is 21:49.