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

Phase change UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 19, 2015, 10:03
Smile Phase change UDF
  #1
Member
 
Ram Kumar Pal
Join Date: Apr 2015
Posts: 38
Rep Power: 11
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
 
Nazim
Join Date: Oct 2013
Posts: 93
Rep Power: 13
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
Member
 
Ram Kumar Pal
Join Date: Apr 2015
Posts: 38
Rep Power: 11
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
 
Nazim
Join Date: Oct 2013
Posts: 93
Rep Power: 13
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
Member
 
Ram Kumar Pal
Join Date: Apr 2015
Posts: 38
Rep Power: 11
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, 09:56
Default
  #6
New Member
 
SHUJAN
Join Date: Jun 2016
Posts: 17
Rep Power: 10
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

Old   January 22, 2017, 03:10
Default
  #7
New Member
 
mehrdad
Join Date: Oct 2015
Posts: 3
Rep Power: 11
zakizadeh is on a distinguished road
Hi
I'm trying to simulate thermosyphon. But when the UDF read, and I want to run, the following error was printed!
please help



FLUENT received fatal signal (ACCESS_VIOLATION)
1. Note exact events leading to error.
2. Save case/data under new name.
3. Exit program and restart to continue.
4. Report error to your distributor.




my email: zakizadeh.ac@gmail.com
zakizadeh is offline   Reply With Quote

Old   January 28, 2017, 00:00
Default
  #8
Member
 
Ram Kumar Pal
Join Date: Apr 2015
Posts: 38
Rep Power: 11
rampal is on a distinguished road
Dear friends, currently I'm not working on this project. Perhaps my udf was working, but not coming realistic results. I want to complete this project, but unfortunately currently I'm not in research institution. This project requires commercial ANSYS software.
rampal is offline   Reply With Quote

Reply

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


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
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 03:57
phase change modeling Danial Q Main CFD Forum 0 April 5, 2012 02: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 07:27


All times are GMT -4. The time now is 00:49.