From a4956cb2c56ea5ec10eaccd7b6e27dc1ebf4974e Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Tue, 27 Mar 2018 13:15:43 +0100 Subject: [PATCH] reactingEulerFoam: Registered blended models Blended models are now registered and can be looked up in the same way as regular interfacial models via the phaseSystem::lookupSubModel method. For example, to access the blended drag model, the following code could be used: const BlendedInterfacialModel& drag = fluid.lookupSubModel> ( phasePair(gas, liquid) ); Here, "fluid" is the phase system, and "gas" and "liquid" are the phase models between which the blended drag model applies. --- .../massTransferModel/massTransferModel.C | 4 ++- .../dragModels/dragModel/dragModel.C | 4 ++- .../heatTransferModel/heatTransferModel.C | 4 ++- .../liftModels/liftModel/liftModel.C | 4 ++- .../turbulentDispersionModel.C | 2 ++ .../virtualMassModel/virtualMassModel.C | 4 ++- .../wallLubricationModel.C | 4 ++- .../BlendedInterfacialModel.C | 25 +++++++++++++++++++ .../BlendedInterfacialModel.H | 23 +++++++++++++++++ .../phaseSystems/phaseSystem/phaseSystem.C | 3 +++ .../phaseSystems/phaseSystem/phaseSystem.H | 5 ++++ .../phaseSystem/phaseSystemTemplates.C | 12 +++++++++ 12 files changed, 88 insertions(+), 6 deletions(-) diff --git a/applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/massTransferModels/massTransferModel/massTransferModel.C b/applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/massTransferModels/massTransferModel/massTransferModel.C index da38c966c..581855e65 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/massTransferModels/massTransferModel/massTransferModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/massTransferModels/massTransferModel/massTransferModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,12 +25,14 @@ License #include "massTransferModel.H" #include "phasePair.H" +#include "BlendedInterfacialModel.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { defineTypeNameAndDebug(massTransferModel, 0); + defineBlendedInterfacialModelTypeNameAndDebug(massTransferModel, 0); defineRunTimeSelectionTable(massTransferModel, dictionary); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/dragModels/dragModel/dragModel.C b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/dragModels/dragModel/dragModel.C index 29a7bdf88..e7a9d01d5 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/dragModels/dragModel/dragModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/dragModels/dragModel/dragModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,12 +27,14 @@ License #include "phasePair.H" #include "swarmCorrection.H" #include "surfaceInterpolate.H" +#include "BlendedInterfacialModel.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { defineTypeNameAndDebug(dragModel, 0); + defineBlendedInterfacialModelTypeNameAndDebug(dragModel, 0); defineRunTimeSelectionTable(dragModel, dictionary); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/heatTransferModels/heatTransferModel/heatTransferModel.C b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/heatTransferModels/heatTransferModel/heatTransferModel.C index 478cd5350..24b571bac 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/heatTransferModels/heatTransferModel/heatTransferModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/heatTransferModels/heatTransferModel/heatTransferModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,12 +25,14 @@ License #include "heatTransferModel.H" #include "phasePair.H" +#include "BlendedInterfacialModel.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { defineTypeNameAndDebug(heatTransferModel, 0); + defineBlendedInterfacialModelTypeNameAndDebug(heatTransferModel, 0); defineRunTimeSelectionTable(heatTransferModel, dictionary); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/liftModels/liftModel/liftModel.C b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/liftModels/liftModel/liftModel.C index 7c0bf86c9..451cff9ad 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/liftModels/liftModel/liftModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/liftModels/liftModel/liftModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -28,12 +28,14 @@ License #include "fvcCurl.H" #include "fvcFlux.H" #include "surfaceInterpolate.H" +#include "BlendedInterfacialModel.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { defineTypeNameAndDebug(liftModel, 0); + defineBlendedInterfacialModelTypeNameAndDebug(liftModel, 0); defineRunTimeSelectionTable(liftModel, dictionary); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/turbulentDispersionModels/turbulentDispersionModel/turbulentDispersionModel.C b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/turbulentDispersionModels/turbulentDispersionModel/turbulentDispersionModel.C index 07490e769..8268e675b 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/turbulentDispersionModels/turbulentDispersionModel/turbulentDispersionModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/turbulentDispersionModels/turbulentDispersionModel/turbulentDispersionModel.C @@ -29,12 +29,14 @@ License #include "surfaceInterpolate.H" #include "fvcSnGrad.H" #include "phaseCompressibleTurbulenceModel.H" +#include "BlendedInterfacialModel.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { defineTypeNameAndDebug(turbulentDispersionModel, 0); + defineBlendedInterfacialModelTypeNameAndDebug(turbulentDispersionModel, 0); defineRunTimeSelectionTable(turbulentDispersionModel, dictionary); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/virtualMassModels/virtualMassModel/virtualMassModel.C b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/virtualMassModels/virtualMassModel/virtualMassModel.C index a2ece4192..27c4173c3 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/virtualMassModels/virtualMassModel/virtualMassModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/virtualMassModels/virtualMassModel/virtualMassModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2014-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -26,12 +26,14 @@ License #include "virtualMassModel.H" #include "phasePair.H" #include "surfaceInterpolate.H" +#include "BlendedInterfacialModel.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { defineTypeNameAndDebug(virtualMassModel, 0); + defineBlendedInterfacialModelTypeNameAndDebug(virtualMassModel, 0); defineRunTimeSelectionTable(virtualMassModel, dictionary); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/wallLubricationModels/wallLubricationModel/wallLubricationModel.C b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/wallLubricationModels/wallLubricationModel/wallLubricationModel.C index edcc48fff..71747e15b 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/wallLubricationModels/wallLubricationModel/wallLubricationModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/wallLubricationModels/wallLubricationModel/wallLubricationModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -28,12 +28,14 @@ License #include "fvcFlux.H" #include "surfaceInterpolate.H" #include "wallFvPatch.H" +#include "BlendedInterfacialModel.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { defineTypeNameAndDebug(wallLubricationModel, 0); + defineBlendedInterfacialModelTypeNameAndDebug(wallLubricationModel, 0); defineRunTimeSelectionTable(wallLubricationModel, dictionary); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.C index 7ba04bfc5..b567e3927 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.C @@ -199,6 +199,15 @@ Foam::BlendedInterfacialModel::BlendedInterfacialModel const bool correctFixedFluxBCs ) : + regIOobject + ( + IOobject + ( + IOobject::groupName(typeName, phasePair(phase1, phase2).name()), + phase1.mesh().time().timeName(), + phase1.mesh() + ) + ), phase1_(phase1), phase2_(phase2), blending_(blending), @@ -220,6 +229,15 @@ Foam::BlendedInterfacialModel::BlendedInterfacialModel const bool correctFixedFluxBCs ) : + regIOobject + ( + IOobject + ( + IOobject::groupName(typeName, pair.name()), + pair.phase1().mesh().time().timeName(), + pair.phase1().mesh() + ) + ), phase1_(pair.phase1()), phase2_(pair.phase2()), blending_(blending), @@ -348,4 +366,11 @@ Foam::BlendedInterfacialModel::D() const } +template +bool Foam::BlendedInterfacialModel::writeData(Ostream& os) const +{ + return os.good(); +} + + // ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.H index 4debb7db0..be3dc21bc 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.H @@ -65,6 +65,8 @@ class blendedInterfacialModel template class BlendedInterfacialModel +: + public regIOobject { // Private data @@ -123,6 +125,10 @@ class BlendedInterfacialModel public: + //- Runtime type information + TypeName("BlendedInterfacialModel"); + + // Constructors //- Construct from two phases, blending method and three models @@ -183,9 +189,26 @@ public: //- Return the blended diffusivity tmp D() const; + + //- Dummy write for regIOobject + bool writeData(Ostream& os) const; }; +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define defineBlendedInterfacialModelTypeNameAndDebug(ModelType, DebugSwitch) \ + \ + defineTemplateTypeNameAndDebugWithName \ + ( \ + BlendedInterfacialModel, \ + ( \ + word(BlendedInterfacialModel::typeName_()) + "<" \ + + ModelType::typeName_() + ">" \ + ).c_str(), \ + DebugSwitch \ + ); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.C index d1a15f73b..8585f0f15 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.C @@ -30,6 +30,9 @@ License #include "fvcDdt.H" #include "localEulerDdtScheme.H" +#include "dragModel.H" +#include "BlendedInterfacialModel.H" + // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.H index 19426058f..91882816e 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.H @@ -367,6 +367,11 @@ public: const phaseModel& continuous ) const; + //- Return a blended sub model between a phase pair + template + const BlendedInterfacialModel& + lookupBlendedSubModel(const phasePair& key) const; + // Field construction diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystemTemplates.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystemTemplates.C index 69aebd5ed..8d835991e 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystemTemplates.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystemTemplates.C @@ -377,4 +377,16 @@ const modelType& Foam::phaseSystem::lookupSubModel } +template +const Foam::BlendedInterfacialModel& +Foam::phaseSystem::lookupBlendedSubModel(const phasePair& key) const +{ + return + mesh().lookupObject> + ( + IOobject::groupName(modelType::typeName, key.name()) + ); +} + + // ************************************************************************* //