From 27b92bb2f623782415f29446fd1f1fb44159b94e Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Thu, 11 Feb 2021 10:42:30 +0000 Subject: [PATCH] multiphaseEulerFoam/.../diameterModels: Removed caching The previous changes to reactions mean that caching the surface area density field is no longer necessary. The diameter models have had their caching functionality removed, which has simplified both the implementation and the user interface. --- .../phaseSystems/diameterModels/IATE/IATE.C | 30 +++-- .../phaseSystems/diameterModels/IATE/IATE.H | 25 ++-- .../constantDiameter/constantDiameter.C | 26 ++-- .../constantDiameter/constantDiameter.H | 15 +-- .../diameterModel/diameterModel.C | 116 +----------------- .../diameterModel/diameterModel.H | 36 +----- .../isothermalDiameter/isothermalDiameter.C | 32 +++-- .../isothermalDiameter/isothermalDiameter.H | 19 ++- .../linearTsubDiameter/linearTsubDiameter.C | 32 +++-- .../linearTsubDiameter/linearTsubDiameter.H | 19 ++- .../sphericalDiameter/sphericalDiameter.C | 19 ++- .../sphericalDiameter/sphericalDiameter.H | 17 ++- .../velocityGroup/velocityGroup.C | 74 +++++------ .../velocityGroup/velocityGroup.H | 25 ++-- 14 files changed, 163 insertions(+), 322 deletions(-) diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/IATE/IATE.C b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/IATE/IATE.C index a09fec1232..7b300f2e48 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/IATE/IATE.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/IATE/IATE.C @@ -48,17 +48,11 @@ namespace diameterModels } -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // -Foam::tmp Foam::diameterModels::IATE::calcD() const +Foam::tmp Foam::diameterModels::IATE::dsm() const { - return d_; -} - - -Foam::tmp Foam::diameterModels::IATE::calcA() const -{ - return phase()*kappai_; + return max(6/max(kappai_, 6/dMax_), dMin_); } @@ -86,11 +80,9 @@ Foam::diameterModels::IATE::IATE dMax_("dMax", dimLength, diameterProperties), dMin_("dMin", dimLength, diameterProperties), residualAlpha_("residualAlpha", dimless, diameterProperties), - d_(dRef()), + d_(IOobject::groupName("d", phase.name()), dsm()), sources_(diameterProperties.lookup("sources"), IATEsource::iNew(*this)) -{ - d_ = dsm(); -} +{} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // @@ -101,13 +93,19 @@ Foam::diameterModels::IATE::~IATE() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -Foam::tmp Foam::diameterModels::IATE::dsm() const +Foam::tmp Foam::diameterModels::IATE::d() const { - return max(6/max(kappai_, 6/dMax_), dMin_); + return d_; } -void Foam::diameterModels::IATE::correctNoStore() +Foam::tmp Foam::diameterModels::IATE::a() const +{ + return phase()*kappai_; +} + + +void Foam::diameterModels::IATE::correct() { volScalarField alphaAv ( diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/IATE/IATE.H b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/IATE/IATE.H index 34b00071f7..fb46d02be9 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/IATE/IATE.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/IATE/IATE.H @@ -83,7 +83,7 @@ class IATE dimensionedScalar residualAlpha_; //- The Sauter-mean diameter of the phase - volScalarField& d_; + volScalarField d_; //- IATE sources PtrList sources_; @@ -94,17 +94,6 @@ class IATE tmp dsm() const; -protected: - - // Protected Member Functions - - //- Get the diameter field - virtual tmp calcD() const; - - //- Get the surface area per unit volume field - virtual tmp calcA() const; - - public: friend class IATEsource; @@ -115,7 +104,7 @@ public: // Constructors - //- Construct from components + //- Construct from dictionary and phase IATE ( const dictionary& diameterProperties, @@ -135,8 +124,14 @@ public: return kappai_; } - //- Correct the diameter field - virtual void correctNoStore(); + //- Get the diameter field + virtual tmp d() const; + + //- Get the surface area per unit volume field + virtual tmp a() const; + + //- Correct the model + virtual void correct(); //- Read phaseProperties dictionary virtual bool read(const dictionary& phaseProperties); diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/constantDiameter/constantDiameter.C b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/constantDiameter/constantDiameter.C index b94ccb838f..6508cbc4fd 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/constantDiameter/constantDiameter.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/constantDiameter/constantDiameter.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 @@ -38,19 +38,6 @@ namespace diameterModels } -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // - -Foam::tmp Foam::diameterModels::constant::calcD() const -{ - return volScalarField::New - ( - IOobject::groupName("d", phase().name()), - phase().mesh(), - d_ - ); -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::diameterModels::constant::constant @@ -72,6 +59,17 @@ Foam::diameterModels::constant::~constant() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +Foam::tmp Foam::diameterModels::constant::d() const +{ + return volScalarField::New + ( + IOobject::groupName("d", phase().name()), + phase().mesh(), + d_ + ); +} + + bool Foam::diameterModels::constant::read(const dictionary& phaseProperties) { spherical::read(phaseProperties); diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/constantDiameter/constantDiameter.H b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/constantDiameter/constantDiameter.H index 99be5ef8c0..1b089c9bdf 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/constantDiameter/constantDiameter.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/constantDiameter/constantDiameter.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 @@ -58,14 +58,6 @@ class constant dimensionedScalar d_; -protected: - - // Protected Member Functions - - //- Get the diameter field - virtual tmp calcD() const; - - public: //- Runtime type information @@ -74,7 +66,7 @@ public: // Constructors - //- Construct from components + //- Construct from dictionary and phase constant ( const dictionary& diameterProperties, @@ -88,6 +80,9 @@ public: // Member Functions + //- Get the diameter field + virtual tmp d() const; + //- Read diameterProperties dictionary virtual bool read(const dictionary& diameterProperties); }; diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/diameterModel/diameterModel.C b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/diameterModel/diameterModel.C index 31050065d1..f5e3ff0fa6 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/diameterModel/diameterModel.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/diameterModel/diameterModel.C @@ -34,56 +34,6 @@ namespace Foam } -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // - -Foam::volScalarField& Foam::diameterModel::dRef() -{ - if (!dPtr_.valid()) - { - dPtr_.reset - ( - new volScalarField - ( - IOobject - ( - IOobject::groupName("d", phase_.name()), - phase_.time().timeName(), - phase_.mesh() - ), - phase_.mesh(), - dimensionedScalar(dimLength, 0) - ) - ); - } - - return dPtr_(); -} - - -Foam::volScalarField& Foam::diameterModel::aRef() -{ - if (!aPtr_.valid()) - { - aPtr_.reset - ( - new volScalarField - ( - IOobject - ( - IOobject::groupName("a", phase_.name()), - phase_.time().timeName(), - phase_.mesh() - ), - phase_.mesh(), - dimensionedScalar(dimless/dimLength, 0) - ) - ); - } - - return aPtr_(); -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::diameterModel::diameterModel @@ -93,19 +43,8 @@ Foam::diameterModel::diameterModel ) : diameterProperties_(diameterProperties), - phase_(phase), - dPtr_(nullptr), - aPtr_(nullptr) -{ - if (diameterProperties.lookupOrDefault("storeD", false)) - { - dRef(); - } - if (diameterProperties.lookupOrDefault("storeA", false)) - { - aRef(); - } -} + phase_(phase) +{} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // @@ -116,57 +55,8 @@ Foam::diameterModel::~diameterModel() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -Foam::tmp Foam::diameterModel::d() const -{ - if (dPtr_.valid()) - { - return dPtr_(); - } - else - { - return calcD(); - } -} - - -Foam::tmp Foam::diameterModel::a() const -{ - if (aPtr_.valid()) - { - return aPtr_(); - } - else - { - return calcA(); - } -} - - -void Foam::diameterModel::correctNoStore() -{} - - void Foam::diameterModel::correct() -{ - correctNoStore(); - - if (dPtr_.valid()) - { - tmp td = calcD(); - if (td.isTmp()) - { - dPtr_() = td; - } - } - if (aPtr_.valid()) - { - tmp tA = calcA(); - if (tA.isTmp()) - { - aPtr_() = tA; - } - } -} +{} bool Foam::diameterModel::read(const dictionary& phaseProperties) diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/diameterModel/diameterModel.H b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/diameterModel/diameterModel.H index 321bc3f1e7..c24a33d7b4 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/diameterModel/diameterModel.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/diameterModel/diameterModel.H @@ -59,29 +59,6 @@ class diameterModel //- The phase that this model applies const phaseModel& phase_; - //- Optionally stored diameter field - autoPtr dPtr_; - - //- Optionally stored surface area per unit volume field - autoPtr aPtr_; - - -protected: - - // Access - - //- Get a reference to the stored diameter field - volScalarField& dRef(); - - //- Get a reference to the stored surface area per unit volume field - volScalarField& aRef(); - - //- Get the diameter field - virtual tmp calcD() const = 0; - - //- Get the surface area per unit volume field - virtual tmp calcA() const = 0; - public: @@ -106,6 +83,7 @@ public: // Constructors + //- Construct from dictionary and phase diameterModel ( const dictionary& diameterProperties, @@ -119,6 +97,7 @@ public: // Selectors + //- Select from dictionary and phase static autoPtr New ( const dictionary& diameterProperties, @@ -141,16 +120,13 @@ public: } //- Return the diameter - tmp d() const; + virtual tmp d() const = 0; //- Return the surface area per unit volume - tmp a() const; + virtual tmp a() const = 0; - //- Correct the diameter field - virtual void correctNoStore(); - - //- Correct the diameter field and optionally store the results - void correct(); + //- Correct the model + virtual void correct(); //- Read phaseProperties dictionary virtual bool read(const dictionary& phaseProperties); diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/isothermalDiameter/isothermalDiameter.C b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/isothermalDiameter/isothermalDiameter.C index 1fcc6d1e0c..0052e92e30 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/isothermalDiameter/isothermalDiameter.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/isothermalDiameter/isothermalDiameter.C @@ -38,14 +38,6 @@ namespace diameterModels } -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // - -Foam::tmp Foam::diameterModels::isothermal::calcD() const -{ - return d_; -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::diameterModels::isothermal::isothermal @@ -57,10 +49,18 @@ Foam::diameterModels::isothermal::isothermal spherical(diameterProperties, phase), d0_("d0", dimLength, diameterProperties), p0_("p0", dimPressure, diameterProperties), - d_(dRef()) -{ - d_ = d0_; -} + d_ + ( + IOobject + ( + IOobject::groupName("d", phase.name()), + phase.time().timeName(), + phase.mesh() + ), + phase.mesh(), + d0_ + ) +{} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // @@ -71,7 +71,13 @@ Foam::diameterModels::isothermal::~isothermal() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::diameterModels::isothermal::correctNoStore() +Foam::tmp Foam::diameterModels::isothermal::d() const +{ + return d_; +} + + +void Foam::diameterModels::isothermal::correct() { const volScalarField& p = phase().db().lookupObject("p"); diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/isothermalDiameter/isothermalDiameter.H b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/isothermalDiameter/isothermalDiameter.H index 4e7dbe8a81..d93ebd3b75 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/isothermalDiameter/isothermalDiameter.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/isothermalDiameter/isothermalDiameter.H @@ -61,15 +61,7 @@ class isothermal dimensionedScalar p0_; //- Diameter field - volScalarField& d_; - - -protected: - - // Protected Member Functions - - //- Get the diameter field - virtual tmp calcD() const; + volScalarField d_; public: @@ -80,7 +72,7 @@ public: // Constructors - //- Construct from components + //- Construct from dictionary and phase isothermal ( const dictionary& diameterProperties, @@ -94,8 +86,11 @@ public: // Member Functions - //- Correct the diameter field - virtual void correctNoStore(); + //- Get the diameter field + virtual tmp d() const; + + //- Correct the model + virtual void correct(); //- Read phaseProperties dictionary virtual bool read(const dictionary& phaseProperties); diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/linearTsubDiameter/linearTsubDiameter.C b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/linearTsubDiameter/linearTsubDiameter.C index 2b0957d0e9..8006794613 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/linearTsubDiameter/linearTsubDiameter.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/linearTsubDiameter/linearTsubDiameter.C @@ -40,14 +40,6 @@ namespace diameterModels } -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // - -Foam::tmp Foam::diameterModels::linearTsub::calcD() const -{ - return d_; -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::diameterModels::linearTsub::linearTsub @@ -77,10 +69,18 @@ Foam::diameterModels::linearTsub::linearTsub dimTemperature, diameterProperties.lookupOrDefault("Tsub1", 13.5) ), - d_(dRef()) -{ - d_ = d1_; -} + d_ + ( + IOobject + ( + IOobject::groupName("d", phase.name()), + phase.time().timeName(), + phase.mesh() + ), + phase.mesh(), + d1_ + ) +{} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // @@ -91,7 +91,13 @@ Foam::diameterModels::linearTsub::~linearTsub() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::diameterModels::linearTsub::correctNoStore() +Foam::tmp Foam::diameterModels::linearTsub::d() const +{ + return d_; +} + + +void Foam::diameterModels::linearTsub::correct() { // Lookup the fluid model const phaseSystem& fluid = diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/linearTsubDiameter/linearTsubDiameter.H b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/linearTsubDiameter/linearTsubDiameter.H index 1caada6ffb..7dde11cd45 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/linearTsubDiameter/linearTsubDiameter.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/linearTsubDiameter/linearTsubDiameter.H @@ -81,15 +81,7 @@ class linearTsub dimensionedScalar Tsub1_; //- Diameter field - volScalarField& d_; - - -protected: - - // Protected Member Functions - - //- Get the diameter field - virtual tmp calcD() const; + volScalarField d_; public: @@ -100,7 +92,7 @@ public: // Constructors - //- Construct from components + //- Construct from dictionary and phase linearTsub ( const dictionary& diameterProperties, @@ -114,8 +106,11 @@ public: // Member Functions - //- Correct the diameter field - virtual void correctNoStore(); + //- Get the diameter field + virtual tmp d() const; + + //- Correct the model + virtual void correct(); //- Read phaseProperties dictionary virtual bool read(const dictionary& phaseProperties); diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/sphericalDiameter/sphericalDiameter.C b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/sphericalDiameter/sphericalDiameter.C index 67959d6964..b31d963f24 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/sphericalDiameter/sphericalDiameter.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/sphericalDiameter/sphericalDiameter.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 @@ -37,15 +37,6 @@ namespace diameterModels } -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // - -Foam::tmp -Foam::diameterModels::spherical::calcA() const -{ - return 6*phase()/d(); -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::diameterModels::spherical::spherical @@ -58,6 +49,14 @@ Foam::diameterModels::spherical::spherical {} +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp Foam::diameterModels::spherical::a() const +{ + return 6*phase()/d(); +} + + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::diameterModels::spherical::~spherical() diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/sphericalDiameter/sphericalDiameter.H b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/sphericalDiameter/sphericalDiameter.H index 72b3a455bd..1247442d4a 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/sphericalDiameter/sphericalDiameter.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/sphericalDiameter/sphericalDiameter.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 @@ -53,14 +53,6 @@ class spherical : public diameterModel { -protected: - - // Protected Member Functions - - //- Get the diameter field - virtual tmp calcA() const; - - public: //- Runtime type information @@ -69,6 +61,7 @@ public: // Constructors + //- Construct from dictionary and phase spherical ( const dictionary& diameterProperties, @@ -78,6 +71,12 @@ public: //- Destructor virtual ~spherical(); + + + // Member Functions + + //- Get the surface area per unit volume field + virtual tmp a() const; }; diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/velocityGroup/velocityGroup.C b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/velocityGroup/velocityGroup.C index cd24ecfc49..62c2d80b63 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/velocityGroup/velocityGroup.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/velocityGroup/velocityGroup.C @@ -135,41 +135,6 @@ void Foam::diameterModels::velocityGroup::scale() } -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // - -Foam::tmp -Foam::diameterModels::velocityGroup::calcD() const -{ - return d_; -} - - -Foam::tmp -Foam::diameterModels::velocityGroup::calcA() const -{ - tmp tA - ( - volScalarField::New - ( - "a", - phase().mesh(), - dimensionedScalar(inv(dimLength), Zero) - ) - ); - - volScalarField& a = tA.ref(); - - forAll(sizeGroups_, i) - { - const sizeGroup& fi = sizeGroups_[i]; - - a += fi.a()*fi/fi.x(); - } - - return phase()*a; -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::diameterModels::velocityGroup::velocityGroup @@ -205,10 +170,8 @@ Foam::diameterModels::velocityGroup::velocityGroup diameterProperties.lookup("sizeGroups"), sizeGroup::iNew(phase, *this) ), - d_(dRef()) -{ - d_ = dsm(); -} + d_(IOobject::groupName("d", phase.name()), dsm()) +{} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // @@ -219,7 +182,38 @@ Foam::diameterModels::velocityGroup::~velocityGroup() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::diameterModels::velocityGroup::correctNoStore() +Foam::tmp Foam::diameterModels::velocityGroup::d() const +{ + return d_; +} + + +Foam::tmp Foam::diameterModels::velocityGroup::a() const +{ + tmp tA + ( + volScalarField::New + ( + "a", + phase().mesh(), + dimensionedScalar(inv(dimLength), Zero) + ) + ); + + volScalarField& a = tA.ref(); + + forAll(sizeGroups_, i) + { + const sizeGroup& fi = sizeGroups_[i]; + + a += fi.a()*fi/fi.x(); + } + + return phase()*a; +} + + +void Foam::diameterModels::velocityGroup::correct() { forAll(sizeGroups_, i) { diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/velocityGroup/velocityGroup.H b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/velocityGroup/velocityGroup.H index b29768c5cd..d274166d11 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/velocityGroup/velocityGroup.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/diameterModels/velocityGroup/velocityGroup.H @@ -108,7 +108,7 @@ class velocityGroup PtrList sizeGroups_; //- Sauter-mean diameter of the phase - volScalarField& d_; + volScalarField d_; // Private Member Functions @@ -122,17 +122,6 @@ class velocityGroup void scale(); -protected: - - // Protected Member Functions - - //- Get the diameter field - virtual tmp calcD() const; - - //- Get the surface area per unit volume field - virtual tmp calcA() const; - - public: //- Runtime type information @@ -141,7 +130,7 @@ public: // Constructors - //- Construct from components + //- Construct from dictionary and phase velocityGroup ( const dictionary& diameterProperties, @@ -164,8 +153,14 @@ public: //- Return sizeGroups belonging to this velocityGroup inline const PtrList& sizeGroups() const; - //- Correct the diameter field - virtual void correctNoStore(); + //- Get the diameter field + virtual tmp d() const; + + //- Get the surface area per unit volume field + virtual tmp a() const; + + //- Correct the model + virtual void correct(); //- Read diameterProperties dictionary virtual bool read(const dictionary& diameterProperties);