# Temperature calculation from sensible internal energy

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

 April 12, 2019, 05:42 Temperature calculation from sensible internal energy #1 New Member   Matteo Join Date: Jan 2019 Posts: 4 Rep Power: 7 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 Type> inline Foam::scalar Foam::species::thermo::Es(const scalar p, const scalar T) const { return this->Hs(p, T) - p/this->rho(p, T); }``` and Code: ```template class Type> inline Foam::scalar Foam::species::thermo::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.

 April 12, 2019, 14:48 #2 Senior Member   Join Date: Aug 2015 Posts: 494 Rep Power: 14 Check out this post by fumiya : http://caefn.com/openfoam/temperature-calculation. Caelan

 April 15, 2019, 09:44 #3 New Member   Matteo Join Date: Jan 2019 Posts: 4 Rep Power: 7 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?

 April 15, 2019, 14:11 #4 Senior Member   Join Date: Aug 2015 Posts: 494 Rep Power: 14 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 Type> inline Foam::scalar Foam::species::thermo::TEs ( const scalar es, const scalar p, const scalar T0 ) const { return T ( es, p, T0, &thermo::Es, &thermo::Cv, &thermo::limit ); }``` So there you have it. Caelan

 April 16, 2019, 03:46 #5 New Member   Matteo Join Date: Jan 2019 Posts: 4 Rep Power: 7 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?

April 16, 2019, 09:37
#6
Senior Member

Yan Zhang
Join Date: May 2014
Posts: 120
Rep Power: 12
Quote:
 Originally Posted by Zanco 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)`
__________________
https://openfoam.top