# How to simulate the process of water evaporation by UDF?

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 LinkBack Thread Tools Search this Thread Display Modes
 December 2, 2009, 20:31 How to simulate the process of water evaporation by UDF? #1 New Member   qiyang Join Date: Nov 2009 Posts: 3 Rep Power: 15 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) }

 April 1, 2010, 09:10 #2 New Member   beauty Join Date: Feb 2010 Posts: 27 Blog Entries: 1 Rep Power: 15 Hi! I'm learning on the problem as yours, do you have any experience to share? Thanks!

 April 1, 2010, 09:11 formula about evaporation! #3 New Member   beauty Join Date: Feb 2010 Posts: 27 Blog Entries: 1 Rep Power: 15 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!

 April 5, 2010, 04:45 #4 Member   Robert Join Date: Feb 2010 Location: Germany Posts: 32 Rep Power: 15 Hi Why not using the cavitation-models, already included in FLUENT? You can use Singhal, Schnerr-Sauer and Zwart-Gerber-Belamri there. Greetings

April 6, 2010, 07:41
#5
New Member

beauty
Join Date: Feb 2010
Posts: 27
Blog Entries: 1
Rep Power: 15
Quote:
 Originally Posted by Robert@cfd 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

April 6, 2010, 08:31
#6
Member

Robert
Join Date: Feb 2010
Location: Germany
Posts: 32
Rep Power: 15
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

 April 7, 2010, 22:38 #7 New Member   beauty Join Date: Feb 2010 Posts: 27 Blog Entries: 1 Rep Power: 15 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

 August 25, 2010, 02:49 evaporation #8 New Member   Rana Join Date: Apr 2010 Posts: 10 Rep Power: 15 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...

March 6, 2011, 01:48
#9
Senior Member

Join Date: Jan 2010
Posts: 347
Blog Entries: 2
Rep Power: 16
Quote:
 Originally Posted by Rana 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?

March 6, 2011, 01:58
#10
Senior Member

Join Date: Jan 2010
Posts: 347
Blog Entries: 2
Rep Power: 16
Quote:
 Originally Posted by qiyang860908 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
?

January 9, 2015, 13:59
Udf
#11
Member

Muhammed Asmail
Join Date: Nov 2009
Location: Iraq
Posts: 43
Rep Power: 15
Quote:
 Originally Posted by qiyang860908 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

 Thread Tools Search this Thread Search this Thread: Advanced Search Display Modes Linear Mode

 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 OffTrackbacks are Off Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Arpit FLUENT 2 September 10, 2007 10:04 Linjie CFX 6 May 24, 2007 14:55 arwang FLUENT 0 March 12, 2007 07:07 Cong Phung Chi CFX 2 April 12, 2006 23:34 Wei-zhi Liao Main CFD Forum 0 February 13, 2006 03:06

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

 Contact Us - CFD Online - Privacy Statement - Top