From 5ce2130f1a6806dafd2abfdd70ef58123767b7a2 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Tue, 18 Feb 2020 17:24:33 +0000 Subject: [PATCH] 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. --- .../sizeGroup/shapeModels/fractal/fractal.C | 22 ++++++-- .../MovingPhaseModel/MovingPhaseModel.C | 52 +++++-------------- .../MovingPhaseModel/MovingPhaseModel.H | 19 ++----- .../StationaryPhaseModel.C | 28 +--------- .../StationaryPhaseModel.H | 8 +-- .../phaseModel/phaseModel/phaseModel.H | 8 +-- .../populationBalanceModel.C | 11 +++- 7 files changed, 47 insertions(+), 101 deletions(-) diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/velocityGroup/sizeGroup/shapeModels/fractal/fractal.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/velocityGroup/sizeGroup/shapeModels/fractal/fractal.C index 8daaa854f5..3b971c0e06 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/velocityGroup/sizeGroup/shapeModels/fractal/fractal.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/velocityGroup/sizeGroup/shapeModels/fractal/fractal.C @@ -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 @@ -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(rho) + ) & rho + ) + ) + *fi, kappa_ ) == diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C index 8b2069d677..b22551d81e 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C @@ -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::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::~MovingPhaseModel() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -void Foam::MovingPhaseModel::correctContinuityErrors() +void Foam::MovingPhaseModel::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::correct() { BasePhaseModel::correct(); this->fluid().MRF().correctBoundaryVelocity(U_); - correctContinuityErrors(); + correctContinuityError(); } @@ -266,7 +255,7 @@ void Foam::MovingPhaseModel::correctKinematics() template void Foam::MovingPhaseModel::correctThermo() { - correctContinuityErrors(); + correctContinuityError(); } @@ -306,7 +295,7 @@ Foam::MovingPhaseModel::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::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 Foam::tmp Foam::MovingPhaseModel::continuityError() const { - return continuityErrorFlow_ + continuityErrorSources_; -} - - -template -Foam::tmp -Foam::MovingPhaseModel::continuityErrorFlow() const -{ - return continuityErrorFlow_; -} - - -template -Foam::tmp -Foam::MovingPhaseModel::continuityErrorSources() const -{ - return continuityErrorSources_; + return continuityError_; } diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.H index 546b62da3f..d74a72ecb6 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.H @@ -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 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 K_; @@ -106,8 +103,8 @@ private: //- Calculate and return the flux field tmp 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 continuityError() const; - //- Return the continuity error due to the flow field - virtual tmp continuityErrorFlow() const; - - //- Return the continuity error due to any sources - virtual tmp continuityErrorSources() const; - //- Return the phase kinetic energy virtual tmp K() const; diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/StationaryPhaseModel/StationaryPhaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/StationaryPhaseModel/StationaryPhaseModel.C index 7c6e9c3683..8d46f4cf8e 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/StationaryPhaseModel/StationaryPhaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/StationaryPhaseModel/StationaryPhaseModel.C @@ -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::continuityError() const } -template -Foam::tmp -Foam::StationaryPhaseModel::continuityErrorFlow() const -{ - return volScalarField::New - ( - IOobject::groupName("continuityErrorFlow", this->name()), - this->mesh(), - dimensionedScalar(dimDensity/dimTime, 0) - ); -} - - -template -Foam::tmp -Foam::StationaryPhaseModel::continuityErrorSources() const -{ - return volScalarField::New - ( - IOobject::groupName("continuityErrorSources", this->name()), - this->mesh(), - dimensionedScalar(dimDensity/dimTime, 0) - ); -} - - template Foam::tmp Foam::StationaryPhaseModel::K() const diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/StationaryPhaseModel/StationaryPhaseModel.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/StationaryPhaseModel/StationaryPhaseModel.H index 6279e0cefc..0a8e566154 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/StationaryPhaseModel/StationaryPhaseModel.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/StationaryPhaseModel/StationaryPhaseModel.H @@ -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 continuityError() const; - //- Return the continuity error due to the flow field - virtual tmp continuityErrorFlow() const; - - //- Return the continuity error due to any sources - virtual tmp continuityErrorSources() const; - //- Return the phase kinetic energy virtual tmp K() const; diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.H index 8738d68b2b..e676fabc8b 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.H @@ -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 continuityError() const = 0; - //- Return the continuity error due to the flow field - virtual tmp continuityErrorFlow() const = 0; - - //- Return the continuity error due to any sources - virtual tmp continuityErrorSources() const = 0; - //- Return the phase kinetic energy virtual tmp K() const = 0; diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/populationBalanceModel/populationBalanceModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/populationBalanceModel/populationBalanceModel.C index 438ea9db76..0c58d3c13d 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/populationBalanceModel/populationBalanceModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/populationBalanceModel/populationBalanceModel.C @@ -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(rho) + ) & rho + ), fi ) ==