CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   How to simulate the process of water evaporation by UDF? (https://www.cfd-online.com/Forums/fluent-udf/70704-how-simulate-process-water-evaporation-udf.html)

 qiyang860908 December 2, 2009 21:31

How to simulate the process of water evaporation by UDF?

Here is a UDF program I wrote in order to realize the process of water evaporation in Fluent.The water evaporation occurs as a result of the decrease of pressure in stead of temperature increasement.So,the program is based on the pressure driven theory.A low pressure boundary is also used to develop a low pressure region nearby.
However,when it was hooked to the fluent solver ,it wound't work.
Can you help me ?
#include "udf.h" /*包括常规宏*/
#include "sg_mphase.h" /*包括体积分数宏*/
#define LAT_HT 2260 /*定义水蒸汽潜热*/
#define pi 3.1415 /*圆周率常数*/
#define R 8.314 /*gas constant 8.314j/mol.K*/
#define moleweight 0.018 /*SI unit water mole weight 0.018kg/mol */
#define A 7.19621
#define B 1730.63
#define C 233.426
DEFINE_SOURCE(liq_src, cell, pri_th, dS, eqn) /*定义液相源项*/
{
real m_dot_l; /*蒸发冷凝速率 定义液相质量转移*/
real P_SAT ;
P_SAT=exp(A-B/(C_T(cell,pri_th)+C-273.15))*1e3; /*定义饱和蒸汽压与液相温度的关系式，即antoine公式*/
if(C_P(cell, mix_th)< P_SAT)
{m_dot_l = -(P_SAT-C_P(cell,sec_th))*sqrt(moleweight)*(2*pi*R*C_T(cel l,pri_th)); /*定义液相向气相转移的速率，如果气相 的压力小于一定温度下的饱和蒸汽压，液 相向气相发生质量转移*/
dS[eqn]= sqrt(moleweight)*(2*pi*R*C_T(cell,pri_th)); /*定义源项对质量转移偏导，fabs为取绝对值*/
}
else
{m_dot_l = (P_SAT-C_P(cell,sec_th))*sqrt(moleweight)*(2*pi*R*C_T(cel l,pri_th)); /*定义液相向气相转移的速率，如果气 相压力大于一定温度下的饱和蒸汽压，气 相向液相发生质量转移*/
dS[eqn] = 0; /*由于气相向液相转移，所以液相的质量源项对质量转移的偏导为零*/
}
return m_dot_l;
}
DEFINE_SOURCE(vap_src, cell, sec_th, dS, eqn)
{
real m_dot_v;
real P_SAT ;
P_SAT=exp(A-B/(C_T(cell,pri_th)+C-273.15))*1e3;
if(C_P(cell, mix_th)< P_SAT)
{
m_dot_v = (P_SAT-C_P(cell,sec_th))*sqrt(moleweight)*(2*pi*R*C_T(cel l,pri_th));
dS[eqn] =0;
}
else
{m_dot_v = -(P_SAT-C_P(cell,sec_th))*sqrt(moleweight)*(2*pi*R*C_T(cel l,pri_th));
dS[eqn]=sqrt(moleweight)*(2*pi*R*C_T(cell,pri_th));
}
return m_dot_v;
}
DEFINE_SOURCE(enrg_src, cell, mix_th, dS, eqn)
{
real m_dot;
real P_SAT;
P_SAT=exp(A-B/(C_T(cell,pri_th)+C-273.15))*1e3;
if(C_P(cell, mix_th)< P_SAT)
{
m_dot =- (P_SAT-C_P(cell,sec_th))*sqrt(moleweight)*(2*pi*R*C_T(cel l,pri_th));
dS[eqn]=sqrt(moleweight)*(2*pi*R*C_T(cell,pri_th));
}
else
{
m_dot = (P_SAT-C_P(cell,sec_th))*sqrt(moleweight)*(2*pi*R*C_T(cel l,pri_th));
dS[eqn]=-sqrt(moleweight)*(2*pi*R*C_T(cell,pri_th));
}
return LAT_HT*m_dot;
}
DEFINE_PROFILE(pressure_out,t,i)
{real x[ND_ND];
real y;
face_t f;
begin_f_loop(f,t)
{F_CENTROID(x,f,t);
y=x[1];
F_PROFILE(f,t,i)=0.5e5;
}
end_f_loop(f,t)
}

 beauty April 1, 2010 09:10

Hi!
I'm learning on the problem as yours, do you have any experience to share? Thanks!

 beauty April 1, 2010 09:11

Hi!
Have your problem solved? I'm interesting in the problem of evaporation as yours. After reading your programme, I have a question about the formula(m_dot_l = -(P_SAT-C_P(cell,sec_th))*sqrt(moleweight)*(2*pi*R*C_T(cel l,pri_th));), which literature include this?

Thanks!

 Robert@cfd April 5, 2010 04:45

Hi
Why not using the cavitation-models, already included in FLUENT? You can use Singhal, Schnerr-Sauer and Zwart-Gerber-Belamri there.

Greetings

 beauty April 6, 2010 07:41

Quote:
 Originally Posted by Robert@cfd (Post 253164) Hi Why not using the cavitation-models, already included in FLUENT? You can use Singhal, Schnerr-Sauer and Zwart-Gerber-Belamri there. Greetings
Hi
Thank you for your suggestion. In my opinion, the mechanism of evaporation in the cavitation is different from flash evaporation. Maybe I am wrong, I will learn about the cavitation-models. Are you familiar with cavitation?

beauty

 Robert@cfd April 6, 2010 08:31

Hi
What is 'flash evaporation' ? You mean temperature-driven evaporation?

Quote:
 The water evaporation occurs as a result of the decrease of pressure in stead of temperature increasement.
In my opinion, thats the definition of cavitation, so you should take a closer look to the models.
If the pressure falls under a critical value, evaporation occurs. If the pressure is increasing downstream, the bubbles collapse (condensation) and locally you get really big values of temperature and pressure (its like an implosion).

Just look over the FLUENT user-guide or ask me again. Maybe I can help.

Greetings

 beauty April 7, 2010 22:38

Hi
Flash evaporation is pressure-driven evaporation. When the saturated liquid (for example, liquid Hydrogen under high pressure) is released into atmosphere, most or all of the liquid immediately "flashes" into vapor, resulting in decrease of the system temperature. I wonder if the cavitation model can be helpful.
Thanks
Beauty

 Rana August 25, 2010 02:49

evaporation

qiyang

Is your's a constant temperature or varying temperature model, i need to write a udf for evaporation ocuring by means of decreasing pressure which in turn decreases the temperature.

can u help me...

 maysmech March 6, 2011 02:48

Quote:
 Originally Posted by Rana (Post 272616) qiyang Is your's a constant temperature or varying temperature model, i need to write a udf for evaporation ocuring by means of decreasing pressure which in turn decreases the temperature. can u help me...
Hi,
Same question.
Any idea?

 maysmech March 6, 2011 02:58

Quote:
It has error: cell undefined in line 19
?

 Muhammed_iraq January 9, 2015 14:59

Udf

Quote: