diff --git a/src/combustionModels/EDC/EDC.C b/src/combustionModels/EDC/EDC.C index 3e728bc841..15325c432a 100644 --- a/src/combustionModels/EDC/EDC.C +++ b/src/combustionModels/EDC/EDC.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2017-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2017-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -58,7 +58,7 @@ Foam::combustionModels::EDC::EDC const word& combustionProperties ) : - laminar(modelType, thermo, turb, combustionProperties), + combustionModel(modelType, thermo, turb, combustionProperties), version_ ( EDCversionNames @@ -88,7 +88,8 @@ Foam::combustionModels::EDC::EDC ), this->mesh(), dimensionedScalar(dimless, 0) - ) + ), + chemistryPtr_(basicChemistryModel::New(thermo)) {} @@ -118,7 +119,7 @@ void Foam::combustionModels::EDC::correct() if (version_ == EDCversions::v2016) { - tmp ttc(this->chemistryPtr_->tc()); + tmp ttc(chemistryPtr_->tc()); const volScalarField& tc = ttc(); forAll(tauStar, i) @@ -187,14 +188,20 @@ void Foam::combustionModels::EDC::correct() } } - this->chemistryPtr_->solve(tauStar); + chemistryPtr_->solve(tauStar); } Foam::tmp Foam::combustionModels::EDC::R(volScalarField& Y) const { - return kappa_*laminar::R(Y); + tmp tSu(new fvScalarMatrix(Y, dimMass/dimTime)); + fvScalarMatrix& Su = tSu.ref(); + + const label specieI = this->thermo().composition().species()[Y.member()]; + Su += chemistryPtr_->RR(specieI); + + return kappa_*tSu; } @@ -204,14 +211,14 @@ Foam::combustionModels::EDC::Qdot() const return volScalarField::New ( this->thermo().phasePropertyName(typeName + ":Qdot"), - kappa_*this->chemistryPtr_->Qdot() + kappa_*chemistryPtr_->Qdot() ); } bool Foam::combustionModels::EDC::read() { - if (laminar::read()) + if (combustionModel::read()) { version_ = ( diff --git a/src/combustionModels/EDC/EDC.H b/src/combustionModels/EDC/EDC.H index 5cefb33912..80021454d5 100644 --- a/src/combustionModels/EDC/EDC.H +++ b/src/combustionModels/EDC/EDC.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2017-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2017-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -99,7 +99,9 @@ SourceFiles #ifndef EDC_H #define EDC_H -#include "../laminar/laminar.H" +#include "autoPtr.H" +#include "combustionModel.H" +#include "basicChemistryModel.H" #include "NamedEnum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -130,7 +132,7 @@ const scalar EDCexp2[] = {3, 3, 2, 2}; class EDC : - public laminar + public combustionModel { // Private Data @@ -147,6 +149,9 @@ class EDC //- Mixing parameter volScalarField kappa_; + //- Pointer to chemistry model + autoPtr chemistryPtr_; + public: diff --git a/src/combustionModels/Make/files b/src/combustionModels/Make/files index 96cdf4255a..7d71eee5a6 100644 --- a/src/combustionModels/Make/files +++ b/src/combustionModels/Make/files @@ -1,8 +1,6 @@ combustionModel/combustionModel.C combustionModel/combustionModelNew.C -chemistryCombustion/chemistryCombustion.C - singleStepCombustion/singleStepCombustion.C diffusion/diffusion.C diff --git a/src/combustionModels/PaSR/PaSR.C b/src/combustionModels/PaSR/PaSR.C index 3d1fd42e53..c7bb396d5e 100644 --- a/src/combustionModels/PaSR/PaSR.C +++ b/src/combustionModels/PaSR/PaSR.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -84,7 +84,7 @@ void Foam::combustionModels::PaSR::correct() tmp tmuEff(this->turbulence().muEff()); const scalarField& muEff = tmuEff(); - tmp ttc(this->tc()); + tmp ttc(this->chemistryPtr_->tc()); const scalarField& tc = ttc(); tmp trho(this->rho()); diff --git a/src/combustionModels/chemistryCombustion/chemistryCombustion.C b/src/combustionModels/chemistryCombustion/chemistryCombustion.C deleted file mode 100644 index 17dcffa46a..0000000000 --- a/src/combustionModels/chemistryCombustion/chemistryCombustion.C +++ /dev/null @@ -1,55 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2020 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "chemistryCombustion.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::combustionModels::chemistryCombustion::chemistryCombustion -( - const word& modelType, - const fluidReactionThermo& thermo, - const compressibleMomentumTransportModel& turb, - const word& combustionProperties -) -: - combustionModel - ( - modelType, - thermo, - turb, - combustionProperties - ), - chemistryPtr_(basicChemistryModel::New(thermo)) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::combustionModels::chemistryCombustion::~chemistryCombustion() -{} - - -// ************************************************************************* // diff --git a/src/combustionModels/chemistryCombustion/chemistryCombustion.H b/src/combustionModels/chemistryCombustion/chemistryCombustion.H deleted file mode 100644 index 06776f3b93..0000000000 --- a/src/combustionModels/chemistryCombustion/chemistryCombustion.H +++ /dev/null @@ -1,99 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2020 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Class - Foam::ChemistryCombustion - -Description - Chemistry model wrapper for combustion models - -SourceFiles - ChemistryCombustion.C - -\*---------------------------------------------------------------------------*/ - -#ifndef chemistryCombustion_H -#define chemistryCombustion_H - -#include "autoPtr.H" -#include "combustionModel.H" -#include "basicChemistryModel.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace combustionModels -{ - -/*---------------------------------------------------------------------------*\ - class chemistryCombustion Declaration -\*---------------------------------------------------------------------------*/ - -class chemistryCombustion -: - public combustionModel -{ -protected: - - // Protected data - - //- Pointer to chemistry model - autoPtr chemistryPtr_; - - -public: - - // Constructors - - //- Construct from components and thermo - chemistryCombustion - ( - const word& modelType, - const fluidReactionThermo& thermo, - const compressibleMomentumTransportModel& turb, - const word& combustionProperties - ); - - - //- Destructor - virtual ~chemistryCombustion(); - - - // Member Functions - - //- Return const access to the chemistry - const basicChemistryModel& chemistry() const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace combustionModels -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/combustionModels/chemistryCombustion/chemistryCombustionI.H b/src/combustionModels/chemistryCombustion/chemistryCombustionI.H deleted file mode 100644 index dbfa120090..0000000000 --- a/src/combustionModels/chemistryCombustion/chemistryCombustionI.H +++ /dev/null @@ -1,35 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2020 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // - -const Foam::basicChemistryModel& -Foam::combustionModels::chemistryCombustion::chemistry() const -{ - return chemistryPtr_(); -} - - -// ************************************************************************* // diff --git a/src/combustionModels/laminar/laminar.C b/src/combustionModels/laminar/laminar.C index 430cc104b0..464f4053fb 100644 --- a/src/combustionModels/laminar/laminar.C +++ b/src/combustionModels/laminar/laminar.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -50,17 +50,27 @@ Foam::combustionModels::laminar::laminar const word& combustionProperties ) : - chemistryCombustion + combustionModel ( modelType, thermo, turb, combustionProperties ), + outerCorrect_ + ( + this->coeffs().lookupOrDefault("outerCorrect", false) + ), integrateReactionRate_ ( this->coeffs().lookupOrDefault("integrateReactionRate", true) - ) + ), + maxIntegrationTime_ + ( + this->coeffs().lookupOrDefault("maxIntegrationTime", vGreat) + ), + timeIndex_(-1), + chemistryPtr_(basicChemistryModel::New(thermo)) { if (integrateReactionRate_) { @@ -81,14 +91,13 @@ Foam::combustionModels::laminar::~laminar() // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // -Foam::tmp Foam::combustionModels::laminar::tc() const -{ - return this->chemistryPtr_->tc(); -} - - void Foam::combustionModels::laminar::correct() { + if (!outerCorrect_ && timeIndex_ == this->mesh().time().timeIndex()) + { + return; + } + if (integrateReactionRate_) { if (fv::localEulerDdt::enabled(this->mesh())) @@ -96,32 +105,21 @@ void Foam::combustionModels::laminar::correct() const scalarField& rDeltaT = fv::localEulerDdt::localRDeltaT(this->mesh()); - if (this->coeffs().found("maxIntegrationTime")) - { - const scalar maxIntegrationTime - ( - this->coeffs().template lookup("maxIntegrationTime") - ); - - this->chemistryPtr_->solve - ( - min(1.0/rDeltaT, maxIntegrationTime)() - ); - } - else - { - this->chemistryPtr_->solve((1.0/rDeltaT)()); - } + chemistryPtr_->solve(min(1/rDeltaT, maxIntegrationTime_)()); } else { - this->chemistryPtr_->solve(this->mesh().time().deltaTValue()); + const scalar deltaT = this->mesh().time().deltaTValue(); + + chemistryPtr_->solve(min(deltaT, maxIntegrationTime_)); } } else { - this->chemistryPtr_->calculate(); + chemistryPtr_->calculate(); } + + timeIndex_ = this->mesh().time().timeIndex(); } @@ -132,7 +130,7 @@ Foam::combustionModels::laminar::R(volScalarField& Y) const fvScalarMatrix& Su = tSu.ref(); const label specieI = this->thermo().composition().species()[Y.member()]; - Su += this->chemistryPtr_->RR(specieI); + Su += chemistryPtr_->RR(specieI); return tSu; } @@ -140,16 +138,20 @@ Foam::combustionModels::laminar::R(volScalarField& Y) const Foam::tmp Foam::combustionModels::laminar::Qdot() const { - return this->chemistryPtr_->Qdot(); + return chemistryPtr_->Qdot(); } bool Foam::combustionModels::laminar::read() { - if (chemistryCombustion::read()) + if (combustionModel::read()) { + outerCorrect_ = + this->coeffs().lookupOrDefault("outerCorrect", false); integrateReactionRate_ = this->coeffs().lookupOrDefault("integrateReactionRate", true); + maxIntegrationTime_ = + this->coeffs().lookupOrDefault("maxIntegrationTime", vGreat); return true; } else diff --git a/src/combustionModels/laminar/laminar.H b/src/combustionModels/laminar/laminar.H index d89bd736e0..e1fb8c23cc 100644 --- a/src/combustionModels/laminar/laminar.H +++ b/src/combustionModels/laminar/laminar.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,7 +35,9 @@ SourceFiles #ifndef laminar_H #define laminar_H -#include "chemistryCombustion.H" +#include "autoPtr.H" +#include "combustionModel.H" +#include "basicChemistryModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -50,21 +52,29 @@ namespace combustionModels class laminar : - public chemistryCombustion + public combustionModel { // Private Data + //- Run chemistry correction on every outer iteration. Default false. + bool outerCorrect_; + //- Integrate reaction rate over the time-step - // using the selected ODE solver + // using the selected ODE solver. Default true. bool integrateReactionRate_; + //- Maximum integration time permitted. Default vGreat. + scalar maxIntegrationTime_; + + //- The time index of the last correction + label timeIndex_; protected: - // Protected Member Functions + // Protected Data - //- Return the chemical time scale - tmp tc() const; + //- Pointer to chemistry model + autoPtr chemistryPtr_; public: diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.H b/src/thermophysicalModels/basic/basicThermo/basicThermo.H index ca178bc49d..b3154cdd84 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermo.H +++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -261,6 +261,9 @@ public: //- Density for patch [kg/m^3] virtual tmp rho(const label patchi) const = 0; + //- Old-time density [kg/m^3] + virtual tmp rho0() const = 0; + //- Enthalpy/Internal energy [J/kg] // Non-const access allowed for transport equations virtual volScalarField& he() = 0; diff --git a/src/thermophysicalModels/basic/psiThermo/psiThermo.C b/src/thermophysicalModels/basic/psiThermo/psiThermo.C index 2312d4a004..ccfe8f0744 100644 --- a/src/thermophysicalModels/basic/psiThermo/psiThermo.C +++ b/src/thermophysicalModels/basic/psiThermo/psiThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -115,6 +115,12 @@ Foam::tmp Foam::psiThermo::implementation::rho } +Foam::tmp Foam::psiThermo::implementation::rho0() const +{ + return p().oldTime()*psi_.oldTime(); +} + + const Foam::volScalarField& Foam::psiThermo::implementation::psi() const { return psi_; diff --git a/src/thermophysicalModels/basic/psiThermo/psiThermo.H b/src/thermophysicalModels/basic/psiThermo/psiThermo.H index 0d584b1d95..33f3df4a27 100644 --- a/src/thermophysicalModels/basic/psiThermo/psiThermo.H +++ b/src/thermophysicalModels/basic/psiThermo/psiThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -108,6 +108,9 @@ public: //- Density for patch [kg/m^3] virtual tmp rho(const label patchi) const = 0; + //- Old-time density [kg/m^3] + virtual tmp rho0() const = 0; + //- Compressibility [s^2/m^2] virtual const volScalarField& psi() const = 0; @@ -168,6 +171,9 @@ public: //- Density for patch [kg/m^3] virtual tmp rho(const label patchi) const; + //- Old-time density [kg/m^3] + virtual tmp rho0() const; + //- Compressibility [s^2/m^2] virtual const volScalarField& psi() const; diff --git a/src/thermophysicalModels/basic/rhoThermo/rhoThermo.C b/src/thermophysicalModels/basic/rhoThermo/rhoThermo.C index 085a0f38e3..d5c34a93a2 100644 --- a/src/thermophysicalModels/basic/rhoThermo/rhoThermo.C +++ b/src/thermophysicalModels/basic/rhoThermo/rhoThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -182,6 +182,12 @@ Foam::volScalarField& Foam::rhoThermo::implementation::rho() } +Foam::tmp Foam::rhoThermo::implementation::rho0() const +{ + return rho_.oldTime(); +} + + void Foam::rhoThermo::implementation::correctRho(const volScalarField& deltaRho) { rho_ += deltaRho; diff --git a/src/thermophysicalModels/basic/rhoThermo/rhoThermo.H b/src/thermophysicalModels/basic/rhoThermo/rhoThermo.H index d8c1afea51..6fe8f80465 100644 --- a/src/thermophysicalModels/basic/rhoThermo/rhoThermo.H +++ b/src/thermophysicalModels/basic/rhoThermo/rhoThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -107,6 +107,9 @@ public: //- Return non-const access to the local density field [kg/m^3] virtual volScalarField& rho() = 0; + //- Old-time density [kg/m^3] + virtual tmp rho0() const = 0; + //- Add the given density correction to the density field. // Used to update the density field following pressure solution virtual void correctRho(const volScalarField& deltaRho) = 0; @@ -179,6 +182,9 @@ public: //- Return non-const access to the local density field [kg/m^3] virtual volScalarField& rho(); + //- Old-time density [kg/m^3] + virtual tmp rho0() const; + //- Add the given density correction to the density field. // Used to update the density field following pressure solution virtual void correctRho(const volScalarField& deltaRho); diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/StandardChemistryModel/StandardChemistryModel.C b/src/thermophysicalModels/chemistryModel/chemistryModel/StandardChemistryModel/StandardChemistryModel.C index 5e4d4c8bd7..cc2ddcfca6 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/StandardChemistryModel/StandardChemistryModel.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/StandardChemistryModel/StandardChemistryModel.C @@ -503,11 +503,11 @@ Foam::scalar Foam::StandardChemistryModel::solve return deltaTMin; } - tmp trho(this->thermo().rho()); + tmp trho(this->thermo().rho0()); const scalarField& rho = trho(); - const scalarField& T = this->thermo().T(); - const scalarField& p = this->thermo().p(); + const scalarField& T = this->thermo().T().oldTime(); + const scalarField& p = this->thermo().p().oldTime(); reactionEvaluationScope scope(*this); @@ -524,7 +524,7 @@ Foam::scalar Foam::StandardChemistryModel::solve for (label i=0; i::solve return deltaTMin; } - const volScalarField rho - ( - IOobject - ( - "rho", - this->time().timeName(), - this->mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE, - false - ), - this->thermo().rho() - ); + tmp trho(this->thermo().rho0()); + const scalarField& rho = trho(); - const scalarField& T = this->thermo().T(); - const scalarField& p = this->thermo().p(); + const scalarField& T = this->thermo().T().oldTime(); + const scalarField& p = this->thermo().p().oldTime(); scalarField c(this->nSpecie_); scalarField c0(this->nSpecie_); @@ -608,9 +597,10 @@ Foam::scalar Foam::TDACChemistryModel::solve for (label i=0; inSpecie_; i++) { - c[i] = rhoi*this->Y_[i][celli]/this->specieThermos_[i].W(); + c[i] = + rhoi*this->Y_[i].oldTime()[celli]/this->specieThermos_[i].W(); c0[i] = c[i]; - phiq[i] = this->Y()[i][celli]; + phiq[i] = this->Y()[i].oldTime()[celli]; } phiq[this->nSpecie()] = Ti; phiq[this->nSpecie() + 1] = pi; diff --git a/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.C b/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.C index 4a7661c81d..451645c7c8 100644 --- a/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.C +++ b/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -163,4 +163,10 @@ Foam::volScalarField& Foam::solidThermo::implementation::rho() } +Foam::tmp Foam::solidThermo::implementation::rho0() const +{ + return rho_.oldTime(); +} + + // ************************************************************************* // diff --git a/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.H b/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.H index 2a76b9d07f..d282440ddc 100644 --- a/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.H +++ b/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -124,6 +124,9 @@ public: //- Return non-const access to the local density field [kg/m^3] virtual volScalarField& rho() = 0; + //- Old-time density [kg/m^3] + virtual tmp rho0() const = 0; + //- Return true if thermal conductivity is isotropic virtual bool isotropic() const = 0; @@ -201,6 +204,9 @@ public: //- Return non-const access to the local density field [kg/m^3] virtual volScalarField& rho(); + + //- Old-time density [kg/m^3] + virtual tmp rho0() const; };