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

udf for phase change

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By jone t

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 4, 2014, 03:06
Default udf for phase change
  #1
New Member
 
jone t
Join Date: Sep 2014
Posts: 1
Rep Power: 0
jone t is on a distinguished road
I want to simulate the phase tranfer in the heat pipe, and a udf was compiled in FLUENT,which is as follow:

#include "udf.h"
#include "sg_mphase.h"
#define T_SAT 323
#define LAT_HT 2356e3
DEFINE_SOURCE(vap_src, cell, pri_th, dS, eqn)
{
Thread *mix_th, *sec_th;
real m_dot_v;
mix_th = THREAD_SUPER_THREAD(pri_th);
sec_th = THREAD_SUB_THREAD(mix_th, 1);
/*m_dot_v=0.;*/
if(C_T(cell, mix_th)>=T_SAT)
{
m_dot_v = 0.1*C_VOF(cell, sec_th)*C_R(cell, sec_th)*fabs(C_T(cell, sec_th) - T_SAT)/T_SAT;

dS[eqn] = 0.;
}

if(C_T(cell, mix_th)<=T_SAT)
{
m_dot_v = -0.1*C_VOF(cell, pri_th)*C_R(cell, pri_th)*fabs(T_SAT-C_T(cell,pri_th))/T_SAT;
dS[eqn] = -0.1*C_R(cell, pri_th)*fabs(C_T(cell, pri_th) - T_SAT)/T_SAT;
}
return m_dot_v ;
}

DEFINE_SOURCE(liq_src, cell, sec_th, dS, eqn)
{
Thread * mix_th, *pri_th;
real m_dot_l;
mix_th = THREAD_SUPER_THREAD(sec_th);
pri_th = THREAD_SUB_THREAD(mix_th, 0);
/*m_dot_l=0.;*/
if(C_T(cell, mix_th)>=T_SAT)
{
m_dot_l = -0.1*C_VOF(cell, sec_th)*C_R(cell, sec_th)*fabs(C_T(cell, sec_th) - T_SAT)/T_SAT;
dS[eqn] = -0.1*C_R(cell, sec_th)*fabs(C_T(cell, sec_th) - T_SAT)/T_SAT;
}
if(C_T(cell, mix_th)<=T_SAT)
{
m_dot_l = 0.1*C_VOF(cell, pri_th)*C_R(cell, pri_th)*fabs(T_SAT-C_T(cell,pri_th))/T_SAT;
dS[eqn] =0.;
}

return m_dot_l;
}

DEFINE_SOURCE(enrg_src, cell, mix_th, dS, eqn)
{
Thread *pri_th, *sec_th;
real m_dot;
pri_th = THREAD_SUB_THREAD(mix_th, 0);
sec_th = THREAD_SUB_THREAD(mix_th, 1);
if(C_T(cell, mix_th)>=T_SAT)
{
m_dot = -0.1*C_VOF(cell, sec_th)*C_R(cell, sec_th)*fabs(C_T(cell, sec_th) - T_SAT)/T_SAT;
dS[eqn] = -0.1*C_VOF(cell, sec_th)*C_R(cell, sec_th)*LAT_HT/T_SAT;
}

if(C_T(cell, mix_th)<=T_SAT)
{
m_dot = 0.1*C_VOF(cell, pri_th)*C_R(cell, pri_th)*fabs(T_SAT-C_T(cell,pri_th))/T_SAT;
dS[eqn] = 0.1*C_VOF(cell, pri_th)*C_R(cell, pri_th)*LAT_HT/T_SAT;
}
return LAT_HT*m_dot; }

Using the code above, I can simulate the evaporation, but the condensation did not appear, even the temperature of vapor was much lower than the saturation temperature.
Now I am so confused. Anyone can help me?
violin000 likes this.
jone t is offline   Reply With Quote

Old   January 9, 2015, 13:26
Default Udf
  #2
Member
 
Muhammed Asmail
Join Date: Nov 2009
Location: Iraq
Posts: 43
Rep Power: 17
Muhammed_iraq is on a distinguished road
Quote:
Originally Posted by jone t View Post
I want to simulate the phase tranfer in the heat pipe, and a udf was compiled in FLUENT,which is as follow:

