CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   where is the calculation of the temperature field (

Tobi July 30, 2012 04:07

where is the calculation of the temperature field
Hi all,

i am looking for the calculation step of the temperature field in the rhoSimpleFoam solver.

The T field must be calculated due to the enthalpy field which is solved in the hEqn.H file.

I had a look at the thermodynamics (hPsiThermo) which is used in the constant/hermodynamics file. There i find the correction (h.correct()) and therefor OF go to the calculate function. The code (shorted) is that one:


template<class MixtureType>
void Foam::hPsiThermo<MixtureType>::calculate()
    const scalarField& hCells = h_.internalField();
    const scalarField& pCells = this->p_.internalField();

    scalarField& TCells = this->T_.internalField();
    scalarField& psiCells = this->psi_.internalField();
    scalarField& muCells = this->mu_.internalField();
    scalarField& alphaCells = this->alpha_.internalField();

    forAll(TCells, celli)
        const typename MixtureType::thermoType& mixture_ =

        TCells[celli] = mixture_.TH(hCells[celli], TCells[celli]);
        psiCells[celli] = mixture_.psi(pCells[celli], TCells[celli]);

        muCells[celli] =[celli]);
        alphaCells[celli] = mixture_.alpha(TCells[celli]);

and I think that the calculation of the temperature in the cells is defined and solved by that line

        TCells[celli] = mixture_.TH(hCells[celli], TCells[celli]);
Is that correct?
After that I had a look at the TH function in the species (pureMixture) files but there was just a inline function prototype in the header file and no declaration of the function. :(

Can someone give me an advice?
Or am I completely wrong?

Why do I need it (for those who are interested in it):

I am using the flamelet solver. In this model all theromdynamic properties are just depend on the mixture fraction Z. The new thermodynamic model get the temperature field by extracting the temperature depended on Z out of a flamelet library. In this solver there is an extension using an enthalpy defect. So you can get use fixed value BC. If you choose that, the thermodynamics just calculating a new enthalpy defect derived of the fixed temperature and then selecting all new properties out of the flamelet library using that depended on Z and the enthalpy defect.

That`s very good but I wanna use the "wallHeatTransfer" BC. For that I have to calculate the temperature field every time step. For now just the h, p and U are calculated. h is used for the correct choice of enthalpy defect library to get better results. But if I have the enthalpy field it should be possible to recalculate the temperature field every iteration or just for the patch faces.

For now its possible to set the BC "wallHeatTransfer" but there is no calculation of the temperature and its like I set a fixed value.

The extraction of the properties can be set. Like every 10 iterations you can extract the properties depended on Z.

Thanks in advance

Tobi July 30, 2012 10:40

Hi all,

i solved it. I had to implement the enthalpy equation for "h". Present I am just calculating the enthalpy "H".

Now the calculation for the temperature field is going and my wall heat transfer wall BC works.

But I have to get deeper into the code to know exactly what the solver is doing.

Tobi & Thanks for reading

All times are GMT -4. The time now is 12:27.