CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Mass transfer with varying saturation temperature (https://www.cfd-online.com/Forums/fluent-udf/134293-mass-transfer-varying-saturation-temperature.html)

Lukeimpervius April 27, 2014 13:19

Mass transfer with varying saturation temperature
 
Dear all,

I am a quite new user in fluent, and I am trying to write a UDF to implement the mass transfer in a evaporation-multiphase problem.

The problem is that the saturation temperature varies according to the vapor fraction of one species in the liquid phase. I have a polynomial interpolation of this variation and I would like to write T_SAT in function of that specie's vapor fraction C_VOF.


I am trying to write a UDF without much success for now. Is there anyone who could give me some suggestions, or find possible errors?

I am using mixture model.
Here is the UDF (based on the linearized mass transfer tutorial example of the udf manual), without the polynomial interpolation due to its length. I have substituted dummy values instead.

#include "udf.h"
DEFINE_LINEARIZED_MASS_TRANSFER(cav_source,cell,th read,from_index,from_species_index, to_index, to_species_index, d_mdot_d_vof_from, d_mdot_d_vof_to)

{ real m_lg;

Thread *gas = THREAD_SUB_THREAD(thread, from_index);
Thread *liq = THREAD_SUB_THREAD(thread, to_index);
real T_SAT;
m_lg = 0.;

if(C_VOF(cell,liq)<0.1)
{
T_SAT=373.15*C_VOF(cell,liq)^2+300*C_VOF(cell,liq) +100;
}
else
{
T_SAT=450.;
}

if (C_T(cell, liq) >= T_SAT)
{
m_lg = -0.1*C_VOF(cell,liq)*C_R(cell,liq)*
fabs(C_T(cell,liq)-T_SAT)/T_SAT;
}
if ((m_lg == 0. ) && (C_T(cell, gas) <= T_SAT))
{
m_lg = 0.1*C_VOF(cell,gas)*C_R(cell,gas)*
fabs(T_SAT-C_T(cell,gas))/T_SAT;
}
return (m_lg);
}

Any help is appreciated!

Thanks in advance!


All times are GMT -4. The time now is 17:25.