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

Specific Heat macro for eulerian multiphase flow

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By AlexanderZ
  • 1 Post By Marmalade

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 31, 2022, 17:11
Default Specific Heat macro for eulerian multiphase flow
  #1
New Member
 
Babak
Join Date: Oct 2021
Posts: 12
Rep Power: 5
CMIUCBS is on a distinguished road
Hi I'm having problem writing a temperature dependent specific heat macro for my eulerian two phase boiling flow simulation.

I want to get the primary phase temperature from the cell and use it in the code but having problem to do so; I already did the other properties like density using DEFINE PROPERTY macro but since specific heat is kinda different I'm getting odd answers.
So here is my code and I narrow the problem down to the bold words:




DEFINE_SPECIFIC_HEAT(specficheat,T, Tref, h, yi)
{
real cpf;

Domain *mixture_domain = Get_Domain(1);
Thread *mixture_thread = Lookup_Thread(mixture_domain,8);
Thread *t_wa = THREAD_SUB_THREAD(mixture_thread,0);
Thread *t_va = THREAD_SUB_THREAD(mixture_thread,1);

cell_t c;

real Tw = C_T(c,t_wa);



cpf=(((5067-4494)/70)*(Tw-473.15)+4494);


*h = cpf*(T-Tref);
return cpf;
}



In above code, Tw is the Primary phase temp (in this case water) and when i use this code my Cp distribution is like this:






and when I change the code to:



DEFINE_SPECIFIC_HEAT(specficheat,T, Tref, h, yi)
{
real cpf;

Domain *mixture_domain = Get_Domain(1);
Thread *mixture_thread = Lookup_Thread(mixture_domain,8);
Thread *t_wa = THREAD_SUB_THREAD(mixture_thread,0);
Thread *t_va = THREAD_SUB_THREAD(mixture_thread,1);

cell_t c;



cpf=(((5067-4494)/70)*(T-473.15)+4494);



*h = cpf*(T-Tref);
return cpf;
}


the Cp distribution is ok but since it's based on wrong temp data, it's leading to wrong results because of using cell temp instead of phase temp.

Can someone help me with this? how can i write a specific heat macro for multiphase flows? what do i do wrong?
Attached Images
File Type: bmp New Bitmap Image - Copy.bmp (138.5 KB, 41 views)
CMIUCBS is offline   Reply With Quote

Old   February 2, 2022, 20:53
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
as far as I know, unfortunately there is no way to get cell/thread information inside DEFINE_SPECIFIC_HEAT macro
it means, you are not able to differentiate temperatures according to phases

I've heard the way our is to use real gas model
CMIUCBS likes this.
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   February 3, 2022, 09:45
Default
  #3
New Member
 
Babak
Join Date: Oct 2021
Posts: 12
Rep Power: 5
CMIUCBS is on a distinguished road
Thanks for your helpful response.

I actually want to simulate nanofluid boiling flow and I need to define the nanofluid phase property based on cell information properties; so by any chance do you know any other way to do a simulation like this or have any advice for me to do this type of simulation?
CMIUCBS is offline   Reply With Quote

Old   June 17, 2022, 04:20
Default
  #4
New Member
 
Ying Feng
Join Date: May 2022
Location: China
Posts: 6
Rep Power: 4
Marmalade is on a distinguished road
Quote:
Originally Posted by CMIUCBS View Post
Hi I'm having problem writing a temperature dependent specific heat macro for my eulerian two phase boiling flow simulation.

I want to get the primary phase temperature from the cell and use it in the code but having problem to do so; I already did the other properties like density using DEFINE PROPERTY macro but since specific heat is kinda different I'm getting odd answers.
So here is my code and I narrow the problem down to the bold words:




DEFINE_SPECIFIC_HEAT(specficheat,T, Tref, h, yi)
{
real cpf;

Domain *mixture_domain = Get_Domain(1);
Thread *mixture_thread = Lookup_Thread(mixture_domain,8);
Thread *t_wa = THREAD_SUB_THREAD(mixture_thread,0);
Thread *t_va = THREAD_SUB_THREAD(mixture_thread,1);

cell_t c;

real Tw = C_T(c,t_wa);



cpf=(((5067-4494)/70)*(Tw-473.15)+4494);


*h = cpf*(T-Tref);
return cpf;
}



In above code, Tw is the Primary phase temp (in this case water) and when i use this code my Cp distribution is like this:






and when I change the code to:



DEFINE_SPECIFIC_HEAT(specficheat,T, Tref, h, yi)
{
real cpf;

Domain *mixture_domain = Get_Domain(1);
Thread *mixture_thread = Lookup_Thread(mixture_domain,8);
Thread *t_wa = THREAD_SUB_THREAD(mixture_thread,0);
Thread *t_va = THREAD_SUB_THREAD(mixture_thread,1);

cell_t c;



cpf=(((5067-4494)/70)*(T-473.15)+4494);



*h = cpf*(T-Tref);
return cpf;
}


the Cp distribution is ok but since it's based on wrong temp data, it's leading to wrong results because of using cell temp instead of phase temp.

Can someone help me with this? how can i write a specific heat macro for multiphase flows? what do i do wrong?
Hi~i find a problem in this UDF, in which the term of enthalpy is wrong. Enthalpy is a term that requires integrating the temperature with the heat capacity. Although this item may has little impact on the results, we should pay attention to this problem.
CMIUCBS likes this.
Marmalade is offline   Reply With Quote

Old   June 17, 2022, 12:25
Default
  #5
New Member
 
Babak
Join Date: Oct 2021
Posts: 12
Rep Power: 5
CMIUCBS is on a distinguished road
Hi. Thanks for the reply. Could you elaborate on what did I do wrong here and how to fix It?
CMIUCBS is offline   Reply With Quote

Old   June 17, 2022, 23:33
Default
  #6
New Member
 
Ying Feng
Join Date: May 2022
Location: China
Posts: 6
Rep Power: 4
Marmalade is on a distinguished road
Quote:
Originally Posted by CMIUCBS View Post
Hi. Thanks for the reply. Could you elaborate on what did I do wrong here and how to fix It?
Hi!CMIUCBS,
I write the UDF accroding to the help documentation, i am not sure it is right.
DEFINE_SPECIFIC_HEAT(specficheat,T, Tref, h, yi)
{
real cpf;
cpf=((5067-4494)/70)*(T-473.15)+4494;
*h = 8.18571*(T^2/2+75.8552*T)-8.18571*(Tref^2/2+75.8552*Tref);
return cpf;
}
in the above content, the enthalpy is obtained by integrating the Cp.
integral(1/70 (5067 - 4494) (T - 473.15) + 4494) dT = 8.18571 (T^2/2 + 75.8552 T) + constant
Marmalade is offline   Reply With Quote

Reply

Tags
multiphase flow, multiphase udf, specific heat, udf


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
Fluent Heat exchanger model gimson FLUENT 0 May 10, 2021 05:30
Simple piston movement in cylinder- fluid models arun1994 CFX 4 July 8, 2016 03:54
Constant velocity of the material Sas CFX 15 July 13, 2010 09:56
Natural convection - Inlet boundary condition max91 CFX 1 July 29, 2008 21:28
Convective Heat Transfer - Heat Exchanger Mark CFX 6 November 15, 2004 16:55


All times are GMT -4. The time now is 15:20.