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

Phase change UDF

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

Reply
 
LinkBack Thread Tools Display Modes
Old   November 19, 2015, 10:03
Smile Phase change UDF
  #1
New Member
 
Ram Kumar Pal
Join Date: Apr 2015
Posts: 21
Rep Power: 3
rampal is on a distinguished road
Hi friends,
I'm doing 2D simulation of "pulsating heat pipe" in fluent. For phase change I'm using UDF which is written below. When Interpreting this UDF, mass source term is not coming in "CEll zone condition" dialogue box. Can anyone help me? Please see this UDF and notify if there is any error. My UDf is:

#include "udf.h"
#include "sg_mphase.h"
#define T_SAT 308
#define LAT_HT 2418.5394e3
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.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.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.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.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;
}


I'm so confuse that what I should do. I'll be very very thankful for your valuable help.
rampal is offline   Reply With Quote

Old   December 15, 2015, 05:33
Smile 3D Case
  #2
Member
 
shahid
Join Date: Oct 2013
Posts: 88
Rep Power: 5
shahid nadeem is on a distinguished road
Did you got the results bro. And how can i change this to 3D case. Thank you

Quote:
Originally Posted by rampal View Post
Hi friends,
I'm doing 2D simulation of "pulsating heat pipe" in fluent. For phase change I'm using UDF which is written below. When Interpreting this UDF, mass source term is not coming in "CEll zone condition" dialogue box. Can anyone help me? Please see this UDF and notify if there is any error. My UDf is:

#include "udf.h"
#include "sg_mphase.h"
#define T_SAT 308
#define LAT_HT 2418.5394e3
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.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.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.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.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;
}


I'm so confuse that what I should do. I'll be very very thankful for your valuable help.
shahid nadeem is offline   Reply With Quote

Old   December 16, 2015, 00:19
Default
  #3
New Member
 
Ram Kumar Pal
Join Date: Apr 2015
Posts: 21
Rep Power: 3
rampal is on a distinguished road
I have not got any results till now, but I think there will be no change in udf for 3D case.
rampal is offline   Reply With Quote

Old   December 16, 2015, 00:33
Default
  #4
Member
 
shahid
Join Date: Oct 2013
Posts: 88
Rep Power: 5
shahid nadeem is on a distinguished road
Oh Thank you so much if i get results i ll inform you. Hope i get it

Thank you

Quote:
Originally Posted by rampal View Post
I have not got any results till now, but I think there will be no change in udf for 3D case.
shahid nadeem is offline   Reply With Quote

Old   December 16, 2015, 03:02
Default
  #5
New Member
 
Ram Kumar Pal
Join Date: Apr 2015
Posts: 21
Rep Power: 3
rampal is on a distinguished road
Thanks Brother,
I'm also doing this problem. I have read UDF manual carefully. Now I'm trying to update UDf. I'll also inform you, if there is any up-gradations in results.
Thanks
rampal is offline   Reply With Quote

Old   June 17, 2016, 08:56
Default
  #6
New Member
 
SHUJAN
Join Date: Jun 2016
Posts: 11
Rep Power: 2
MDSHUJAN is on a distinguished road
Quote:
Originally Posted by rampal View Post
Hi friends,
I'm doing 2D simulation of "pulsating heat pipe" in fluent. For phase change I'm using UDF which is written below. When Interpreting this UDF, mass source term is not coming in "CEll zone condition" dialogue box. Can anyone help me? Please see this UDF and notify if there is any error. My UDf is:

#include "udf.h"
#include "sg_mphase.h"
#define T_SAT 308
#define LAT_HT 2418.5394e3
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.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.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.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.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;
}


I'm so confuse that what I should do. I'll be very very thankful for your valuable help.





Hi. Did you make your udf work, and did you get condensation? Can you share your final udf wih me ?
MDSHUJAN is offline   Reply With Quote

Reply

Tags
mass transfer, phase change udf, pulsating heat pipe.

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
WILLING TO PAY/ FREELANCER REQUIRED / small UDF coding force loads over body / 6DOF acasas CFD Freelancers 1 January 23, 2015 08:26
I want to Change Values in Existing UDF to Match my Model mamkol Fluent UDF and Scheme Programming 1 April 26, 2013 02:57
phase change modeling Danial Q Main CFD Forum 0 April 5, 2012 01:14
Two phase flow with phase change Ahmad Al-Zoubi CFX 1 November 26, 2008 04:59
How to model the solid-fluid phase change in CFX ohrmond CFX 2 May 26, 2006 06:27


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