From 2fb7b6cfcce66945a7a299c7efbc8e3e93a58e40 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 14 Mar 2012 09:33:15 +0000 Subject: [PATCH] ENH: basicThermo: add T from h calculation for cell-set or patch --- .../basic/basicThermo/basicThermo.C | 32 +++++++++++++ .../basic/basicThermo/basicThermo.H | 16 +++++++ .../basic/rhoThermo/hRhoThermo/hRhoThermo.C | 46 ++++++++++++++++++- .../basic/rhoThermo/hRhoThermo/hRhoThermo.H | 18 +++++++- 4 files changed, 110 insertions(+), 2 deletions(-) diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.C b/src/thermophysicalModels/basic/basicThermo/basicThermo.C index ad40123d6e..59c0056040 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermo.C +++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.C @@ -350,6 +350,38 @@ Foam::tmp Foam::basicThermo::hc() const } +Foam::tmp Foam::basicThermo::TH +( + const scalarField& h, + const scalarField& T0, // starting temperature + const labelList& cells +) const +{ + notImplemented + ( + "basicThermo::TH" + "(const scalarField&, const scalarField&, const labelList&) const" + ); + return tmp(NULL); +} + + +Foam::tmp Foam::basicThermo::TH +( + const scalarField& h, + const scalarField& T0, // starting temperature + const label patchi +) const +{ + notImplemented + ( + "basicThermo::TH" + "(const scalarField&, const scalarField&, const label) const" + ); + return tmp(NULL); +} + + Foam::volScalarField& Foam::basicThermo::e() { notImplemented("basicThermo::e()"); diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.H b/src/thermophysicalModels/basic/basicThermo/basicThermo.H index 0bb67f8b49..92c4b01258 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermo.H +++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.H @@ -198,6 +198,22 @@ public: //- Chemical enthalpy [J/kg] virtual tmp hc() const; + //- Temperature from enthalpy for cell-set + virtual tmp TH + ( + const scalarField& h, + const scalarField& T0, // starting temperature + const labelList& cells + ) const; + + //- Temperature from enthalpy for patch + virtual tmp TH + ( + const scalarField& h, + const scalarField& T0, // starting temperature + const label patchi + ) const; + //- Internal energy [J/kg] // Non-const access allowed for transport equations virtual volScalarField& e(); diff --git a/src/thermophysicalModels/basic/rhoThermo/hRhoThermo/hRhoThermo.C b/src/thermophysicalModels/basic/rhoThermo/hRhoThermo/hRhoThermo.C index 9d26c95015..9d3f3c2ba7 100644 --- a/src/thermophysicalModels/basic/rhoThermo/hRhoThermo/hRhoThermo.C +++ b/src/thermophysicalModels/basic/rhoThermo/hRhoThermo/hRhoThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -205,6 +205,50 @@ Foam::tmp Foam::hRhoThermo::h } +template +Foam::tmp Foam::hRhoThermo::TH +( + const scalarField& h, + const scalarField& T0, + const labelList& cells +) const +{ + tmp tT(new scalarField(h.size())); + scalarField& T = tT(); + + forAll(h, celli) + { + T[celli] = this->cellMixture(cells[celli]).TH(h[celli], T0[celli]); + } + + return tT; +} + + +template +Foam::tmp Foam::hRhoThermo::TH +( + const scalarField& h, + const scalarField& T0, + const label patchi +) const +{ + tmp tT(new scalarField(h.size())); + scalarField& T = tT(); + + forAll(h, facei) + { + T[facei] = this->patchFaceMixture + ( + patchi, + facei + ).TH(h[facei], T0[facei]); + } + + return tT; +} + + template Foam::tmp Foam::hRhoThermo::Cp ( diff --git a/src/thermophysicalModels/basic/rhoThermo/hRhoThermo/hRhoThermo.H b/src/thermophysicalModels/basic/rhoThermo/hRhoThermo/hRhoThermo.H index ee3cd4ba7f..1f85793f6b 100644 --- a/src/thermophysicalModels/basic/rhoThermo/hRhoThermo/hRhoThermo.H +++ b/src/thermophysicalModels/basic/rhoThermo/hRhoThermo/hRhoThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -134,6 +134,22 @@ public: const label patchi ) const; + //- Temperature from enthalpy for cell-set + virtual tmp TH + ( + const scalarField& h, + const scalarField& T0, // starting temperature + const labelList& cells + ) const; + + //- Temperature from enthalpy for patch + virtual tmp TH + ( + const scalarField& h, + const scalarField& T0, // starting temperature + const label patchi + ) const; + //- Heat capacity at constant pressure for patch [J/kg/K] virtual tmp Cp (