From 1bc5401cfc4d83ed5d48c6222764cde7e032c5d0 Mon Sep 17 00:00:00 2001 From: henry Date: Thu, 9 Oct 2008 14:16:23 +0100 Subject: [PATCH] Changed the access to derived properties to ensure the old-time level values are stored if required. --- src/thermophysicalModels/basic/hThermo/hThermo.C | 54 +++++++------- .../mixtureThermos/hMixtureThermo/hMixtureThermo.C | 52 +++++++------- .../hhuMixtureThermo/hhuMixtureThermo.C | 82 ++++++++++++---------- 3 files changed, 101 insertions(+), 87 deletions(-) diff --git a/src/thermophysicalModels/basic/hThermo/hThermo.C b/src/thermophysicalModels/basic/hThermo/hThermo.C index 19e43d2..7e32f7a 100644 --- a/src/thermophysicalModels/basic/hThermo/hThermo.C +++ b/src/thermophysicalModels/basic/hThermo/hThermo.C @@ -28,15 +28,10 @@ License #include "fvMesh.H" #include "fixedValueFvPatchFields.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template -hThermo::hThermo(const fvMesh& mesh) +Foam::hThermo::hThermo(const fvMesh& mesh) : basicThermo(mesh), MixtureType(*this, mesh), @@ -56,9 +51,12 @@ hThermo::hThermo(const fvMesh& mesh) hBoundaryTypes() ) { - forAll(h_, celli) + scalarField& hCells = h_.internalField(); + const scalarField& TCells = T_.internalField(); + + forAll(hCells, celli) { - h_[celli] = this->cellMixture(celli).H(T_[celli]); + hCells[celli] = this->cellMixture(celli).H(TCells[celli]); } forAll(h_.boundaryField(), patchi) @@ -76,25 +74,33 @@ hThermo::hThermo(const fvMesh& mesh) // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // template -hThermo::~hThermo() +Foam::hThermo::~hThermo() {} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // template -void hThermo::calculate() +void Foam::hThermo::calculate() { - forAll(T_, celli) + const scalarField& hCells = h_.internalField(); + const scalarField& pCells = p_.internalField(); + + scalarField& TCells = T_.internalField(); + scalarField& psiCells = psi_.internalField(); + scalarField& muCells = mu_.internalField(); + scalarField& alphaCells = alpha_.internalField(); + + forAll(TCells, celli) { const typename MixtureType::thermoType& mixture_ = this->cellMixture(celli); - T_[celli] = mixture_.TH(h_[celli], T_[celli]); - psi_[celli] = mixture_.psi(p_[celli], T_[celli]); + TCells[celli] = mixture_.TH(hCells[celli], TCells[celli]); + psiCells[celli] = mixture_.psi(pCells[celli], TCells[celli]); - mu_[celli] = mixture_.mu(T_[celli]); - alpha_[celli] = mixture_.alpha(T_[celli]); + muCells[celli] = mixture_.mu(TCells[celli]); + alphaCells[celli] = mixture_.alpha(TCells[celli]); } forAll(T_.boundaryField(), patchi) @@ -143,7 +149,7 @@ void hThermo::calculate() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -void hThermo::correct() +void Foam::hThermo::correct() { if (debug) { @@ -163,7 +169,7 @@ void hThermo::correct() template -tmp hThermo::h +Foam::tmp Foam::hThermo::h ( const scalarField& T, const labelList& cells @@ -182,7 +188,7 @@ tmp hThermo::h template -tmp hThermo::h +Foam::tmp Foam::hThermo::h ( const scalarField& T, const label patchi @@ -201,7 +207,7 @@ tmp hThermo::h template -tmp hThermo::Cp +Foam::tmp Foam::hThermo::Cp ( const scalarField& T, const label patchi @@ -220,7 +226,7 @@ tmp hThermo::Cp template -tmp hThermo::Cp() const +Foam::tmp Foam::hThermo::Cp() const { const fvMesh& mesh = T_.mesh(); @@ -258,7 +264,7 @@ tmp hThermo::Cp() const template -tmp hThermo::Cv() const +Foam::tmp Foam::hThermo::Cv() const { const fvMesh& mesh = T_.mesh(); @@ -303,7 +309,7 @@ tmp hThermo::Cv() const template -bool hThermo::read() +bool Foam::hThermo::read() { if (basicThermo::read()) { @@ -317,8 +323,4 @@ bool hThermo::read() } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/thermophysicalModels/combustion/mixtureThermos/hMixtureThermo/hMixtureThermo.C b/src/thermophysicalModels/combustion/mixtureThermos/hMixtureThermo/hMixtureThermo.C index 2d72a4f..064e7c3 100644 --- a/src/thermophysicalModels/combustion/mixtureThermos/hMixtureThermo/hMixtureThermo.C +++ b/src/thermophysicalModels/combustion/mixtureThermos/hMixtureThermo/hMixtureThermo.C @@ -28,22 +28,20 @@ License #include "fvMesh.H" #include "fixedValueFvPatchFields.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template -hMixtureThermo::hMixtureThermo(const fvMesh& mesh) +Foam::hMixtureThermo::hMixtureThermo(const fvMesh& mesh) : hCombustionThermo(mesh), MixtureType(*this, mesh) { - forAll(h_, celli) + scalarField& hCells = h_.internalField(); + const scalarField& TCells = T_.internalField(); + + forAll(hCells, celli) { - h_[celli] = this->cellMixture(celli).H(T_[celli]); + hCells[celli] = this->cellMixture(celli).H(TCells[celli]); } forAll(h_.boundaryField(), patchi) @@ -61,25 +59,33 @@ hMixtureThermo::hMixtureThermo(const fvMesh& mesh) // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // template -hMixtureThermo::~hMixtureThermo() +Foam::hMixtureThermo::~hMixtureThermo() {} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // template -void hMixtureThermo::calculate() +void Foam::hMixtureThermo::calculate() { - forAll(T_, celli) + const scalarField& hCells = h_.internalField(); + const scalarField& pCells = p_.internalField(); + + scalarField& TCells = T_.internalField(); + scalarField& psiCells = psi_.internalField(); + scalarField& muCells = mu_.internalField(); + scalarField& alphaCells = alpha_.internalField(); + + forAll(TCells, celli) { const typename MixtureType::thermoType& mixture_ = this->cellMixture(celli); - T_[celli] = mixture_.TH(h_[celli], T_[celli]); - psi_[celli] = mixture_.psi(p_[celli], T_[celli]); + TCells[celli] = mixture_.TH(hCells[celli], TCells[celli]); + psiCells[celli] = mixture_.psi(pCells[celli], TCells[celli]); - mu_[celli] = mixture_.mu(T_[celli]); - alpha_[celli] = mixture_.alpha(T_[celli]); + muCells[celli] = mixture_.mu(TCells[celli]); + alphaCells[celli] = mixture_.alpha(TCells[celli]); } forAll(T_.boundaryField(), patchi) @@ -128,7 +134,7 @@ void hMixtureThermo::calculate() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -tmp hMixtureThermo::h +Foam::tmp Foam::hMixtureThermo::h ( const scalarField& T, const labelList& cells @@ -147,7 +153,7 @@ tmp hMixtureThermo::h template -tmp hMixtureThermo::h +Foam::tmp Foam::hMixtureThermo::h ( const scalarField& T, const label patchi @@ -166,7 +172,7 @@ tmp hMixtureThermo::h template -tmp hMixtureThermo::Cp +Foam::tmp Foam::hMixtureThermo::Cp ( const scalarField& T, const label patchi @@ -186,7 +192,7 @@ tmp hMixtureThermo::Cp template -tmp hMixtureThermo::Cp() const +Foam::tmp Foam::hMixtureThermo::Cp() const { const fvMesh& mesh = T_.mesh(); @@ -224,7 +230,7 @@ tmp hMixtureThermo::Cp() const template -void hMixtureThermo::correct() +void Foam::hMixtureThermo::correct() { if (debug) { @@ -244,7 +250,7 @@ void hMixtureThermo::correct() template -bool hMixtureThermo::read() +bool Foam::hMixtureThermo::read() { if (hCombustionThermo::read()) { @@ -258,8 +264,4 @@ bool hMixtureThermo::read() } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/thermophysicalModels/combustion/mixtureThermos/hhuMixtureThermo/hhuMixtureThermo.C b/src/thermophysicalModels/combustion/mixtureThermos/hhuMixtureThermo/hhuMixtureThermo.C index 04bf08e..0086e8c 100644 --- a/src/thermophysicalModels/combustion/mixtureThermos/hhuMixtureThermo/hhuMixtureThermo.C +++ b/src/thermophysicalModels/combustion/mixtureThermos/hhuMixtureThermo/hhuMixtureThermo.C @@ -28,23 +28,23 @@ License #include "fvMesh.H" #include "fixedValueFvPatchFields.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template -hhuMixtureThermo::hhuMixtureThermo(const fvMesh& mesh) +Foam::hhuMixtureThermo::hhuMixtureThermo(const fvMesh& mesh) : hhuCombustionThermo(mesh), MixtureType(*this, mesh) { - forAll(h_, celli) + scalarField& hCells = h_.internalField(); + scalarField& huCells = hu_.internalField(); + const scalarField& TCells = T_.internalField(); + const scalarField& TuCells = Tu_.internalField(); + + forAll(hCells, celli) { - h_[celli] = this->cellMixture(celli).H(T_[celli]); - hu_[celli] = this->cellReactants(celli).H(Tu_[celli]); + hCells[celli] = this->cellMixture(celli).H(TCells[celli]); + huCells[celli] = this->cellReactants(celli).H(TuCells[celli]); } forAll(h_.boundaryField(), patchi) @@ -71,27 +71,38 @@ hhuMixtureThermo::hhuMixtureThermo(const fvMesh& mesh) // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // template -hhuMixtureThermo::~hhuMixtureThermo() +Foam::hhuMixtureThermo::~hhuMixtureThermo() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -void hhuMixtureThermo::calculate() +void Foam::hhuMixtureThermo::calculate() { - forAll(T_, celli) + const scalarField& hCells = h_.internalField(); + const scalarField& huCells = hu_.internalField(); + const scalarField& pCells = p_.internalField(); + + scalarField& TCells = T_.internalField(); + scalarField& TuCells = Tu_.internalField(); + scalarField& psiCells = psi_.internalField(); + scalarField& muCells = mu_.internalField(); + scalarField& alphaCells = alpha_.internalField(); + + forAll(TCells, celli) { - const typename MixtureType::thermoType& mixture_ = + const typename MixtureType::thermoType& mixture_ = this->cellMixture(celli); - T_[celli] = mixture_.TH(h_[celli], T_[celli]); - psi_[celli] = mixture_.psi(p_[celli], T_[celli]); + TCells[celli] = mixture_.TH(hCells[celli], TCells[celli]); + psiCells[celli] = mixture_.psi(pCells[celli], TCells[celli]); - mu_[celli] = mixture_.mu(T_[celli]); - alpha_[celli] = mixture_.alpha(T_[celli]); + muCells[celli] = mixture_.mu(TCells[celli]); + alphaCells[celli] = mixture_.alpha(TCells[celli]); - Tu_[celli] = this->cellReactants(celli).TH(hu_[celli], Tu_[celli]); + TuCells[celli] = + this->cellReactants(celli).TH(huCells[celli], TuCells[celli]); } forAll(T_.boundaryField(), patchi) @@ -144,7 +155,7 @@ void hhuMixtureThermo::calculate() template -void hhuMixtureThermo::correct() +void Foam::hhuMixtureThermo::correct() { if (debug) { @@ -163,7 +174,7 @@ void hhuMixtureThermo::correct() } template -tmp hhuMixtureThermo::h +Foam::tmp Foam::hhuMixtureThermo::h ( const scalarField& T, const labelList& cells @@ -182,7 +193,7 @@ tmp hhuMixtureThermo::h template -tmp hhuMixtureThermo::h +Foam::tmp Foam::hhuMixtureThermo::h ( const scalarField& T, const label patchi @@ -201,7 +212,7 @@ tmp hhuMixtureThermo::h template -tmp hhuMixtureThermo::Cp +Foam::tmp Foam::hhuMixtureThermo::Cp ( const scalarField& T, const label patchi @@ -221,7 +232,7 @@ tmp hhuMixtureThermo::Cp template -tmp hhuMixtureThermo::Cp() const +Foam::tmp Foam::hhuMixtureThermo::Cp() const { const fvMesh& mesh = T_.mesh(); @@ -260,7 +271,7 @@ tmp hhuMixtureThermo::Cp() const template -tmp hhuMixtureThermo::hu +Foam::tmp Foam::hhuMixtureThermo::hu ( const scalarField& Tu, const labelList& cells @@ -279,7 +290,7 @@ tmp hhuMixtureThermo::hu template -tmp hhuMixtureThermo::hu +Foam::tmp Foam::hhuMixtureThermo::hu ( const scalarField& Tu, const label patchi @@ -298,7 +309,7 @@ tmp hhuMixtureThermo::hu template -tmp hhuMixtureThermo::Tb() const +Foam::tmp Foam::hhuMixtureThermo::Tb() const { tmp tTb ( @@ -342,7 +353,8 @@ tmp hhuMixtureThermo::Tb() const template -tmp hhuMixtureThermo::psiu() const +Foam::tmp +Foam::hhuMixtureThermo::psiu() const { tmp tpsiu ( @@ -388,7 +400,8 @@ tmp hhuMixtureThermo::psiu() const template -tmp hhuMixtureThermo::psib() const +Foam::tmp +Foam::hhuMixtureThermo::psib() const { tmp tpsib ( @@ -426,7 +439,8 @@ tmp hhuMixtureThermo::psib() const forAll(ppsib, facei) { ppsib[facei] = - this->patchFaceReactants(patchi, facei).psi(pp[facei], pTb[facei]); + this->patchFaceReactants + (patchi, facei).psi(pp[facei], pTb[facei]); } } @@ -435,7 +449,7 @@ tmp hhuMixtureThermo::psib() const template -tmp hhuMixtureThermo::muu() const +Foam::tmp Foam::hhuMixtureThermo::muu() const { tmp tmuu ( @@ -478,7 +492,7 @@ tmp hhuMixtureThermo::muu() const template -tmp hhuMixtureThermo::mub() const +Foam::tmp Foam::hhuMixtureThermo::mub() const { tmp tmub ( @@ -521,7 +535,7 @@ tmp hhuMixtureThermo::mub() const template -bool hhuMixtureThermo::read() +bool Foam::hhuMixtureThermo::read() { if (hhuCombustionThermo::read()) { @@ -535,8 +549,4 @@ bool hhuMixtureThermo::read() } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // -- 2.11.4.GIT