diff --git a/src/thermophysicalModels/basic/basicThermo/BasicThermo.C b/src/thermophysicalModels/basic/basicThermo/BasicThermo.C index 135a17ddbc..d86dc61f5d 100644 --- a/src/thermophysicalModels/basic/basicThermo/BasicThermo.C +++ b/src/thermophysicalModels/basic/basicThermo/BasicThermo.C @@ -53,9 +53,11 @@ Foam::BasicThermo::volScalarFieldProperty volScalarField& psi = tPsi.ref(); + auto Yslicer = this->Yslicer(); + forAll(psi, celli) { - auto composition = this->cellComposition(celli); + auto composition = this->cellComposition(Yslicer, celli); psi[celli] = ((this->*mixture)(composition).*psiMethod)(args[celli] ...); @@ -67,7 +69,8 @@ Foam::BasicThermo::volScalarFieldProperty { forAll(psiBf[patchi], patchFacei) { - auto composition = this->patchFaceComposition(patchi, patchFacei); + auto composition = + this->patchFaceComposition(Yslicer, patchi, patchFacei); psiBf[patchi][patchFacei] = ((this->*mixture)(composition).*psiMethod) @@ -98,9 +101,11 @@ Foam::BasicThermo::cellSetProperty tmp tPsi(new scalarField(cells.size())); scalarField& psi = tPsi.ref(); + auto Yslicer = this->Yslicer(); + forAll(cells, celli) { - auto composition = this->cellComposition(cells[celli]); + auto composition = this->cellComposition(Yslicer, cells[celli]); psi[celli] = ((this->*mixture)(composition).*psiMethod)(args[celli] ...); @@ -127,9 +132,12 @@ Foam::BasicThermo::patchFieldProperty ); scalarField& psi = tPsi.ref(); + auto Yslicer = this->Yslicer(); + forAll(psi, patchFacei) { - auto composition = this->patchFaceComposition(patchi, patchFacei); + auto composition = + this->patchFaceComposition(Yslicer, patchi, patchFacei); psi[patchFacei] = ((this->*mixture)(composition).*psiMethod)(args[patchFacei] ...); diff --git a/src/thermophysicalModels/basic/psiThermo/PsiThermo.C b/src/thermophysicalModels/basic/psiThermo/PsiThermo.C index 01c60c147a..394c89e53a 100644 --- a/src/thermophysicalModels/basic/psiThermo/PsiThermo.C +++ b/src/thermophysicalModels/basic/psiThermo/PsiThermo.C @@ -40,9 +40,11 @@ void Foam::PsiThermo::calculate() scalarField& muCells = this->mu_.primitiveFieldRef(); scalarField& kappaCells = this->kappa_.primitiveFieldRef(); + auto Yslicer = this->Yslicer(); + forAll(TCells, celli) { - auto composition = this->cellComposition(celli); + auto composition = this->cellComposition(Yslicer, celli); const typename BaseThermo::mixtureType::thermoMixtureType& thermoMixture = this->thermoMixture(composition); @@ -106,7 +108,8 @@ void Foam::PsiThermo::calculate() { forAll(pT, facei) { - auto composition = this->patchFaceComposition(patchi, facei); + auto composition = + this->patchFaceComposition(Yslicer, patchi, facei); const typename BaseThermo::mixtureType::thermoMixtureType& thermoMixture = this->thermoMixture(composition); @@ -129,7 +132,8 @@ void Foam::PsiThermo::calculate() { forAll(pT, facei) { - auto composition = this->patchFaceComposition(patchi, facei); + auto composition = + this->patchFaceComposition(Yslicer, patchi, facei); const typename BaseThermo::mixtureType::thermoMixtureType& thermoMixture = this->thermoMixture(composition); diff --git a/src/thermophysicalModels/basic/pureThermo/pureThermo.H b/src/thermophysicalModels/basic/pureThermo/pureThermo.H index 73afd962a0..81c0c63131 100644 --- a/src/thermophysicalModels/basic/pureThermo/pureThermo.H +++ b/src/thermophysicalModels/basic/pureThermo/pureThermo.H @@ -61,12 +61,20 @@ public: // Member Functions + //- Get the slicer + inline nil Yslicer() const; + //- Get the composition of an internal cell - inline nil cellComposition(const label celli) const; + inline nil cellComposition + ( + const nil, + const label celli + ) const; //- Get the composition of a boundary face inline nil patchFaceComposition ( + const nil, const label patchi, const label facei ) const; diff --git a/src/thermophysicalModels/basic/pureThermo/pureThermoI.H b/src/thermophysicalModels/basic/pureThermo/pureThermoI.H index 170a3f3978..09221f5123 100644 --- a/src/thermophysicalModels/basic/pureThermo/pureThermoI.H +++ b/src/thermophysicalModels/basic/pureThermo/pureThermoI.H @@ -27,7 +27,17 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -inline Foam::nil Foam::pureThermo::cellComposition(const label celli) const +inline Foam::nil Foam::pureThermo::Yslicer() const +{ + return nil(); +} + + +inline Foam::nil Foam::pureThermo::cellComposition +( + const nil, + const label celli +) const { return nil(); } @@ -35,6 +45,7 @@ inline Foam::nil Foam::pureThermo::cellComposition(const label celli) const inline Foam::nil Foam::pureThermo::patchFaceComposition ( + const nil, const label patchi, const label facei ) const diff --git a/src/thermophysicalModels/basic/rhoFluidThermo/RhoFluidThermo.C b/src/thermophysicalModels/basic/rhoFluidThermo/RhoFluidThermo.C index 4c5e7410b3..935cf243ce 100644 --- a/src/thermophysicalModels/basic/rhoFluidThermo/RhoFluidThermo.C +++ b/src/thermophysicalModels/basic/rhoFluidThermo/RhoFluidThermo.C @@ -41,9 +41,11 @@ void Foam::RhoFluidThermo::calculate() scalarField& muCells = this->mu_.primitiveFieldRef(); scalarField& kappaCells = this->kappa_.primitiveFieldRef(); + auto Yslicer = this->Yslicer(); + forAll(TCells, celli) { - auto composition = this->cellComposition(celli); + auto composition = this->cellComposition(Yslicer, celli); const typename BaseThermo::mixtureType::thermoMixtureType& thermoMixture = this->thermoMixture(composition); @@ -112,7 +114,8 @@ void Foam::RhoFluidThermo::calculate() { forAll(pT, facei) { - auto composition = this->patchFaceComposition(patchi, facei); + auto composition = + this->patchFaceComposition(Yslicer, patchi, facei); const typename BaseThermo::mixtureType::thermoMixtureType& thermoMixture = this->thermoMixture(composition); @@ -136,7 +139,8 @@ void Foam::RhoFluidThermo::calculate() { forAll(pT, facei) { - auto composition = this->patchFaceComposition(patchi, facei); + auto composition = + this->patchFaceComposition(Yslicer, patchi, facei); const typename BaseThermo::mixtureType::thermoMixtureType& thermoMixture = this->thermoMixture(composition); diff --git a/src/thermophysicalModels/multicomponentThermo/include/GeometricFieldListSlicer.H b/src/thermophysicalModels/multicomponentThermo/include/GeometricFieldListSlicer.H index 072323c48e..a600da840a 100644 --- a/src/thermophysicalModels/multicomponentThermo/include/GeometricFieldListSlicer.H +++ b/src/thermophysicalModels/multicomponentThermo/include/GeometricFieldListSlicer.H @@ -56,6 +56,7 @@ class GeometricFieldListSlicer // Type of the geometric field typedef GeometricField geoFieldType; + // Private Data //- Pointers to the internal fields diff --git a/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/multicomponentThermo.C b/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/multicomponentThermo.C index 6ee34b8fb9..b05b7ee959 100644 --- a/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/multicomponentThermo.C +++ b/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/multicomponentThermo.C @@ -90,8 +90,7 @@ Foam::multicomponentThermo::implementation::implementation : -1 ), active_(species_.size(), true), - Y_(species_.size()), - Yslicer_() + Y_(species_.size()) { if (species_.size() && defaultSpeciei_ == -1) { @@ -203,8 +202,6 @@ Foam::multicomponentThermo::implementation::implementation } } - Yslicer_.set(Y_); - correctMassFractions(); } diff --git a/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/multicomponentThermo.H b/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/multicomponentThermo.H index c5dcf132b9..ff5bd67991 100644 --- a/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/multicomponentThermo.H +++ b/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/multicomponentThermo.H @@ -294,9 +294,6 @@ protected: //- Species mass fractions PtrList Y_; - //- Species mass fractions slicing engine - volScalarFieldListSlicer Yslicer_; - // Protected Member Functions @@ -339,12 +336,20 @@ public: //- Access the mass-fraction fields virtual const PtrList& Y() const; + //- Get the slicer + inline volScalarFieldListSlicer Yslicer() const; + //- Get the composition of an internal cell - inline scalarFieldListSlice cellComposition(const label celli) const; + inline scalarFieldListSlice cellComposition + ( + const volScalarFieldListSlicer& Yslicer, + const label celli + ) const; //- Get the composition of a boundary face inline scalarFieldListSlice patchFaceComposition ( + const volScalarFieldListSlicer& Yslicer, const label patchi, const label facei ) const; diff --git a/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/multicomponentThermoI.H b/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/multicomponentThermoI.H index e9a920f52c..65f6107c64 100644 --- a/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/multicomponentThermoI.H +++ b/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/multicomponentThermoI.H @@ -104,24 +104,33 @@ inline Foam::label Foam::multicomponentThermo::specieIndex } +inline Foam::volScalarFieldListSlicer +Foam::multicomponentThermo::implementation::Yslicer() const +{ + return volScalarFieldListSlicer(Y_); +} + + inline Foam::scalarFieldListSlice Foam::multicomponentThermo::implementation::cellComposition ( + const volScalarFieldListSlicer& Yslicer, const label celli ) const { - return Yslicer_.slice(celli); + return Yslicer.slice(celli); } inline Foam::scalarFieldListSlice Foam::multicomponentThermo::implementation::patchFaceComposition ( + const volScalarFieldListSlicer& Yslicer, const label patchi, const label facei ) const { - return Yslicer_.patchSlice(patchi, facei); + return Yslicer.patchSlice(patchi, facei); } diff --git a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/PsiuMulticomponentThermo.C b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/PsiuMulticomponentThermo.C index 6fca2dd026..f965e991f0 100644 --- a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/PsiuMulticomponentThermo.C +++ b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/PsiuMulticomponentThermo.C @@ -44,9 +44,11 @@ void Foam::PsiuMulticomponentThermo::calculate() scalarField& muCells = this->mu_.primitiveFieldRef(); scalarField& kappaCells = this->kappa_.primitiveFieldRef(); + auto Yslicer = this->Yslicer(); + forAll(TCells, celli) { - auto composition = this->cellComposition(celli); + auto composition = this->cellComposition(Yslicer, celli); const typename BaseThermo::mixtureType::thermoMixtureType& thermoMixture = this->thermoMixture(composition); @@ -125,7 +127,8 @@ void Foam::PsiuMulticomponentThermo::calculate() { forAll(pT, facei) { - auto composition = this->patchFaceComposition(patchi, facei); + auto composition = + this->patchFaceComposition(Yslicer, patchi, facei); const typename BaseThermo::mixtureType::thermoMixtureType& thermoMixture = this->thermoMixture(composition); @@ -147,7 +150,8 @@ void Foam::PsiuMulticomponentThermo::calculate() { forAll(pT, facei) { - auto composition = this->patchFaceComposition(patchi, facei); + auto composition = + this->patchFaceComposition(Yslicer, patchi, facei); const typename BaseThermo::mixtureType::thermoMixtureType& thermoMixture = this->thermoMixture(composition); diff --git a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermo.C b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermo.C index 0056dccbe0..e40b24e9ff 100644 --- a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermo.C +++ b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermo.C @@ -112,8 +112,7 @@ Foam::psiuMulticomponentThermo::implementation::implementation ) : species_(specieNames), - Y_(species_.size()), - Yslicer_() + Y_(species_.size()) { forAll(species_, i) { @@ -134,8 +133,6 @@ Foam::psiuMulticomponentThermo::implementation::implementation ) ); } - - Yslicer_.set(Y_); } diff --git a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermo.H b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermo.H index 4cbfc94bdb..ffda7397a7 100644 --- a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermo.H +++ b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermo.H @@ -223,9 +223,6 @@ protected: //- Species mass fractions PtrList Y_; - //- Species mass fractions slicing engine - volScalarFieldListSlicer Yslicer_; - public: @@ -256,12 +253,20 @@ public: //- Access the mass-fraction fields virtual const PtrList& Y() const; + //- Get the slicer + inline volScalarFieldListSlicer Yslicer() const; + //- Get the composition of an internal cell - inline scalarFieldListSlice cellComposition(const label celli) const; + inline scalarFieldListSlice cellComposition + ( + const volScalarFieldListSlicer& Yslicer, + const label celli + ) const; //- Get the composition of a boundary face inline scalarFieldListSlice patchFaceComposition ( + const volScalarFieldListSlicer& Yslicer, const label patchi, const label facei ) const; diff --git a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermoI.H b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermoI.H index 09760d4a10..fd5b8f6762 100644 --- a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermoI.H +++ b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermoI.H @@ -55,24 +55,33 @@ inline const Foam::volScalarField& Foam::psiuMulticomponentThermo::Y } +inline Foam::volScalarFieldListSlicer +Foam::psiuMulticomponentThermo::implementation::Yslicer() const +{ + return volScalarFieldListSlicer(Y_); +} + + inline Foam::scalarFieldListSlice Foam::psiuMulticomponentThermo::implementation::cellComposition ( + const volScalarFieldListSlicer& Yslicer, const label celli ) const { - return Yslicer_.slice(celli); + return Yslicer.slice(celli); } inline Foam::scalarFieldListSlice Foam::psiuMulticomponentThermo::implementation::patchFaceComposition ( + const volScalarFieldListSlicer& Yslicer, const label patchi, const label facei ) const { - return Yslicer_.patchSlice(patchi, facei); + return Yslicer.patchSlice(patchi, facei); } diff --git a/src/thermophysicalModels/solidThermo/solidThermo/SolidThermo.C b/src/thermophysicalModels/solidThermo/solidThermo/SolidThermo.C index a715c64a6b..59627098fb 100644 --- a/src/thermophysicalModels/solidThermo/solidThermo/SolidThermo.C +++ b/src/thermophysicalModels/solidThermo/solidThermo/SolidThermo.C @@ -42,9 +42,11 @@ void Foam::SolidThermo::calculate() scalarField& kappaCells = this->kappa_.primitiveFieldRef(); vectorField& KappaCells = this->Kappa_.primitiveFieldRef(); + auto Yslicer = this->Yslicer(); + forAll(TCells, celli) { - auto composition = this->cellComposition(celli); + auto composition = this->cellComposition(Yslicer, celli); const typename BaseThermo::mixtureType::thermoMixtureType& thermoMixture = this->thermoMixture(composition); @@ -115,7 +117,8 @@ void Foam::SolidThermo::calculate() { forAll(pT, facei) { - auto composition = this->patchFaceComposition(patchi, facei); + auto composition = + this->patchFaceComposition(Yslicer, patchi, facei); const typename BaseThermo::mixtureType::thermoMixtureType& thermoMixture = this->thermoMixture(composition); @@ -146,7 +149,8 @@ void Foam::SolidThermo::calculate() { forAll(pT, facei) { - auto composition = this->patchFaceComposition(patchi, facei); + auto composition = + this->patchFaceComposition(Yslicer, patchi, facei); const typename BaseThermo::mixtureType::thermoMixtureType& thermoMixture = this->thermoMixture(composition);