From 2843ceff2f739a76c112ae892c3ab20b2043cb57 Mon Sep 17 00:00:00 2001 From: william Date: Fri, 24 Jan 2014 09:09:51 +0000 Subject: [PATCH] ENH: twoPhaseEulerFoam: made blending methods multiphase, and associated them with model types --- .../BlendedInterfacialModel.C | 28 +--- .../BlendedInterfacialModel.H | 7 +- .../blendingMethod/blendingMethod.C | 15 +- .../blendingMethod/blendingMethod.H | 45 +++--- .../blendingMethod/newBlendingMethod.C | 8 +- .../blendingMethods/hyperbolic/hyperbolic.C | 57 ++++---- .../blendingMethods/hyperbolic/hyperbolic.H | 28 ++-- .../blendingMethods/linear/linear.C | 136 ++++++++++-------- .../blendingMethods/linear/linear.H | 31 ++-- .../blendingMethods/noBlending/noBlending.C | 23 +-- .../blendingMethods/noBlending/noBlending.H | 15 +- .../twoPhaseSystem/twoPhaseSystem.C | 58 +++++--- .../twoPhaseSystem/twoPhaseSystem.H | 4 + 13 files changed, 250 insertions(+), 205 deletions(-) diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/BlendedInterfacialModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/BlendedInterfacialModel.C index e077870cb9..95d6ebe77a 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/BlendedInterfacialModel.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/BlendedInterfacialModel.C @@ -57,7 +57,7 @@ template Foam::BlendedInterfacialModel::BlendedInterfacialModel ( const phasePair::dictTable& modelTable, - const dictionary& blendingDict, + const blendingMethod& blending, const phasePair& pair, const orderedPhasePair& pair1In2, const orderedPhasePair& pair2In1 @@ -66,21 +66,7 @@ Foam::BlendedInterfacialModel::BlendedInterfacialModel pair_(pair), pair1In2_(pair1In2), pair2In1_(pair2In1), - blending_ - ( - blendingMethod::New - ( - blendingDict, - pair1In2_.dispersed(), - pair1In2_.continuous() - ) - ), - residualAlpha_ - ( - "residualAlpha", - dimless, - blendingDict.lookup("residualAlpha") - ) + blending_(blending) { if (modelTable.found(pair_)) { @@ -137,12 +123,12 @@ Foam::BlendedInterfacialModel::K() const if (model_.valid() || model1In2_.valid()) { - f1 = blending_->f1(); + f1 = blending_.f1(pair1In2_.dispersed(), pair2In1_.dispersed()); } if (model_.valid() || model2In1_.valid()) { - f2 = blending_->f2(); + f2 = blending_.f2(pair1In2_.dispersed(), pair2In1_.dispersed()); } tmp x @@ -177,7 +163,7 @@ Foam::BlendedInterfacialModel::K() const if (model_.valid() || model1In2_.valid() || model2In1_.valid()) { - x() *= max(pair_.phase1()*pair_.phase2(), residualAlpha_); + x() *= max(pair_.phase1()*pair_.phase2(), blending_.residualAlpha()); correctFixedFluxBCs(x()); } @@ -195,12 +181,12 @@ Foam::BlendedInterfacialModel::F() const if (model_.valid() || model1In2_.valid()) { - f1 = blending_->f1(); + f1 = blending_.f1(pair1In2_.dispersed(), pair2In1_.dispersed()); } if (model_.valid() || model2In1_.valid()) { - f2 = blending_->f2(); + f2 = blending_.f2(pair1In2_.dispersed(), pair2In1_.dispersed()); } tmp > x diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/BlendedInterfacialModel.H b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/BlendedInterfacialModel.H index acc66085bc..1f698f9916 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/BlendedInterfacialModel.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/BlendedInterfacialModel.H @@ -75,10 +75,7 @@ private: autoPtr model2In1_; //- Blending model - autoPtr blending_; - - //- Residual phase fraction - const dimensionedScalar residualAlpha_; + const blendingMethod& blending_; // Private Member Functions @@ -105,7 +102,7 @@ public: BlendedInterfacialModel ( const phasePair::dictTable& modelTable, - const dictionary& blendingDict, + const blendingMethod& blending, const phasePair& pair, const orderedPhasePair& pair1In2, const orderedPhasePair& pair2In1 diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/blendingMethod/blendingMethod.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/blendingMethod/blendingMethod.C index 29c961e01a..3b4ec1092c 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/blendingMethod/blendingMethod.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/blendingMethod/blendingMethod.C @@ -38,13 +38,10 @@ namespace Foam Foam::blendingMethod::blendingMethod ( - const dictionary& dict, - const phaseModel& phase1, - const phaseModel& phase2 + const dictionary& dict ) : - phase1_(phase1), - phase2_(phase2) + residualAlpha_("residualAlpha", dimless, dict.lookup("residualAlpha")) {} @@ -54,4 +51,12 @@ Foam::blendingMethod::~blendingMethod() {} +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +const Foam::dimensionedScalar& Foam::blendingMethod::residualAlpha() const +{ + return residualAlpha_; +} + + // ************************************************************************* // diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/blendingMethod/blendingMethod.H b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/blendingMethod/blendingMethod.H index 73494c7553..63cfb797b3 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/blendingMethod/blendingMethod.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/blendingMethod/blendingMethod.H @@ -49,24 +49,12 @@ namespace Foam class blendingMethod { - // Private Member Functions - - //- Disallow default bitwise copy construct - blendingMethod(const blendingMethod&); - - //- Disallow default bitwise assignment - void operator=(const blendingMethod&); - - protected: // Protected data - //- Phase 1 - const phaseModel& phase1_; - - //- Phase 2 - const phaseModel& phase2_; + //- Residual phase fraction + const dimensionedScalar residualAlpha_; public: @@ -83,21 +71,18 @@ public: dictionary, ( const dictionary& dict, - const phaseModel& phase1, - const phaseModel& phase2 + const wordList& phaseNames ), - (dict, phase1, phase2) + (dict, phaseNames) ); // Constructors - //- Construct from a dictionary and two phases + //- Construct from a dictionary blendingMethod ( - const dictionary& dict, - const phaseModel& phase1, - const phaseModel& phase2 + const dictionary& dict ); @@ -106,8 +91,7 @@ public: static autoPtr New ( const dictionary& dict, - const phaseModel& phase1, - const phaseModel& phase2 + const wordList& phaseNames ); @@ -117,11 +101,22 @@ public: // Member Functions + //- Residual phase fraction + const dimensionedScalar& residualAlpha() const; + //- Factor for first phase - virtual tmp f1() const = 0; + virtual tmp f1 + ( + const phaseModel& phase1, + const phaseModel& phase2 + ) const = 0; //- Factor for second phase - virtual tmp f2() const = 0; + virtual tmp f2 + ( + const phaseModel& phase1, + const phaseModel& phase2 + ) const = 0; }; diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/blendingMethod/newBlendingMethod.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/blendingMethod/newBlendingMethod.C index 108c0425d5..95b277fd99 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/blendingMethod/newBlendingMethod.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/blendingMethod/newBlendingMethod.C @@ -30,14 +30,12 @@ License Foam::autoPtr Foam::blendingMethod::New ( const dictionary& dict, - const phaseModel& phase1, - const phaseModel& phase2 + const wordList& phaseNames ) { word blendingMethodType(dict.lookup("type")); - Info<< "Selecting blendingMethod for " - << phase1.name() << " and " << phase2.name() << ": " + Info<< "Selecting " << dict.dictName() << " blending method: " << blendingMethodType << endl; dictionaryConstructorTable::iterator cstrIter = @@ -53,7 +51,7 @@ Foam::autoPtr Foam::blendingMethod::New << exit(FatalError); } - return cstrIter()(dict, phase1, phase2); + return cstrIter()(dict, phaseNames); } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/hyperbolic/hyperbolic.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/hyperbolic/hyperbolic.C index 712e36f6c4..f799dae0c2 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/hyperbolic/hyperbolic.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/hyperbolic/hyperbolic.C @@ -48,36 +48,33 @@ namespace blendingMethods Foam::blendingMethods::hyperbolic::hyperbolic ( const dictionary& dict, - const phaseModel& phase1, - const phaseModel& phase2 + const wordList& phaseNames ) : - blendingMethod(dict, phase1, phase2), - maxDispersedAlpha1_ - ( - "maxDispersedAlpha1", - dimless, - dict.lookup - ( - IOobject::groupName("maxDispersedAlpha", phase1.name()) - ) - ), - maxDispersedAlpha2_ - ( - "maxDispersedAlpha2", - dimless, - dict.lookup - ( - IOobject::groupName("maxDispersedAlpha", phase2.name()) - ) - ), + blendingMethod(dict), transitionAlphaScale_ ( "transitionAlphaScale", dimless, dict.lookup("transitionAlphaScale") ) -{} +{ + forAllConstIter(wordList, phaseNames, iter) + { + const word name(IOobject::groupName("maxDispersedAlpha", *iter)); + + maxDispersedAlpha_.insert + ( + *iter, + dimensionedScalar + ( + name, + dimless, + dict.lookup(name) + ) + ); + } +} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // @@ -88,7 +85,11 @@ Foam::blendingMethods::hyperbolic::~hyperbolic() // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // -Foam::tmp Foam::blendingMethods::hyperbolic::f1() const +Foam::tmp Foam::blendingMethods::hyperbolic::f1 +( + const phaseModel& phase1, + const phaseModel& phase2 +) const { return ( @@ -96,13 +97,17 @@ Foam::tmp Foam::blendingMethods::hyperbolic::f1() const + tanh ( (4/transitionAlphaScale_) - *(phase1_ - maxDispersedAlpha1_) + *(phase1 - maxDispersedAlpha_[phase1.name()]) ) )/2; } -Foam::tmp Foam::blendingMethods::hyperbolic::f2() const +Foam::tmp Foam::blendingMethods::hyperbolic::f2 +( + const phaseModel& phase1, + const phaseModel& phase2 +) const { return ( @@ -110,7 +115,7 @@ Foam::tmp Foam::blendingMethods::hyperbolic::f2() const + tanh ( (4/transitionAlphaScale_) - *(maxDispersedAlpha2_ - phase2_) + *(maxDispersedAlpha_[phase2.name()] - phase2) ) )/2; } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/hyperbolic/hyperbolic.H b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/hyperbolic/hyperbolic.H index 78048b0927..5f89c5fb81 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/hyperbolic/hyperbolic.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/hyperbolic/hyperbolic.H @@ -53,11 +53,8 @@ class hyperbolic { // Private data - //- Maximum fraction of phase 1 which can be considered dispersed - const dimensionedScalar maxDispersedAlpha1_; - - //- Maximum fraction of phase 2 which can be considered dispersed - const dimensionedScalar maxDispersedAlpha2_; + //- Maximum fraction of phases which can be considered dispersed + HashTable maxDispersedAlpha_; //- Width of the transition const dimensionedScalar transitionAlphaScale_; @@ -71,12 +68,11 @@ public: // Constructors - //- Construct from a dictionary and two phases + //- Construct from a dictionary and a list of phase names hyperbolic ( const dictionary& dict, - const phaseModel& phase1, - const phaseModel& phase2 + const wordList& phaseNames ); @@ -86,11 +82,19 @@ public: // Member Functions - //- Factor for primary phase - virtual tmp f1() const; + //- Factor for first phase + virtual tmp f1 + ( + const phaseModel& phase1, + const phaseModel& phase2 + ) const; - //- Factor for secondary phase - virtual tmp f2() const; + //- Factor for second phase + virtual tmp f2 + ( + const phaseModel& phase1, + const phaseModel& phase2 + ) const; }; diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/linear/linear.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/linear/linear.C index bf5fdd9c4b..6bda755820 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/linear/linear.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/linear/linear.C @@ -48,65 +48,63 @@ namespace blendingMethods Foam::blendingMethods::linear::linear ( const dictionary& dict, - const phaseModel& phase1, - const phaseModel& phase2 + const wordList& phaseNames ) : - blendingMethod(dict, phase1, phase2), - maxFullyDispersedAlpha1_ - ( - "maxFullyDispersedAlpha1", - dimless, - dict.lookup - ( - IOobject::groupName("maxFullyDispersedAlpha", phase1.name()) - ) - ), - maxPartlyDispersedAlpha1_ - ( - "maxPartlyDispersedAlpha1", - dimless, - dict.lookup - ( - IOobject::groupName("maxPartlyDispersedAlpha", phase1.name()) - ) - ), - maxFullyDispersedAlpha2_ - ( - "maxFullyDispersedAlpha2", - dimless, - dict.lookup - ( - IOobject::groupName("maxFullyDispersedAlpha", phase2.name()) - ) - ), - maxPartlyDispersedAlpha2_ - ( - "maxPartlyDispersedAlpha2", - dimless, - dict.lookup - ( - IOobject::groupName("maxPartlyDispersedAlpha", phase2.name()) - ) - ) + blendingMethod(dict) { - if - ( - maxFullyDispersedAlpha1_ > maxPartlyDispersedAlpha1_ - || maxFullyDispersedAlpha2_ > maxPartlyDispersedAlpha2_ - ) + forAllConstIter(wordList, phaseNames, iter) { - FatalErrorIn + const word nameFull ( - "Foam::blendingMethods::linear::linear" - "(" - "const dictionary& dict," - "const phaseModel& phase1," - "const phaseModel& phase2" - ")" - ) << "The supplied fully dispersed volume fraction is greater than " - << "the partly dispersed value" - << endl << exit(FatalError); + IOobject::groupName("maxFullyDispersedAlpha", *iter) + ); + + maxFullyDispersedAlpha_.insert + ( + *iter, + dimensionedScalar + ( + nameFull, + dimless, + dict.lookup(nameFull) + ) + ); + + const word namePart + ( + IOobject::groupName("maxPartlyDispersedAlpha", *iter) + ); + + maxPartlyDispersedAlpha_.insert + ( + *iter, + dimensionedScalar + ( + namePart, + dimless, + dict.lookup(namePart) + ) + ); + + if + ( + maxFullyDispersedAlpha_[*iter] + > maxPartlyDispersedAlpha_[*iter] + ) + { + FatalErrorIn + ( + "Foam::blendingMethods::linear::linear" + "(" + "const dictionary& dict," + "const wordList& phaseNames" + ")" + ) << "The supplied fully dispersed volume fraction for " + << *iter + << " is greater than the partly dispersed value." + << endl << exit(FatalError); + } } } @@ -119,15 +117,24 @@ Foam::blendingMethods::linear::~linear() // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // -Foam::tmp Foam::blendingMethods::linear::f1() const +Foam::tmp Foam::blendingMethods::linear::f1 +( + const phaseModel& phase1, + const phaseModel& phase2 +) const { + const dimensionedScalar + maxFullAlpha(maxFullyDispersedAlpha_[phase1.name()]); + const dimensionedScalar + maxPartAlpha(maxPartlyDispersedAlpha_[phase1.name()]); + return min ( max ( - (phase1_ - maxFullyDispersedAlpha1_) - /(maxPartlyDispersedAlpha1_ - maxFullyDispersedAlpha1_ + SMALL), + (phase1 - maxFullAlpha) + /(maxPartAlpha - maxFullAlpha + SMALL), 0.0 ), 1.0 @@ -135,15 +142,24 @@ Foam::tmp Foam::blendingMethods::linear::f1() const } -Foam::tmp Foam::blendingMethods::linear::f2() const +Foam::tmp Foam::blendingMethods::linear::f2 +( + const phaseModel& phase1, + const phaseModel& phase2 +) const { + const dimensionedScalar + maxFullAlpha(maxFullyDispersedAlpha_[phase2.name()]); + const dimensionedScalar + maxPartAlpha(maxPartlyDispersedAlpha_[phase2.name()]); + return min ( max ( - (maxPartlyDispersedAlpha2_ - phase2_) - /(maxPartlyDispersedAlpha2_ - maxFullyDispersedAlpha2_ + SMALL), + (maxPartAlpha - phase2) + /(maxPartAlpha - maxFullAlpha + SMALL), 0.0 ), 1.0 diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/linear/linear.H b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/linear/linear.H index dd319629dd..153122c78d 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/linear/linear.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/linear/linear.H @@ -53,17 +53,13 @@ class linear { // Private data - //- Max fraction of phase 1 which can be considered fully dispersed - const dimensionedScalar maxFullyDispersedAlpha1_; + //- Maximum fraction of phases which can be considered fully dispersed + HashTable + maxFullyDispersedAlpha_; - //- Max fraction of phase 1 which can be considered partly dispersed - const dimensionedScalar maxPartlyDispersedAlpha1_; - - //- Max fraction of phase 2 which can be considered fully dispersed - const dimensionedScalar maxFullyDispersedAlpha2_; - - //- Max fraction of phase 2 which can be considered partly dispersed - const dimensionedScalar maxPartlyDispersedAlpha2_; + //- Maximum fraction of phases which can be considered partly dispersed + HashTable + maxPartlyDispersedAlpha_; public: @@ -78,8 +74,7 @@ public: linear ( const dictionary& dict, - const phaseModel& phase1, - const phaseModel& phase2 + const wordList& phaseNames ); @@ -90,10 +85,18 @@ public: // Member Functions //- Factor for primary phase - virtual tmp f1() const; + virtual tmp f1 + ( + const phaseModel& phase1, + const phaseModel& phase2 + ) const; //- Factor for secondary phase - virtual tmp f2() const; + virtual tmp f2 + ( + const phaseModel& phase1, + const phaseModel& phase2 + ) const; }; diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/noBlending/noBlending.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/noBlending/noBlending.C index e58abaf6fe..37c543a8ff 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/noBlending/noBlending.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/noBlending/noBlending.C @@ -48,11 +48,10 @@ namespace blendingMethods Foam::blendingMethods::noBlending::noBlending ( const dictionary& dict, - const phaseModel& phase1, - const phaseModel& phase2 + const wordList& phaseNames ) : - blendingMethod(dict, phase1, phase2), + blendingMethod(dict), continuousPhase_(dict.lookup("continuousPhase")) {} @@ -65,9 +64,13 @@ Foam::blendingMethods::noBlending::~noBlending() // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // -Foam::tmp Foam::blendingMethods::noBlending::f1() const +Foam::tmp Foam::blendingMethods::noBlending::f1 +( + const phaseModel& phase1, + const phaseModel& phase2 +) const { - const fvMesh& mesh(phase1_.mesh()); + const fvMesh& mesh(phase1.mesh()); return tmp @@ -85,16 +88,20 @@ Foam::tmp Foam::blendingMethods::noBlending::f1() const ( "f", dimless, - phase1_.name() == continuousPhase_ + phase1.name() == continuousPhase_ ) ) ); } -Foam::tmp Foam::blendingMethods::noBlending::f2() const +Foam::tmp Foam::blendingMethods::noBlending::f2 +( + const phaseModel& phase1, + const phaseModel& phase2 +) const { - return f1(); + return f1(phase1, phase2); } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/noBlending/noBlending.H b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/noBlending/noBlending.H index a24ee6dda9..7415920c77 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/noBlending/noBlending.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/BlendedInterfacialModel/blendingMethods/noBlending/noBlending.H @@ -69,8 +69,7 @@ public: noBlending ( const dictionary& dict, - const phaseModel& phase1, - const phaseModel& phase2 + const wordList& phaseNames ); @@ -81,10 +80,18 @@ public: // Member Functions //- Factor for primary phase - virtual tmp f1() const; + virtual tmp f1 + ( + const phaseModel& phase1, + const phaseModel& phase2 + ) const; //- Factor for secondary phase - virtual tmp f2() const; + virtual tmp f2 + ( + const phaseModel& phase1, + const phaseModel& phase2 + ) const; }; diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C index 871c276e4f..98d096951e 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C @@ -46,6 +46,9 @@ License #include "fvmLaplacian.H" #include "fixedValueFvsPatchFields.H" +#include "blendingMethod.H" +#include "HashPtrTable.H" + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::twoPhaseSystem::twoPhaseSystem @@ -120,6 +123,23 @@ Foam::twoPhaseSystem::twoPhaseSystem phase2_.volScalarField::operator=(scalar(1) - phase1_); + // Blending + // ~~~~~~~~ + + forAllConstIter(dictionary, subDict("blending"), iter) + { + blendingMethods_.insert + ( + iter().dict().dictName(), + blendingMethod::New + ( + iter().dict(), + wordList(lookup("phases")) + ) + ); + } + + // Pairs // ~~~~~ @@ -165,17 +185,15 @@ Foam::twoPhaseSystem::twoPhaseSystem // Models // ~~~~~~ - const dictionary& blendingDict(subDict("blending")); - drag_.set ( new BlendedInterfacialModel ( lookup("drag"), ( - blendingDict.isDict("drag") - ? blendingDict.subDict("drag") - : blendingDict.subDict("default") + blendingMethods_.found("drag") + ? blendingMethods_["drag"] + : blendingMethods_["default"] ), pair_, pair1In2_, @@ -189,9 +207,9 @@ Foam::twoPhaseSystem::twoPhaseSystem ( lookup("virtualMass"), ( - blendingDict.isDict("virtualMass") - ? blendingDict.subDict("virtualMass") - : blendingDict.subDict("default") + blendingMethods_.found("virtualMass") + ? blendingMethods_["virtualMass"] + : blendingMethods_["default"] ), pair_, pair1In2_, @@ -205,9 +223,9 @@ Foam::twoPhaseSystem::twoPhaseSystem ( lookup("heatTransfer"), ( - blendingDict.isDict("heatTransfer") - ? blendingDict.subDict("heatTransfer") - : blendingDict.subDict("default") + blendingMethods_.found("heatTransfer") + ? blendingMethods_["heatTransfer"] + : blendingMethods_["default"] ), pair_, pair1In2_, @@ -221,9 +239,9 @@ Foam::twoPhaseSystem::twoPhaseSystem ( lookup("lift"), ( - blendingDict.isDict("lift") - ? blendingDict.subDict("lift") - : blendingDict.subDict("default") + blendingMethods_.found("lift") + ? blendingMethods_["lift"] + : blendingMethods_["default"] ), pair_, pair1In2_, @@ -237,9 +255,9 @@ Foam::twoPhaseSystem::twoPhaseSystem ( lookup("wallLubrication"), ( - blendingDict.isDict("wallLubrication") - ? blendingDict.subDict("wallLubrication") - : blendingDict.subDict("default") + blendingMethods_.found("wallLubrication") + ? blendingMethods_["wallLubrication"] + : blendingMethods_["default"] ), pair_, pair1In2_, @@ -253,9 +271,9 @@ Foam::twoPhaseSystem::twoPhaseSystem ( lookup("turbulentDispersion"), ( - blendingDict.isDict("turbulentDispersion") - ? blendingDict.subDict("turbulentDispersion") - : blendingDict.subDict("default") + blendingMethods_.found("turbulentDispersion") + ? blendingMethods_["turbulentDispersion"] + : blendingMethods_["default"] ), pair_, pair1In2_, diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.H b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.H index 762dcf6d87..e6a5732bb9 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.H @@ -53,6 +53,7 @@ class liftModel; class wallLubricationModel; class turbulentDispersionModel; +class blendingMethod; template class BlendedInterfacialModel; /*---------------------------------------------------------------------------*\ @@ -94,6 +95,9 @@ private: //- Phase pair for phase 2 dispersed in phase 1 autoPtr pair2In1_; + //- Blending methods + HashTable, word, word::hash> blendingMethods_; + //- Drag model autoPtr > drag_;