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<dragModel>& drag =
        fluid.lookupSubModel<BlendedInterfacialModel<dragModel>>
        (
            phasePair(gas, liquid)
        );

Here, "fluid" is the phase system, and "gas" and "liquid" are the phase
models between which the blended drag model applies.
This commit is contained in:
Will Bainbridge
2018-03-27 13:15:43 +01:00
parent a59781b9e7
commit a4956cb2c5
12 changed files with 88 additions and 6 deletions

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -199,6 +199,15 @@ Foam::BlendedInterfacialModel<ModelType>::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<ModelType>::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<ModelType>::D() const
}
template<class ModelType>
bool Foam::BlendedInterfacialModel<ModelType>::writeData(Ostream& os) const
{
return os.good();
}
// ************************************************************************* //

View File

@ -65,6 +65,8 @@ class blendedInterfacialModel
template<class ModelType>
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<volScalarField> D() const;
//- Dummy write for regIOobject
bool writeData(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define defineBlendedInterfacialModelTypeNameAndDebug(ModelType, DebugSwitch) \
\
defineTemplateTypeNameAndDebugWithName \
( \
BlendedInterfacialModel<ModelType>, \
( \
word(BlendedInterfacialModel<ModelType>::typeName_()) + "<" \
+ ModelType::typeName_() + ">" \
).c_str(), \
DebugSwitch \
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -30,6 +30,9 @@ License
#include "fvcDdt.H"
#include "localEulerDdtScheme.H"
#include "dragModel.H"
#include "BlendedInterfacialModel.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam

View File

@ -367,6 +367,11 @@ public:
const phaseModel& continuous
) const;
//- Return a blended sub model between a phase pair
template<class modelType>
const BlendedInterfacialModel<modelType>&
lookupBlendedSubModel(const phasePair& key) const;
// Field construction

View File

@ -377,4 +377,16 @@ const modelType& Foam::phaseSystem::lookupSubModel
}
template<class modelType>
const Foam::BlendedInterfacialModel<modelType>&
Foam::phaseSystem::lookupBlendedSubModel(const phasePair& key) const
{
return
mesh().lookupObject<BlendedInterfacialModel<modelType>>
(
IOobject::groupName(modelType::typeName, key.name())
);
}
// ************************************************************************* //