CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Temperature calculation from sensible internal energy

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By zhangyan

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 12, 2019, 06:42
Default Temperature calculation from sensible internal energy
  #1
New Member
 
Matteo
Join Date: Jan 2019
Posts: 4
Rep Power: 7
Zanco is on a distinguished road
Hi guys. I'm writing a code using the NACA0012 airfoil tutorial for rhoSimpleFoam compressible solver as a guide.

Actually I'm not able to figure out how the temperature is calculated. I mean, If I'm right everything should be done inside the hePsiThermo.C and thermoI.H files where thermo.correct() and calculate() functions are defined.

Temperature calculation is coded this way:
Code:
Test = Tnew;
        Tnew =
            (this->*limit)
            (Test - ((this->*F)(p, Test) - f)/(this->*dFdT)(p, Test));
I cannot understand what the f stands for. To me this procedure looks like a Newton algorithm.

Inside the thermophysicalProperties these are the selected parameters:
Code:
thermoType
{
    type              hePsiThermo;
    mixture         pureMixture;
    transport       const;
    thermo          hConst; 
    equationOfState perfectGas; 
    specie            specie;
    energy           sensibleInternalEnergy; 
}
hConst means Cp = const. sensibleInternalEnergy means I have to use the TEs. Thus f = es and F = Es where
Code:
template<class Thermo, template<class> class Type>
inline Foam::scalar
Foam::species::thermo<Thermo, Type>::Es(const scalar p, const scalar T) const
{
    return this->Hs(p, T) - p/this->rho(p, T);
}
and
Code:
template<class Thermo, template<class> class Type>
inline Foam::scalar
Foam::species::thermo<Thermo, Type>::es(const scalar p, const scalar T) const
{
    return this->Es(p, T)*this->W();
}
So Es should be the internal energy that is defined as enthalpy minus pressure over density while es (read f) is defined as Es times molecular weight.

Does anyone of you know what it stands for and why it should be there? I cannot understand exactly which is the whole functional I have to use inside the Newton iterations.

Thanks a lot to anyone who can help me.
Zanco is offline   Reply With Quote

Old   April 12, 2019, 15:48
Default
  #2
Senior Member
 
Join Date: Aug 2015
Posts: 494
Rep Power: 15
clapointe is on a distinguished road
Check out this post by fumiya : http://caefn.com/openfoam/temperature-calculation.

Caelan
clapointe is offline   Reply With Quote

Old   April 15, 2019, 10:44
Default
  #3
New Member
 
Matteo
Join Date: Jan 2019
Posts: 4
Rep Power: 7
Zanco is on a distinguished road
Thank you for the answer. Unfortunately I've already seen that post and there are two points making it unuseful to me:
1 in that case enthalpy is considered instead of sensible internal energy;
2 the Newton method part is not explained, they just say a Newton method is applied and nothing more.
Is there anybody having an answer to my doubats?
Zanco is offline   Reply With Quote

Old   April 15, 2019, 15:11
Default
  #4
Senior Member
 
Join Date: Aug 2015
Posts: 494
Rep Power: 15
clapointe is on a distinguished road
The code for the newton method is provided, so I don't see the problem. Or a quick google search for the newton method will provide answers. Following the nice explanation in the link provided, we can find equivalent functions to back out temperature from internal energy -- it actually uses the same newton method, just with different inputs :

Code:
template<class Thermo, template<class> class Type>
inline Foam::scalar Foam::species::thermo<Thermo, Type>::TEs
(
    const scalar es,
    const scalar p,
    const scalar T0
) const
{
    return T
    (
        es,
        p,
        T0,
        &thermo<Thermo, Type>::Es,
        &thermo<Thermo, Type>::Cv,
        &thermo<Thermo, Type>::limit
    );
}
So there you have it.

Caelan
clapointe is offline   Reply With Quote

Old   April 16, 2019, 04:46
Default
  #5
New Member
 
Matteo
Join Date: Jan 2019
Posts: 4
Rep Power: 7
Zanco is on a distinguished road
Probably I did not exlain well what I'm looking for. I've already written what you posted in the last reply in the first part of my thread. I know what a Newton method is, I know I have to put F=Es and f=es. The point is that I cannot understand the physical meaning of es or, if you prefer, which is the physical functional I have to put equal zero for the Newton method: x1 = x0 - G(x0)/G'(x0). What is G(x) in my case?
Zanco is offline   Reply With Quote

Old   April 16, 2019, 10:37
Default
  #6
Senior Member
 
zhangyan's Avatar
 
Yan Zhang
Join Date: May 2014
Posts: 120
Rep Power: 12
zhangyan is on a distinguished road
Quote:
Originally Posted by Zanco View Post
Probably I did not exlain well what I'm looking for. I've already written what you posted in the last reply in the first part of my thread. I know what a Newton method is, I know I have to put F=Es and f=es. The point is that I cannot understand the physical meaning of es or, if you prefer, which is the physical functional I have to put equal zero for the Newton method: x1 = x0 - G(x0)/G'(x0). What is G(x) in my case?


Code:
T_new = T_old - [ Hs(p_old,T_old) - hs_fromTransportEqn]/ Cp(p_old,T_old)
hwangpo likes this.
__________________
https://openfoam.top
zhangyan 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
Total vs Internal Energy acalado FLUENT 2 May 3, 2018 18:08
Adding pressure and temperature sources instead of energy rae CFX 3 October 24, 2016 03:31
warning - extrapolating on temperature calculation cedame CONVERGE 2 September 5, 2016 12:55
Temperature to energy loss Vcent FLUENT 0 November 28, 2012 11:13
Why FVM for high-Re flows? Zhong Lei Main CFD Forum 23 May 14, 1999 14:22


All times are GMT -4. The time now is 11:14.