INT: reacting*EulerFoam: correct handling of K for energy equation (#2033)

This commit is contained in:
Kutalmis Bercin
2021-03-26 17:40:30 +00:00
committed by Andrew Heather
parent ef0786cca0
commit ded81f4e65
4 changed files with 30 additions and 32 deletions

View File

@ -5,8 +5,8 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2015-2018 OpenFOAM Foundation Copyright (C) 2015-2021 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd. Copyright (C) 2020-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -70,13 +70,6 @@ Foam::AnisothermalPhaseModel<BasePhaseModel>::AnisothermalPhaseModel
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class BasePhaseModel>
Foam::AnisothermalPhaseModel<BasePhaseModel>::~AnisothermalPhaseModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class BasePhaseModel> template<class BasePhaseModel>
@ -100,23 +93,32 @@ Foam::tmp<Foam::fvScalarMatrix>
Foam::AnisothermalPhaseModel<BasePhaseModel>::heEqn() Foam::AnisothermalPhaseModel<BasePhaseModel>::heEqn()
{ {
const volScalarField& alpha = *this; const volScalarField& alpha = *this;
const volScalarField& rho = this->rho();
const volVectorField U(this->U()); const tmp<volVectorField> tU(this->U());
const surfaceScalarField alphaPhi(this->alphaPhi()); const volVectorField& U(tU());
const surfaceScalarField alphaRhoPhi(this->alphaRhoPhi());
const volScalarField contErr(this->continuityError()); const tmp<surfaceScalarField> talphaPhi(this->alphaPhi());
const volScalarField K(this->K()); const surfaceScalarField& alphaPhi(talphaPhi());
const tmp<surfaceScalarField> talphaRhoPhi(this->alphaRhoPhi());
const surfaceScalarField& alphaRhoPhi(talphaRhoPhi());
const tmp<volScalarField> tcontErr(this->continuityError());
const volScalarField& contErr(tcontErr());
tmp<volScalarField> tK(this->K());
const volScalarField& K(tK());
volScalarField& he = this->thermo_->he(); volScalarField& he = this->thermo_->he();
tmp<fvScalarMatrix> tEEqn tmp<fvScalarMatrix> tEEqn
( (
fvm::ddt(alpha, this->rho(), he) fvm::ddt(alpha, rho, he)
+ fvm::div(alphaRhoPhi, he) + fvm::div(alphaRhoPhi, he)
- fvm::Sp(contErr, he) - fvm::Sp(contErr, he)
+ fvc::ddt(alpha, this->rho(), K) + fvc::div(alphaRhoPhi, K) + fvc::ddt(alpha, rho, K) + fvc::div(alphaRhoPhi, K)
- contErr*K - contErr*K
- fvm::laplacian - fvm::laplacian
@ -135,7 +137,7 @@ Foam::AnisothermalPhaseModel<BasePhaseModel>::heEqn()
tEEqn.ref() += filterPressureWork tEEqn.ref() += filterPressureWork
( (
fvc::div(fvc::absolute(alphaPhi, alpha, U), this->thermo().p()) fvc::div(fvc::absolute(alphaPhi, alpha, U), this->thermo().p())
+ this->thermo().p()*fvc::ddt(alpha) + (fvc::ddt(alpha) - contErr/rho)*this->thermo().p()
); );
} }
else if (this->thermo_->dpdt()) else if (this->thermo_->dpdt())

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2015-2018 OpenFOAM Foundation Copyright (C) 2015-2018 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -54,7 +55,7 @@ class AnisothermalPhaseModel
: :
public BasePhaseModel public BasePhaseModel
{ {
// Private member functions // Private Member Functions
//- Optionally filter the pressure work term as the phase-fraction -> 0 //- Optionally filter the pressure work term as the phase-fraction -> 0
tmp<volScalarField> filterPressureWork tmp<volScalarField> filterPressureWork
@ -67,6 +68,7 @@ public:
// Constructors // Constructors
//- Construct from phase system and phase name
AnisothermalPhaseModel AnisothermalPhaseModel
( (
const phaseSystem& fluid, const phaseSystem& fluid,
@ -76,7 +78,7 @@ public:
//- Destructor //- Destructor
virtual ~AnisothermalPhaseModel(); virtual ~AnisothermalPhaseModel() = default;
// Member Functions // Member Functions

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2015-2018 OpenFOAM Foundation Copyright (C) 2015-2021 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd. Copyright (C) 2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -212,13 +212,6 @@ Foam::MovingPhaseModel<BasePhaseModel>::MovingPhaseModel
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class BasePhaseModel>
Foam::MovingPhaseModel<BasePhaseModel>::~MovingPhaseModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class BasePhaseModel> template<class BasePhaseModel>
@ -255,8 +248,7 @@ void Foam::MovingPhaseModel<BasePhaseModel>::correctKinematics()
if (K_.valid()) if (K_.valid())
{ {
K_.clear(); K_.ref() = 0.5*magSqr(this->U());
K();
} }
} }

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2015-2018 OpenFOAM Foundation Copyright (C) 2015-2018 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -65,7 +66,7 @@ class MovingPhaseModel
{ {
protected: protected:
// Protected data // Protected Data
//- Velocity field //- Velocity field
volVectorField U_; volVectorField U_;
@ -103,7 +104,7 @@ protected:
private: private:
// Private static member functions // Private Member Functions
//- Calculate and return the flux field //- Calculate and return the flux field
tmp<surfaceScalarField> phi(const volVectorField& U) const; tmp<surfaceScalarField> phi(const volVectorField& U) const;
@ -113,6 +114,7 @@ public:
// Constructors // Constructors
//- Construct from phase system and phase name
MovingPhaseModel MovingPhaseModel
( (
const phaseSystem& fluid, const phaseSystem& fluid,
@ -122,7 +124,7 @@ public:
//- Destructor //- Destructor
virtual ~MovingPhaseModel(); virtual ~MovingPhaseModel() = default;
// Member Functions // Member Functions