#include "udf.h"
#include "sg_mphase.h"
#define T_SAT 323
#define LAT_HT 2356e3
DEFINE_SOURCE(vap_src, cell, pri_th, dS, eqn)
{
Thread *mix_th, *sec_th;
real m_dot_v;
mix_th = THREAD_SUPER_THREAD(pri_th);
sec_th = THREAD_SUB_THREAD(mix_th, 1);
/*m_dot_v=0.;*/
if(C_T(cell, mix_th)>=T_SAT)
{
m_dot_v = 0.1*C_VOF(cell, sec_th)*C_R(cell, sec_th)*fabs(C_T(cell, sec_th) - T_SAT)/T_SAT;

dS[eqn] = 0.;
}

if(C_T(cell, mix_th)<=T_SAT)
{
m_dot_v = -0.1*C_VOF(cell, pri_th)*C_R(cell, pri_th)*fabs(T_SAT-C_T(cell,pri_th))/T_SAT;
dS[eqn] = -0.1*C_R(cell, pri_th)*fabs(C_T(cell, pri_th) - T_SAT)/T_SAT;
}
return m_dot_v ;
}

DEFINE_SOURCE(liq_src, cell, sec_th, dS, eqn)
{
Thread * mix_th, *pri_th;
real m_dot_l;
mix_th = THREAD_SUPER_THREAD(sec_th);
pri_th = THREAD_SUB_THREAD(mix_th, 0);
/*m_dot_l=0.;*/
if(C_T(cell, mix_th)>=T_SAT)
{
m_dot_l = -0.1*C_VOF(cell, sec_th)*C_R(cell, sec_th)*fabs(C_T(cell, sec_th) - T_SAT)/T_SAT;
dS[eqn] = -0.1*C_R(cell, sec_th)*fabs(C_T(cell, sec_th) - T_SAT)/T_SAT;
}
if(C_T(cell, mix_th)<=T_SAT)
{
m_dot_l = 0.1*C_VOF(cell, pri_th)*C_R(cell, pri_th)*fabs(T_SAT-C_T(cell,pri_th))/T_SAT;
dS[eqn] =0.;
}

return m_dot_l;
}

DEFINE_SOURCE(enrg_src, cell, mix_th, dS, eqn)
{
Thread *pri_th, *sec_th;
real m_dot;
pri_th = THREAD_SUB_THREAD(mix_th, 0);
sec_th = THREAD_SUB_THREAD(mix_th, 1);
if(C_T(cell, mix_th)>=T_SAT)
{
m_dot = -0.1*C_VOF(cell, sec_th)*C_R(cell, sec_th)*fabs(C_T(cell, sec_th) - T_SAT)/T_SAT;
dS[eqn] = -0.1*C_VOF(cell, sec_th)*C_R(cell, sec_th)*LAT_HT/T_SAT;
}

if(C_T(cell, mix_th)<=T_SAT)
{
m_dot = 0.1*C_VOF(cell, pri_th)*C_R(cell, pri_th)*fabs(T_SAT-C_T(cell,pri_th))/T_SAT;
dS[eqn] = 0.1*C_VOF(cell, pri_th)*C_R(cell, pri_th)*LAT_HT/T_SAT;
}
return LAT_HT*m_dot; }

Using the code above, I can simulate the evaporation, but the condensation did not appear, even the temperature of vapor was much lower than the saturation temperature.
Now I am so confused. Anyone can help me?

Dear Jone
The latent heat at any temperature you took it?
I am also just boiling occurred but condensation no i do not know why
your simulation is good now?
Many Thanks
Muhammed_iraq is offline   Reply With Quote

Old   January 8, 2016, 02:19
Default phase change problem inside heat pipe
  #3
Member
 
Ram Kumar Pal
Join Date: Apr 2015
Posts: 38
Rep Power: 11
rampal is on a distinguished road
Dear friends, I'm doing the same problem as my project work. In my simulation condensation is also not happening in condenser zone. If anyone got results, please help me.

Thanks
rampal is offline   Reply With Quote

Old   November 1, 2016, 05:03
Default udf for phase change
  #4
New Member
 
Nitesh Kumar
Join Date: May 2016
Posts: 17
Rep Power: 10
dexter is on a distinguished road
Hi,

I'm using same udf for my simulation of evaporation in a rectangular channel. As i initialize my solution i'm getting "fatal error(segmentation fault)". I've also tried hooking udf after some iteration still getting same error. Cab anyone help?

Thnks
dexter is offline   Reply With Quote

Old   October 28, 2018, 02:39
Default
  #5
New Member
 
Dharavath Nagesh
Join Date: Jun 2018
Location: chennai
Posts: 4
Rep Power: 8
nagesh56 is on a distinguished road
Quote:
Originally Posted by dexter View Post
Hi,

I'm using same udf for my simulation of evaporation in a rectangular channel. As i initialize my solution i'm getting "fatal error(segmentation fault)". I've also tried hooking udf after some iteration still getting same error. Cab anyone help?

