twoPhaseEulerFoam: Added experimental face-based momentum equation formulation

This formulation provides C-grid like pressure-flux staggering on an
unstructured mesh which is hugely beneficial for Euler-Euler multiphase
equations as it allows for all forces to be treated in a consistent
manner on the cell-faces which provides better balance, stability and
accuracy.  However, to achieve face-force consistency the momentum
transport terms must be interpolated to the faces reducing accuracy of
this part of the system but this is offset by the increase in accuracy
of the force-balance.

Currently it is not clear if this face-based momentum equation
formulation is preferable for all Euler-Euler simulations so I have
included it on a switch to allow evaluation and comparison with the
previous cell-based formulation.  To try the new algorithm simply switch
it on, e.g.:

PIMPLE
{
    nOuterCorrectors 3;
    nCorrectors      1;
    nNonOrthogonalCorrectors 0;
    faceMomentum     yes;
}

It is proving particularly good for bubbly flows, eliminating the
staggering patterns often seen in the air velocity field with the
previous algorithm, removing other spurious numerical artifacts in the
velocity fields and improving stability and allowing larger time-steps
For particle-gas flows the advantage is noticeable but not nearly as
pronounced as in the bubbly flow cases.

Please test the new algorithm on your cases and provide feedback.

Henry G. Weller
CFD Direct
This commit is contained in:
Henry
2015-04-27 21:33:58 +01:00
parent 69d46a7e44
commit fc6b44ee3c
36 changed files with 1098 additions and 236 deletions

View File

