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

Temperature calculation in compressibleInterFoam

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By MamboJambo

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 30, 2021, 07:29
Default Temperature calculation in compressibleInterFoam
  #1
New Member
 
Join Date: Dec 2021
Posts: 23
Rep Power: 5
MamboJambo is on a distinguished road
Hello to all,


In compressibleInterFoam of OF2006, the temperature equation is defined as:


Code:
    fvScalarMatrix TEqn
    (
        fvm::ddt(rho, T) + fvm::div(rhoPhi, T) - fvm::Sp(contErr, T)
      - fvm::laplacian(turbulence.alphaEff(), T)
      + (
             divUp()// - contErr/rho*p
          +  (fvc::ddt(rho, K) + fvc::div(rhoPhi, K))() - contErr*K
        )
       *(
           alpha1()/mixture.thermo1().Cv()()
         + alpha2()/mixture.thermo2().Cv()()
        )
     ==
        fvOptions(rho, T)
    );
Afterwards two functions are called:
Code:
    mixture.correctThermo();
     mixture.correct();
The first function will create a he field from the values of pressure and temperature for each phase and call the correct() function.
In the correct() function the temperature is being recalculated from the energy from line 80-88 in the heRhoThermo.C with a Newton-Raphson method [https://caefn.com/openfoam/temperature-calculation]

My question is: If we are already solving for temperature, why do we need to recalculate the values from energy?

Edit:
The temperature used for the calculation is from obtained from the mixture object which will get the temperature field by inheriting from the basicThermo class.

This object has two AutoPtr pointers for each phase. Each of which will create they own temperature field since they inherit from basicThermo. Are the lines 80-88 just updating the temperature values of these fields? By why from energy and not directly from the calculated temperature?

Or am I getting the wrong idea?
mikulo and JuRe09 like this.
MamboJambo is offline   Reply With Quote

Old   May 4, 2022, 05:14
Default Found the solution?
  #2
New Member
 
Julian Re
Join Date: Jan 2022
Location: Germany
Posts: 11
Rep Power: 4
JuRe09 is on a distinguished road
Hey MamboJambo,


basically I have the same question!


I have to phases (polymer and air) and a modified TEqn.
Now I want to enforce/overwrite the phase temperatures with the resulting T of TEqn! (no recalculation for each phase based on h equation).


Do you have any idea how to do this?
JuRe09 is offline   Reply With Quote

Old   May 9, 2022, 05:54
Default
  #3
New Member
 
Join Date: Dec 2021
Posts: 23
Rep Power: 5
MamboJambo is on a distinguished road
Try to see how to disconnect on line 80-88 in heRhoThermo.C

Code:
        

if (this->updateT())
{
     TCells[celli] = mixture_.THE
     (
         hCells[celli],
         pCells[celli],
         TCells[celli]
       );
 }
somewhere in each thermophysicalProperties dictionary, you will have to put:

Code:
   
updateT false;
See if it works

Last edited by MamboJambo; May 27, 2022 at 13:38.
MamboJambo is offline   Reply With Quote

Old   May 25, 2022, 06:30
Default Thank you!
  #4
New Member
 
Julian Re
Join Date: Jan 2022
Location: Germany
Posts: 11
Rep Power: 4
JuRe09 is on a distinguished road
Quote:
Originally Posted by MamboJambo View Post
Try to see how to disconnect on line 80-88 in heRhoThermo.C

Code:
        

if (this->updateT())
{
     TCells[celli] = mixture_.THE
     (
         hCells[celli],
         pCells[celli],
         TCells[celli]
       );
 }
somewhere in your thermophysicalProperties dictionary, you will have to put:

Code:
   
updateT false;
See if it works

Thank you for your advise. i just commented these lines out... then I had a problem with a wrong temperature field to the boundary patches (no influence on the temperature of the BC...). Seemed to be a bug of my version (openFOAM v 1812)...
JuRe09 is offline   Reply With Quote

Old   June 26, 2022, 22:46
Default
  #5
Member
 
Join Date: Nov 2020
Posts: 53
Rep Power: 6
mikulo is on a distinguished road
Quote:
Originally Posted by MamboJambo View Post
Hello to all,


In compressibleInterFoam of OF2006, the temperature equation is defined as:


Code:
    fvScalarMatrix TEqn
    (
        fvm::ddt(rho, T) + fvm::div(rhoPhi, T) - fvm::Sp(contErr, T)
      - fvm::laplacian(turbulence.alphaEff(), T)
      + (
             divUp()// - contErr/rho*p
          +  (fvc::ddt(rho, K) + fvc::div(rhoPhi, K))() - contErr*K
        )
       *(
           alpha1()/mixture.thermo1().Cv()()
         + alpha2()/mixture.thermo2().Cv()()
        )
     ==
        fvOptions(rho, T)
    );
Afterwards two functions are called:
Code:
    mixture.correctThermo();
     mixture.correct();
The first function will create a he field from the values of pressure and temperature for each phase and call the correct() function.
In the correct() function the temperature is being recalculated from the energy from line 80-88 in the heRhoThermo.C with a Newton-Raphson method [https://caefn.com/openfoam/temperature-calculation]

My question is: If we are already solving for temperature, why do we need to recalculate the values from energy?

Edit:
The temperature used for the calculation is from obtained from the mixture object which will get the temperature field by inheriting from the basicThermo class.

This object has two AutoPtr pointers for each phase. Each of which will create they own temperature field since they inherit from basicThermo. Are the lines 80-88 just updating the temperature values of these fields? By why from energy and not directly from the calculated temperature?

Or am I getting the wrong idea?
Hello,

I do have the same question as well. It bothers me because I need to add some source term which will manipulate only the energy equation for the first phase. However, compressibleInterFoam solves the unified T equation which I believe would lead me to wrong solutions. Any thoughts about this?

Regards,
Mike
mikulo 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
Porous domain energy calculation and specific heat capacity temperature dependent Vishnu_bharathi CFX 9 November 29, 2017 14:24
Calculation of the Governing Equations Mihail CFX 7 September 7, 2014 07:27
why doesn't temperature limited disappear during the calculation? Olga FLUENT 0 May 12, 2011 04:48
external radiation temperature calculation apostolos FLUENT 0 January 19, 2008 13:02
calculation of bulk temperature in channel flow moshe FLUENT 0 May 13, 2007 10:57


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