Thnks
are you able to simulate the problem by using this udf ,is it working fine or have you done any changes to this udf?
nagesh56 is offline   Reply With Quote

Old   October 28, 2018, 02:42
Default
  #6
New Member
 
Dharavath Nagesh
Join Date: Jun 2018
Location: chennai
Posts: 4
Rep Power: 8
nagesh56 is on a distinguished road
Quote:
Originally Posted by jone t View Post
I want to simulate the phase tranfer in the heat pipe, and a udf was compiled in FLUENT,which is as follow:

#include "udf.h"
#include "sg_mphase.h"
#define T_SAT 323
#define LAT_HT 2356e3
DEFINE_SOURCE(vap_src, cell, pri_th, dS, eqn)
{
Thread *mix_th, *sec_th;
real m_dot_v;
mix_th = THREAD_SUPER_THREAD(pri_th);
sec_th = THREAD_SUB_THREAD(mix_th, 1);
/*m_dot_v=0.;*/
if(C_T(cell, mix_th)>=T_SAT)
{
m_dot_v = 0.1*C_VOF(cell, sec_th)*C_R(cell, sec_th)*fabs(C_T(cell, sec_th) - T_SAT)/T_SAT;

dS[eqn] = 0.;
}

if(C_T(cell, mix_th)<=T_SAT)
{
m_dot_v = -0.1*C_VOF(cell, pri_th)*C_R(cell, pri_th)*fabs(T_SAT-C_T(cell,pri_th))/T_SAT;
dS[eqn] = -0.1*C_R(cell, pri_th)*fabs(C_T(cell, pri_th) - T_SAT)/T_SAT;
}
return m_dot_v ;
}

DEFINE_SOURCE(liq_src, cell, sec_th, dS, eqn)
{
Thread * mix_th, *pri_th;
real m_dot_l;
mix_th = THREAD_SUPER_THREAD(sec_th);
pri_th = THREAD_SUB_THREAD(mix_th, 0);
/*m_dot_l=0.;*/
if(C_T(cell, mix_th)>=T_SAT)
{
m_dot_l = -0.1*C_VOF(cell, sec_th)*C_R(cell, sec_th)*fabs(C_T(cell, sec_th) - T_SAT)/T_SAT;
dS[eqn] = -0.1*C_R(cell, sec_th)*fabs(C_T(cell, sec_th) - T_SAT)/T_SAT;
}
if(C_T(cell, mix_th)<=T_SAT)
{
m_dot_l = 0.1*C_VOF(cell, pri_th)*C_R(cell, pri_th)*fabs(T_SAT-C_T(cell,pri_th))/T_SAT;
dS[eqn] =0.;
}

return m_dot_l;
}

DEFINE_SOURCE(enrg_src, cell, mix_th, dS, eqn)
{
Thread *pri_th, *sec_th;
real m_dot;
pri_th = THREAD_SUB_THREAD(mix_th, 0);
sec_th = THREAD_SUB_THREAD(mix_th, 1);
if(C_T(cell, mix_th)>=T_SAT)
{
m_dot = -0.1*C_VOF(cell, sec_th)*C_R(cell, sec_th)*fabs(C_T(cell, sec_th) - T_SAT)/T_SAT;
dS[eqn] = -0.1*C_VOF(cell, sec_th)*C_R(cell, sec_th)*LAT_HT/T_SAT;
}

if(C_T(cell, mix_th)<=T_SAT)
{
m_dot = 0.1*C_VOF(cell, pri_th)*C_R(cell, pri_th)*fabs(T_SAT-C_T(cell,pri_th))/T_SAT;
dS[eqn] = 0.1*C_VOF(cell, pri_th)*C_R(cell, pri_th)*LAT_HT/T_SAT;
}
return LAT_HT*m_dot; }

Using the code above, I can simulate the evaporation, but the condensation did not appear, even the temperature of vapor was much lower than the saturation temperature.
Now I am so confused. Anyone can help me?
are you able to simulate the problem by using this udf ,is it working fine or have you done any changes to this udf?
nagesh56 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
UDF Cmu change selçuk ataş FLUENT 2 July 19, 2017 13:24
I want to write a UDF for atmospheric boundry layer profile mamkol Fluent UDF and Scheme Programming 0 April 12, 2013 12:55
UDF to change Rotation Speed in a MRF simulation Mike FLUENT 3 September 27, 2011 07:46
UDF to change BC from Wall to Grid Line Aaron Smith FLUENT 0 February 21, 2006 10:14
Change Courant number from UDF HS FLUENT 0 December 1, 2005 06:16


All times are GMT -4. The time now is 13:51.