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

Energy Equ. based on temperature

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By mAlletto
  • 1 Post By Kummi

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 22, 2022, 05:46
Question Energy Equ. based on temperature
  #1
Senior Member
 
Kumaresh
Join Date: Oct 2016
Posts: 355
Rep Power: 12
Kummi is on a distinguished road
Send a message via Yahoo to Kummi
Hello Foamers,
I was working with older version of OpenFOAM 2.1.1. Currently, I shifted to version v2106 for some reason. While working with pyrolysis in OFv2106, the energy equation looks like,
Quote:
fvScalarMatrix hEqn
(
fvm::ddt(rho_, h_)
- fvm::laplacian(alpha, h_)
+ fvc::laplacian(alpha, h_)
- fvc::laplacian(kappa(), T())
==
chemistryQdot_
+ solidChemistry_->RRsHs()
);
In my case, I want to use temperature directly in Energy equation as follows,
Quote:
fvScalarMatrix TEqn
(
fvm::ddt(rhoCp, T_)
- fvm::laplacian(K_, T_)
==
chemistryQdot_
);
In older version OF 2.1.1, the temperature implementation is so direct in the equation but not in the case of OFv2106. So, I did little research on how to make this happen.
In basicThermo.C,
Quote:
// Temperature returns a non-const value
Foam::volScalarField& Foam::basicThermo::T()
{
return T_;
}
So, I initialized T_ as part of constructor in my source file as,
Quote:
T_
(
IOobject
(
* * "T",
* * * regionMesh().time().timeName(),
* * * regionMesh(),
* * * IOobject::MUST_READ,
* * * IOobject::AUTO_WRITE
),
* * * //regionMesh(),
* * * solidThermo_->T()
* * )
There is no problem with compilation. Before running the case, I fixed a print statement under the energy equation to check the variation of temperature.
Info << "T_from Energy equ:" << T_ << endl;

I can find the variation in temperature in the log file as,
Quote:
T_from Energy equ:dimensions [0 0 0 1 0 0 0];

internalField nonuniform List<scalar>
14
(
931.685
877.421
824.294
773.017
724.259
678.639
636.723
599.013
565.938
537.856
515.058
497.77
486.156
480.322
)
;
However, the output changes are nil. NO changes in fuel compositions, temperature and other variables. If I'm not wrong, the energy equation which I've adopted based on temperature is not solved. Can someone share their ideas to sort out this ?
Another question:
What are differences in implementing T or h in Energy equation and their advantages and disadvantages in OpenFOAM ?
Thank you
Kummi is offline   Reply With Quote

Old   March 23, 2022, 08:12
Question
  #2
Senior Member
 
Kumaresh
Join Date: Oct 2016
Posts: 355
Rep Power: 12
Kummi is on a distinguished road
Send a message via Yahoo to Kummi
Quote:
auto& T1_ = solidThermo_->T();
forAll(T1_, celli)
{
T1_[celli] = T_[celli];
}
I have tried fixing this above the energy equation, but that doesn't helped. Any ideas from someone ?
Thank you
Kummi is offline   Reply With Quote

Old   March 28, 2022, 04:54
Default
  #3
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16
mAlletto will become famous soon enough
What you are solving for in fluid dynamics is the energy equation. For this reason solving for h does make sense. If you want to solve for T you already make an assumption about your thermodynamic model:


h = cp T + const


This model is fairly ok if the temperature range is not too high or for ideal gases. If you want to apply other thermodynamic models (see https://cfd.direct/openfoam/user-gui...hermophysical/) or be as flexible as possible in selecting your desired thermodynamic model at run time, you have to solve for h. If you want then to retrieve the temperature from your equation of state, you have to solve a non-linear equation. See https://caefn.com/openfoam/temperature-calculation for an explanation.
Kummi likes this.
mAlletto is offline   Reply With Quote

Old   March 31, 2022, 01:08
Default
  #4
Senior Member
 
Kumaresh
Join Date: Oct 2016
Posts: 355
Rep Power: 12
Kummi is on a distinguished road
Send a message via Yahoo to Kummi
Hello Michael Alletto,
Thanks for your points.
In my case, the boundary condition is given in the form of temperature not heat and that's the reason why my energy equation is in temperature form. Correct me if I'm wrong please.
So the temperature variable calculates heat transferred into the domain.

{\rho c\frac{\delta T}{\delta t}=\frac{\delta}{\delta x}\left ( K\frac{\delta T}{\delta x} \right )+Q\
+ r_{gas}C_{p_{gas}}\frac{\delta T}{\delta x}}

Hereby in my governing equation, the source terms are dependent on temperature changes too.
Thank you
Kummi is offline   Reply With Quote

Old   May 18, 2022, 02:41
Default Solution for my query (Hope it may help someone)
  #5
Senior Member
 
Kumaresh
Join Date: Oct 2016
Posts: 355
Rep Power: 12
Kummi is on a distinguished road
Send a message via Yahoo to Kummi
In higher versions of OpenFOAM, the temperature is calculated from enthalpy. In the file heSolidThermo.C, the function THE calculates temperature from enthalpy, where enthalpy is declared in the parent class heThermo.

In any case, if we require the energy equation in temperature form (as quoted below), that's not gonna work, as there will no change in temperature at the end result.
Quote:
fvScalarMatrix TEqn
(
fvm::ddt(rhoCp, T_)
- fvm::laplacian(K_, T_)
==
chemistryQdot_
);
In order to solve TEqn, comment out updateT() return variable TOwner in basicThermo.H.

Quote:
//- Should T be updated
Switch updateT() const
{
//return TOwner_;
}
In basicThermo.C, T_ returns temperature value. updateT() updates T_ based on enthalpy. If updateT() is dead, then T_ will be calculated from the TEqn matrix.

Quote:
T_(lookupOrConstruct(mesh, phasePropertyName("T"), TOwner_)),
TOwner_(getOrDefault<Switch>("updateT", TOwner_)),
Hope it helps someone.
Thank you
CorbinMG likes this.
Kummi 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
How to write a udf to define average temperature at one boundary based on the value o er_ijaz Fluent UDF and Scheme Programming 1 May 5, 2021 23:43
Static Temperature / Opening Temperature JulianP CFX 12 April 10, 2019 19:00
Cavity based BuoyantSimpleFoam problem where changing temperature causes crashing emills OpenFOAM 0 December 14, 2017 15:07
abnormal temperature near interface when adding energy equation to interFoam houkensjtu OpenFOAM 4 June 26, 2013 14:40
How to call the subroutine to compute two temperature energy conservation equations? wangweizong Phoenics 1 March 21, 2012 10:27


All times are GMT -4. The time now is 01:03.