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

How to simulate the process of water evaporation by UDF?

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

Reply
 
LinkBack Thread Tools Display Modes
Old   December 2, 2009, 21:31
Default How to simulate the process of water evaporation by UDF?
  #1
New Member
 
qiyang
Join Date: Nov 2009
Posts: 3
Rep Power: 7
qiyang860908 is on a distinguished road
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) /*定义液相源项*/
{
Thread *mix_th, *sec_th; /*混合相、第二相 定义计算区域指针*/
real m_dot_l; /*蒸发冷凝速率 定义液相质量转移*/
real P_SAT ;
mix_th = THREAD_SUPER_THREAD(pri_th); /*指向混合区的主相即液相的指针*/
sec_th = THREAD_SUB_THREAD(mix_th, 1); /* 指向单相控制区的气相的指针*/
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)
{
Thread *mix_th, *pri_th;
real m_dot_v;
real P_SAT ;
mix_th = THREAD_SUPER_THREAD(sec_th);
pri_th = THREAD_SUB_THREAD(mix_th, 0);
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)
{
Thread *pri_th,*sec_th;
real m_dot;
real P_SAT;
pri_th=THREAD_SUB_THREAD(mix_th,0);
sec_th=THREAD_SUB_THREAD(mix_th,1);
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)
}
qiyang860908 is offline   Reply With Quote

Old   April 1, 2010, 09:10
Default
  #2
New Member
 
beauty
Join Date: Feb 2010
Posts: 27
Blog Entries: 1
Rep Power: 7
beauty is on a distinguished road
Hi!
I'm learning on the problem as yours, do you have any experience to share? Thanks!
beauty is offline   Reply With Quote

Old   April 1, 2010, 09:11
Default formula about evaporation!
  #3
New Member
 
beauty
Join Date: Feb 2010
Posts: 27
Blog Entries: 1
Rep Power: 7
beauty is on a distinguished road
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?

Looking forward to your reply!
Thanks!
beauty is offline   Reply With Quote

Old   April 5, 2010, 04:45
Default
  #4
Member
 
Robert
Join Date: Feb 2010
Location: Germany
Posts: 31
Rep Power: 7
Robert@cfd is on a distinguished road
Hi
Why not using the cavitation-models, already included in FLUENT? You can use Singhal, Schnerr-Sauer and Zwart-Gerber-Belamri there.

Greetings
Robert@cfd is offline   Reply With Quote

Old   April 6, 2010, 07:41
Default
  #5
New Member
 
beauty
Join Date: Feb 2010
Posts: 27
Blog Entries: 1
Rep Power: 7
beauty is on a distinguished road
Quote:
Originally Posted by Robert@cfd View Post
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
beauty is offline   Reply With Quote

Old   April 6, 2010, 08:31
Default
  #6
Member
 
Robert
Join Date: Feb 2010
Location: Germany
Posts: 31
Rep Power: 7
Robert@cfd is on a distinguished road
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
Robert@cfd is offline   Reply With Quote

Old   April 7, 2010, 22:38
Default
  #7
New Member
 
beauty
Join Date: Feb 2010
Posts: 27
Blog Entries: 1
Rep Power: 7
beauty is on a distinguished road
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
beauty is offline   Reply With Quote

Old   August 25, 2010, 02:49
Question evaporation
  #8
New Member
 
Rana
Join Date: Apr 2010
Posts: 10
Rep Power: 7
Rana is on a distinguished road
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...
Rana is offline   Reply With Quote

Old   March 6, 2011, 02:48
Question
  #9
Senior Member
 
maysmech's Avatar
 
Join Date: Jan 2010
Posts: 347
Blog Entries: 2
Rep Power: 8
maysmech is on a distinguished road
Quote:
Originally Posted by Rana View Post
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 is offline   Reply With Quote

Old   March 6, 2011, 02:58
Default
  #10
Senior Member
 
maysmech's Avatar
 
Join Date: Jan 2010
Posts: 347
Blog Entries: 2
Rep Power: 8
maysmech is on a distinguished road
Quote:
Originally Posted by qiyang860908 View Post
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) /*定义液相源项*/
{
Thread *mix_th, *sec_th; /*混合相、第二相 定义计算区域指针*/
real m_dot_l; /*蒸发冷凝速率 定义液相质量转移*/
real P_SAT ;
mix_th = THREAD_SUPER_THREAD(pri_th); /*指向混合区的主相即液相的指针*/
sec_th = THREAD_SUB_THREAD(mix_th, 1); /* 指向单相控制区的气相的指针*/
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)
{
Thread *mix_th, *pri_th;
real m_dot_v;
real P_SAT ;
mix_th = THREAD_SUPER_THREAD(sec_th);
pri_th = THREAD_SUB_THREAD(mix_th, 0);
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)
{
Thread *pri_th,*sec_th;
real m_dot;
real P_SAT;
pri_th=THREAD_SUB_THREAD(mix_th,0);
sec_th=THREAD_SUB_THREAD(mix_th,1);
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)
}
It has error: cell undefined in line 19
?
maysmech is offline   Reply With Quote

Old   January 9, 2015, 14:59
Default Udf
  #11
Member
 
Muhammed Asmail
Join Date: Nov 2009
Location: Iraq
Posts: 36
Rep Power: 7
Muhammed_iraq is on a distinguished road
Quote:
Originally Posted by qiyang860908 View Post
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) /*定义液相源项*/
{
Thread *mix_th, *sec_th; /*混合相、第二相 定义计算区域指针*/
real m_dot_l; /*蒸发冷凝速率 定义液相质量转移*/
real P_SAT ;
mix_th = THREAD_SUPER_THREAD(pri_th); /*指向混合区的主相即液相的指针*/
sec_th = THREAD_SUB_THREAD(mix_th, 1); /* 指向单相控制区的气相的指针*/
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)
{
Thread *mix_th, *pri_th;
real m_dot_v;
real P_SAT ;
mix_th = THREAD_SUPER_THREAD(sec_th);
pri_th = THREAD_SUB_THREAD(mix_th, 0);
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)
{
Thread *pri_th,*sec_th;
real m_dot;
real P_SAT;
pri_th=THREAD_SUB_THREAD(mix_th,0);
sec_th=THREAD_SUB_THREAD(mix_th,1);
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)
}
Please qiyang860908
did you reach to best solution?
Please I need UDF
Muhammed_iraq is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Water Evaporation and condensation modeling Linjie CFX 8 April 23, 2015 18:30
Evaporation of water... help needed!! Arpit FLUENT 2 September 10, 2007 10:04
How to simulate the water hammer pressure. arwang FLUENT 0 March 12, 2007 08:07
How to use CFX to simulate sand casting process ? Cong Phung Chi CFX 2 April 12, 2006 23:34
Use smoke density to simulate water Wei-zhi Liao Main CFD Forum 0 February 13, 2006 04:06


All times are GMT -4. The time now is 23:52.