@ -25,14 +25,15 @@ License
#include "BlendedInterfacialModel.H"
#include "fixedValueFvsPatchFields.H"
#include "surfaceInterpolate.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class modelType>
template<class Type>
template<class GeometricField>
void Foam::BlendedInterfacialModel<modelType>::correctFixedFluxBCs
(
GeometricField<Type, fvPatchField, volMesh>& field
GeometricField& field
) const
{
forAll(pair_.phase1().phi().boundaryField(), patchI)
@ -45,7 +46,8 @@ void Foam::BlendedInterfacialModel<modelType>::correctFixedFluxBCs
)
)
{
field.boundaryField()[patchI] = pTraits<Type>::zero;
field.boundaryField()[patchI]
= pTraits<typename GeometricField::value_type>::zero;
}
}
}
@ -139,9 +141,12 @@ Foam::BlendedInterfacialModel<modelType>::K() const
(
IOobject
(
modelType::typeName + "Coeff",
modelType::typeName + ":K",
pair_.phase1().mesh().time().timeName(),
pair_.phase1().mesh()
pair_.phase1().mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
pair_.phase1().mesh(),
dimensionedScalar("zero", modelType::dimK, 0)
@ -176,6 +181,74 @@ Foam::BlendedInterfacialModel<modelType>::K() const
}
template<class modelType>
Foam::tmp<Foam::surfaceScalarField>
Foam::BlendedInterfacialModel<modelType>::Kf() const
{
tmp<surfaceScalarField> f1, f2;
if (model_.valid() || model1In2_.valid())
{
f1 = fvc::interpolate
(
blending_.f1(pair1In2_.dispersed(), pair2In1_.dispersed())
);
}
if (model_.valid() || model2In1_.valid())
{
f2 = fvc::interpolate
(
blending_.f2(pair1In2_.dispersed(), pair2In1_.dispersed())
);
}
tmp<surfaceScalarField> x
(
new surfaceScalarField
(
IOobject
(
modelType::typeName + ":Kf",
pair_.phase1().mesh().time().timeName(),
pair_.phase1().mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
pair_.phase1().mesh(),
dimensionedScalar("zero", modelType::dimK, 0)
)
);
if (model_.valid())
{
x() += model_->Kf()*(f1() - f2());
}
if (model1In2_.valid())
{
x() += model1In2_->Kf()*(1 - f1);
}
if (model2In1_.valid())
{
x() += model2In1_->Kf()*f2;
}
if
(
correctFixedFluxBCs_
&& (model_.valid() || model1In2_.valid() || model2In1_.valid())
)
{
correctFixedFluxBCs(x());
}
return x;
}
template<class modelType>
template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >
@ -199,9 +272,12 @@ Foam::BlendedInterfacialModel<modelType>::F() const
(
IOobject
(
modelType::typeName + "Coeff",
modelType::typeName + ":F",
pair_.phase1().mesh().time().timeName(),
pair_.phase1().mesh()
pair_.phase1().mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
pair_.phase1().mesh(),
dimensioned<Type>("zero", modelType::dimF, pTraits<Type>::zero)
@ -236,6 +312,74 @@ Foam::BlendedInterfacialModel<modelType>::F() const
}
template<class modelType>
Foam::tmp<Foam::surfaceScalarField>
Foam::BlendedInterfacialModel<modelType>::Ff() const
{
tmp<surfaceScalarField> f1, f2;
if (model_.valid() || model1In2_.valid())
{
f1 = fvc::interpolate
(
blending_.f1(pair1In2_.dispersed(), pair2In1_.dispersed())
);
}
if (model_.valid() || model2In1_.valid())
{
f2 = fvc::interpolate
(
blending_.f2(pair1In2_.dispersed(), pair2In1_.dispersed())
);
}
tmp<surfaceScalarField> x
(
new surfaceScalarField
(
IOobject
(
modelType::typeName + ":Ff",
pair_.phase1().mesh().time().timeName(),
pair_.phase1().mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
pair_.phase1().mesh(),
dimensionedScalar("zero", modelType::dimF*dimArea, 0)
)
);
if (model_.valid())
{
x() += model_->Ff()*(f1() - f2());
}
if (model1In2_.valid())
{
x() += model1In2_->Ff()*(1 - f1);
}
if (model2In1_.valid())
{
x() -= model2In1_->Ff()*f2; // note : subtraction
}
if
(
correctFixedFluxBCs_
&& (model_.valid() || model1In2_.valid() || model2In1_.valid())
)
{
correctFixedFluxBCs(x());
}
return x;
}
template<class modelType>
Foam::tmp<Foam::volScalarField>
Foam::BlendedInterfacialModel<modelType>::D() const
@ -258,9 +402,12 @@ Foam::BlendedInterfacialModel<modelType>::D() const
(
IOobject
(
modelType::typeName + "Coeff",
modelType::typeName + ":D",
pair_.phase1().mesh().time().timeName(),
pair_.phase1().mesh()
pair_.phase1().mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
pair_.phase1().mesh(),
dimensionedScalar("zero", modelType::dimD, 0)
@ -295,6 +442,19 @@ Foam::BlendedInterfacialModel<modelType>::D() const
}
template<class modelType>
bool Foam::BlendedInterfacialModel<modelType>::hasModel
(
const class phaseModel& phase
) const
{
return
&phase == &(pair_.phase1())
? model1In2_.valid()
: model2In1_.valid();
}
template<class modelType>
const modelType& Foam::BlendedInterfacialModel<modelType>::phaseModel
(

View File

@ -88,11 +88,8 @@ class BlendedInterfacialModel
void operator=(const BlendedInterfacialModel<modelType>&);
//- Correct coeff/value on fixed flux boundary conditions
template<class Type>
void correctFixedFluxBCs
(
GeometricField<Type, fvPatchField, volMesh>& field
) const;
template<class GeometricField>
void correctFixedFluxBCs(GeometricField& field) const;
public:
@ -117,18 +114,27 @@ public:
// Member Functions
//- Return true if a model is specified for the supplied phase
bool hasModel(const phaseModel& phase) const;
//- Return the model for the supplied phase
const modelType& phaseModel(const phaseModel& phase) const;
//- Return the blended force coefficient
tmp<volScalarField> K() const;
//- Return the face blended force coefficient
tmp<surfaceScalarField> Kf() const;
//- Return the blended force
template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh> > F() const;
//- Return the face blended force
tmp<surfaceScalarField> Ff() const;
//- Return the blended diffusivity
tmp<volScalarField> D() const;
//- Return the model for the supplied phase
const modelType& phaseModel(const phaseModel& phase) const;
};

View File

@ -26,7 +26,6 @@ License
#include "twoPhaseSystem.H"
#include "PhaseCompressibleTurbulenceModel.H"
#include "BlendedInterfacialModel.H"
#include "dragModel.H"
#include "virtualMassModel.H"
#include "heatTransferModel.H"
#include "liftModel.H"
@ -48,6 +47,15 @@ License
#include "blendingMethod.H"
#include "HashPtrTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
Foam::dimensionedScalar Foam::twoPhaseSystem::zeroResidualAlpha_
(
"zeroResidualAlpha", dimless, 0
);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::twoPhaseSystem::twoPhaseSystem
@ -299,46 +307,49 @@ Foam::tmp<Foam::surfaceScalarField> Foam::twoPhaseSystem::calcPhi() const
}
Foam::tmp<Foam::volScalarField> Foam::twoPhaseSystem::dragCoeff() const
Foam::tmp<Foam::volScalarField> Foam::twoPhaseSystem::Kd() const
{
return drag_->K();
}
Foam::tmp<Foam::volScalarField> Foam::twoPhaseSystem::virtualMassCoeff() const
Foam::tmp<Foam::surfaceScalarField> Foam::twoPhaseSystem::Kdf() const
{
return drag_->Kf();
}
Foam::tmp<Foam::volScalarField> Foam::twoPhaseSystem::Vm() const
{
return virtualMass_->K();
}
Foam::tmp<Foam::volScalarField> Foam::twoPhaseSystem::heatTransferCoeff() const
Foam::tmp<Foam::surfaceScalarField> Foam::twoPhaseSystem::Vmf() const
{
return virtualMass_->Kf();
}
Foam::tmp<Foam::volScalarField> Foam::twoPhaseSystem::Kh() const
{
return heatTransfer_->K();
}
Foam::tmp<Foam::volVectorField> Foam::twoPhaseSystem::liftForce() const
Foam::tmp<Foam::volVectorField> Foam::twoPhaseSystem::F() const
{
return lift_->F<vector>();
return lift_->F<vector>() + wallLubrication_->F<vector>();
}
Foam::tmp<Foam::volVectorField>
Foam::twoPhaseSystem::wallLubricationForce() const
Foam::tmp<Foam::surfaceScalarField> Foam::twoPhaseSystem::Ff() const
{
return wallLubrication_->F<vector>();
return lift_->Ff() + wallLubrication_->Ff();
}
Foam::tmp<Foam::volVectorField>
Foam::twoPhaseSystem::turbulentDispersionForce() const
{
return turbulentDispersion_->F<vector>();
}
Foam::tmp<Foam::volScalarField>
Foam::twoPhaseSystem::turbulentDiffusivity() const
Foam::tmp<Foam::volScalarField> Foam::twoPhaseSystem::D() const
{
return turbulentDispersion_->D();
}
@ -354,6 +365,13 @@ void Foam::twoPhaseSystem::solve()
const surfaceScalarField& phi1 = phase1_.phi();
const surfaceScalarField& phi2 = phase2_.phi();
Switch faceMomentum
(
//pimple.dict().lookupOrDefault<Switch>("faceMomentum", false)
mesh_.solutionDict().subDict("PIMPLE")
.lookupOrDefault<Switch>("faceMomentum", false)
);
const dictionary& alphaControls = mesh_.solverDict
(
alpha1.name()
@ -381,18 +399,40 @@ void Foam::twoPhaseSystem::solve()
if (implicitPhasePressure)
{
const volScalarField& rAU1 = mesh_.lookupObject<volScalarField>
(
IOobject::groupName("rAU", phase1_.name())
);
const volScalarField& rAU2 = mesh_.lookupObject<volScalarField>
(
IOobject::groupName("rAU", phase2_.name())
);
if (faceMomentum)
{
const surfaceScalarField& rAU1f =
mesh_.lookupObject<surfaceScalarField>
(
IOobject::groupName("rAUf", phase1_.name())
);
const surfaceScalarField& rAU2f =
mesh_.lookupObject<surfaceScalarField>
(
IOobject::groupName("rAUf", phase2_.name())
);
pPrimeByA =
fvc::interpolate(rAU1*phase1_.turbulence().pPrime())
+ fvc::interpolate(rAU2*phase2_.turbulence().pPrime());
volScalarField D(this->D());
pPrimeByA =
rAU1f*fvc::interpolate(D + phase1_.turbulence().pPrime())
+ rAU2f*fvc::interpolate(D + phase2_.turbulence().pPrime());
}
else
{
const volScalarField& rAU1 = mesh_.lookupObject<volScalarField>
(
IOobject::groupName("rAU", phase1_.name())
);
const volScalarField& rAU2 = mesh_.lookupObject<volScalarField>
(
IOobject::groupName("rAU", phase2_.name())
);
pPrimeByA =
fvc::interpolate(rAU1*phase1_.turbulence().pPrime())
+ fvc::interpolate(rAU2*phase2_.turbulence().pPrime());
}
surfaceScalarField phiP
(
@ -596,8 +636,21 @@ bool Foam::twoPhaseSystem::read()
}
const Foam::dragModel&
Foam::twoPhaseSystem::drag(const phaseModel& phase) const
const Foam::dimensionedScalar&
Foam::twoPhaseSystem::residualAlpha(const phaseModel& phase) const
{
if (drag_->hasModel(phase))
{
return drag_->phaseModel(phase).residualAlpha();
}
else
{
return zeroResidualAlpha_;
}
}
const Foam::dragModel& Foam::twoPhaseSystem::drag(const phaseModel& phase) const
{
return drag_->phaseModel(phase);
}

View File

@ -40,13 +40,13 @@ SourceFiles
#include "orderedPhasePair.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "dragModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class dragModel;
class virtualMassModel;
class heatTransferModel;
class liftModel;
@ -113,6 +113,9 @@ class twoPhaseSystem
autoPtr<BlendedInterfacialModel<turbulentDispersionModel> >
turbulentDispersion_;
//-
static dimensionedScalar zeroResidualAlpha_;
// Private member functions
@ -141,26 +144,29 @@ public:
tmp<volVectorField> U() const;
//- Return the drag coefficient
tmp<volScalarField> dragCoeff() const;
tmp<volScalarField> Kd() const;
//- Return the face drag coefficient
tmp<surfaceScalarField> Kdf() const;
//- Return the virtual mass coefficient
tmp<volScalarField> virtualMassCoeff() const;
tmp<volScalarField> Vm() const;
//- Return the face virtual mass coefficient
tmp<surfaceScalarField> Vmf() const;
//- Return the heat transfer coefficient
tmp<volScalarField> heatTransferCoeff() const;
tmp<volScalarField> Kh() const;
//- Return the lift force
tmp<volVectorField> liftForce() const;
//- Return the combined force (lift + wall-lubrication)
tmp<volVectorField> F() const;
//- Return the wall lubrication force
tmp<volVectorField> wallLubricationForce() const;
//- Return the combined face-force (lift + wall-lubrication)
tmp<surfaceScalarField> Ff() const;
//- Return the turbulent diffusivity
// Multiplies the phase-fraction gradient
tmp<volScalarField> turbulentDiffusivity() const;
//- Return the turbulent dispersion force
tmp<volVectorField> turbulentDispersionForce() const;
tmp<volScalarField> D() const;
//- Solve for the two-phase-fractions
void solve();
@ -176,10 +182,17 @@ public:
// Access
//- Return the drag model for the supplied phase
//- Return the residual phase-fraction for given phase
// Used to stabilize the phase momentum as the phase-fraction -> 0
const dimensionedScalar& residualAlpha
(
const phaseModel& phase
) const;
//- Return the drag model for the given phase
const dragModel& drag(const phaseModel& phase) const;
//- Return the virtual mass model for the supplied phase
//- Return the virtual mass model for the given phase
const virtualMassModel& virtualMass(const phaseModel& phase) const;
//- Return the surface tension coefficient