CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Specific Heat macro for eulerian multiphase flow (https://www.cfd-online.com/Forums/fluent-udf/240917-specific-heat-macro-eulerian-multiphase-flow.html)

CMIUCBS January 31, 2022 16:11

Specific Heat macro for eulerian multiphase flow
 
1 Attachment(s)
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:


https://www.cfd-online.com/Forums/at...1&d=1643663246



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?

AlexanderZ February 2, 2022 19:53

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 February 3, 2022 08:45

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?

Marmalade June 17, 2022 03:20

Quote:

Originally Posted by CMIUCBS (Post 821295)
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:


https://www.cfd-online.com/Forums/at...1&d=1643663246



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 June 17, 2022 11:25

Hi. Thanks for the reply. Could you elaborate on what did I do wrong here and how to fix It?

Marmalade June 17, 2022 22:33

Quote:

Originally Posted by CMIUCBS (Post 830005)
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


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