reactingEulerFoam/phaseSystems: Rationalised the handling of continuity error compensation

Updated the continuity error compensation term in the face momentum formulation
so that separate flow and source continuity errors are combined into a single
term.
This commit is contained in:
Henry Weller
2020-02-18 17:24:33 +00:00
parent 7f36cf7feb
commit 5ce2130f1a
7 changed files with 47 additions and 101 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2019-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -194,8 +194,8 @@ void Foam::diameterModels::shapeModels::fractal::correct()
{
const sizeGroup& fi = sizeGroup_;
const phaseModel& phase = fi.phase();
const volScalarField& alpha = fi.phase();
const volScalarField& rho = fi.phase().thermo().rho();
const volScalarField& alpha = phase;
const volScalarField& rho = phase.thermo().rho();
const populationBalanceModel& popBal =
sizeGroup_.mesh().lookupObject<populationBalanceModel>
@ -214,10 +214,22 @@ void Foam::diameterModels::shapeModels::fractal::correct()
fvc::ddt(alpha, rho, fi)*kappa_.oldTime()
+ alpha*rho*fi*fvm::ddt(kappa_)
+ fvm::div(fAlphaRhoPhi, kappa_)
+ fvm::SuSp(- phase.continuityErrorFlow()*fi, kappa_)
+ fvm::SuSp(-phase.continuityError()*fi, kappa_)
+ fvm::SuSp
(
fi.VelocityGroup().dmdt()*fi,
(
fi.VelocityGroup().dmdt()
// Temporary term pending update of continuityError
- (
phase.fluid().fvOptions()
(
alpha,
const_cast<volScalarField&>(rho)
) & rho
)
)
*fi,
kappa_
)
==

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2015-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -179,22 +179,11 @@ Foam::MovingPhaseModel<BasePhaseModel>::MovingPhaseModel
*this
)
),
continuityErrorFlow_
continuityError_
(
IOobject
(
IOobject::groupName("continuityErrorFlow", this->name()),
fluid.mesh().time().timeName(),
fluid.mesh()
),
fluid.mesh(),
dimensionedScalar(dimDensity/dimTime, 0)
),
continuityErrorSources_
(
IOobject
(
IOobject::groupName("continuityErrorSources", this->name()),
IOobject::groupName("continuityError", this->name()),
fluid.mesh().time().timeName(),
fluid.mesh()
),
@ -219,13 +208,13 @@ Foam::MovingPhaseModel<BasePhaseModel>::~MovingPhaseModel()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class BasePhaseModel>
void Foam::MovingPhaseModel<BasePhaseModel>::correctContinuityErrors()
void Foam::MovingPhaseModel<BasePhaseModel>::correctContinuityError()
{
volScalarField& rho = this->thermoRef().rho();
continuityErrorFlow_ = fvc::ddt(*this, rho) + fvc::div(alphaRhoPhi_);
continuityErrorSources_ = - (this->fluid().fvOptions()(*this, rho)&rho);
continuityError_ =
fvc::ddt(*this, rho) + fvc::div(alphaRhoPhi_)
- (this->fluid().fvOptions()(*this, rho)&rho);
}
@ -234,7 +223,7 @@ void Foam::MovingPhaseModel<BasePhaseModel>::correct()
{
BasePhaseModel::correct();
this->fluid().MRF().correctBoundaryVelocity(U_);
correctContinuityErrors();
correctContinuityError();
}
@ -266,7 +255,7 @@ void Foam::MovingPhaseModel<BasePhaseModel>::correctKinematics()
template<class BasePhaseModel>
void Foam::MovingPhaseModel<BasePhaseModel>::correctThermo()
{
correctContinuityErrors();
correctContinuityError();
}
@ -306,7 +295,7 @@ Foam::MovingPhaseModel<BasePhaseModel>::UEqn()
(
fvm::ddt(alpha, rho, U_)
+ fvm::div(alphaRhoPhi_, U_)
+ fvm::SuSp(- this->continuityError(), U_)
+ fvm::SuSp(-this->continuityError(), U_)
+ this->fluid().MRF().DDt(alpha*rho, U_)
+ turbulence_->divDevRhoReff(U_)
);
@ -325,8 +314,7 @@ Foam::MovingPhaseModel<BasePhaseModel>::UfEqn()
return
(
fvm::div(alphaRhoPhi_, U_)
- fvm::Sp(fvc::div(alphaRhoPhi_), U_)
+ fvm::SuSp(- this->continuityErrorSources(), U_)
+ fvm::SuSp(fvc::ddt(*this, rho) - this->continuityError(), U_)
+ this->fluid().MRF().DDt(alpha*rho, U_)
+ turbulence_->divDevRhoReff(U_)
);
@ -427,23 +415,7 @@ template<class BasePhaseModel>
Foam::tmp<Foam::volScalarField>
Foam::MovingPhaseModel<BasePhaseModel>::continuityError() const
{
return continuityErrorFlow_ + continuityErrorSources_;
}
template<class BasePhaseModel>
Foam::tmp<Foam::volScalarField>
Foam::MovingPhaseModel<BasePhaseModel>::continuityErrorFlow() const
{
return continuityErrorFlow_;
}
template<class BasePhaseModel>
Foam::tmp<Foam::volScalarField>
Foam::MovingPhaseModel<BasePhaseModel>::continuityErrorSources() const
{
return continuityErrorSources_;
return continuityError_;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2015-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -89,11 +89,8 @@ protected:
//- Turbulence model
autoPtr<phaseCompressibleTurbulenceModel> turbulence_;
//- Continuity error due to the flow
volScalarField continuityErrorFlow_;
//- Continuity error due to any sources
volScalarField continuityErrorSources_;
//- Continuity error
volScalarField continuityError_;
//- Kinetic Energy
mutable tmp<volScalarField> K_;
@ -106,8 +103,8 @@ private:
//- Calculate and return the flux field
tmp<surfaceScalarField> phi(const volVectorField& U) const;
//- Correct the continuity errors
void correctContinuityErrors();
//- Correct the continuity error
void correctContinuityError();
public:
@ -188,12 +185,6 @@ public:
//- Return the continuity error
virtual tmp<volScalarField> continuityError() const;
//- Return the continuity error due to the flow field
virtual tmp<volScalarField> continuityErrorFlow() const;
//- Return the continuity error due to any sources
virtual tmp<volScalarField> continuityErrorSources() const;
//- Return the phase kinetic energy
virtual tmp<volScalarField> K() const;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2015-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -218,32 +218,6 @@ Foam::StationaryPhaseModel<BasePhaseModel>::continuityError() const
}
template<class BasePhaseModel>
Foam::tmp<Foam::volScalarField>
Foam::StationaryPhaseModel<BasePhaseModel>::continuityErrorFlow() const
{
return volScalarField::New
(
IOobject::groupName("continuityErrorFlow", this->name()),
this->mesh(),
dimensionedScalar(dimDensity/dimTime, 0)
);
}
template<class BasePhaseModel>
Foam::tmp<Foam::volScalarField>
Foam::StationaryPhaseModel<BasePhaseModel>::continuityErrorSources() const
{
return volScalarField::New
(
IOobject::groupName("continuityErrorSources", this->name()),
this->mesh(),
dimensionedScalar(dimDensity/dimTime, 0)
);
}
template<class BasePhaseModel>
Foam::tmp<Foam::volScalarField>
Foam::StationaryPhaseModel<BasePhaseModel>::K() const

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2015-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -120,12 +120,6 @@ public:
//- Return the continuity error
virtual tmp<volScalarField> continuityError() const;
//- Return the continuity error due to the flow field
virtual tmp<volScalarField> continuityErrorFlow() const;
//- Return the continuity error due to any sources
virtual tmp<volScalarField> continuityErrorSources() const;
//- Return the phase kinetic energy
virtual tmp<volScalarField> K() const;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2015-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -315,12 +315,6 @@ public:
//- Return the continuity error
virtual tmp<volScalarField> continuityError() const = 0;
//- Return the continuity error due to the flow field
virtual tmp<volScalarField> continuityErrorFlow() const = 0;
//- Return the continuity error due to any sources
virtual tmp<volScalarField> continuityErrorSources() const = 0;
//- Return the phase kinetic energy
virtual tmp<volScalarField> K() const = 0;

View File

@ -1307,7 +1307,16 @@ void Foam::diameterModels::populationBalanceModel::solve()
+ fvm::SuSp
(
fi.VelocityGroup().dmdt()
- phase.continuityErrorFlow(),
- phase.continuityError()
// Temporary term pending update of continuityError
- (
phase.fluid().fvOptions()
(
alpha,
const_cast<volScalarField&>(rho)
) & rho
),
fi
)
==