31 #include "BlendedInterfacialModel.H" 32 #include "dragModel.H" 33 #include "virtualMassModel.H" 34 #include "liftModel.H" 35 #include "wallLubricationModel.H" 36 #include "turbulentDispersionModel.H" 53 template<
class BasePhaseSystem>
57 const phasePairKey&
key 60 if (dragModels_.found(
key))
62 return dragModels_[
key]->K();
67 IOobject::scopedName(dragModel::typeName,
"K"),
68 IOobject::NO_REGISTER,
75 template<
class BasePhaseSystem>
79 const phasePairKey&
key 82 if (dragModels_.found(
key))
84 return dragModels_[
key]->Kf();
89 IOobject::scopedName(dragModel::typeName,
"K"),
90 IOobject::NO_REGISTER,
97 template<
class BasePhaseSystem>
101 const phasePairKey&
key 104 if (virtualMassModels_.found(
key))
106 return virtualMassModels_[
key]->K();
111 IOobject::scopedName(virtualMassModel::typeName,
"K"),
112 IOobject::NO_REGISTER,
119 template<
class BasePhaseSystem>
125 phaseSystem::phasePairTable,
130 const phasePair& pair(phasePairIter());
143 if (!pair.phase1().stationary())
148 eqn += dmdt21*pair.phase2().U() -
fvm::Sp(dmdt21, eqn.psi());
151 if (!pair.phase2().stationary())
156 eqn -= dmdt12*pair.phase1().U() -
fvm::Sp(dmdt12, eqn.psi());
164 template<
class BasePhaseSystem>
171 BasePhaseSystem(
mesh)
173 this->generatePairsAndSubModels
179 this->generatePairsAndSubModels
185 this->generatePairsAndSubModels
191 this->generatePairsAndSubModels
194 wallLubricationModels_
197 this->generatePairsAndSubModels
199 "turbulentDispersion",
200 turbulentDispersionModels_
210 const phasePair& pair(this->phasePairs_[dragModelIter.key()]);
228 dragModelIter()->Kf()
240 const phasePair& pair(this->phasePairs_[virtualMassModelIter.key()]);
248 virtualMassModelIter()->K()
258 virtualMassModelIter()->Kf()
267 template<
class BasePhaseSystem>
275 template<
class BasePhaseSystem>
287 forAll(this->movingPhases(), movingPhasei)
306 *Kds_[dragModelIter.key()] = dragModelIter()->K();
307 *Kdfs_[dragModelIter.key()] = dragModelIter()->Kf();
314 const phasePair& pair(this->phasePairs_[KdIter.key()]);
318 if (!iter().stationary())
330 virtualMassModelTable,
335 *Vms_[virtualMassModelIter.key()] = virtualMassModelIter()->K();
336 *Vmfs_[virtualMassModelIter.key()] = virtualMassModelIter()->Kf();
343 const phasePair& pair(this->phasePairs_[VmIter.key()]);
347 const phaseModel& phase = iter();
348 const phaseModel& otherPhase = iter.otherPhase();
350 if (!phase.stationary())
355 const tmp<surfaceScalarField> tphi(phase.phi());
366 + this->MRF_.DDt(Vm,
U - otherPhase.U());
372 addMassTransferMomentumTransfer(eqns);
378 template<
class BasePhaseSystem>
390 forAll(this->movingPhases(), movingPhasei)
402 PtrList<fvVectorMatrix> UgradUs(this->phaseModels_.size());
405 const phaseModel& phase = this->phaseModels_[
phasei];
407 if (!phase.stationary())
409 const tmp<volVectorField> tU(phase.U());
429 const phasePair& pair(this->phasePairs_[VmIter.key()]);
433 const phaseModel& phase = iter();
434 const phaseModel& otherPhase = iter.otherPhase();
436 if (!phase.stationary())
438 *eqns[phase.name()] -=
441 UgradUs[phase.index()]
442 - (UgradUs[otherPhase.index()] & otherPhase.U())
449 addMassTransferMomentumTransfer(eqns);
455 template<
class BasePhaseSystem>
465 const phasePair& pair(this->phasePairs_[KdfIter.key()]);
469 this->addField(iter(),
"AFf", Kf,
AFfs);
477 const phasePair& pair(this->phasePairs_[VmfIter.key()]);
485 if (this->fillFields_)
494 template<
class BasePhaseSystem>
512 const phasePair& pair(this->phasePairs_[liftModelIter.key()]);
533 wallLubricationModelTable,
534 wallLubricationModels_,
535 wallLubricationModelIter
540 pair(this->phasePairs_[wallLubricationModelIter.key()]);
562 const phaseModel& phase = this->phaseModels_[
phasei];
576 const bool implicitPhasePressure =
577 this->mesh_.solverDict(phase.volScalarField::name()).
578 template getOrDefault<Switch>
580 "implicitPhasePressure",
584 if (implicitPhasePressure)
586 this->addField(phase,
"DByAf", pPrimeByAf, DByAfs_);
593 turbulentDispersionModelTable,
594 turbulentDispersionModels_,
595 turbulentDispersionModelIter
599 pair(this->phasePairs_[turbulentDispersionModelIter.key()]);
620 if (DByAfs_.found(pair.phase1().name()))
622 this->addField(pair.phase1(),
"DByAf", DByA1f, DByAfs_);
626 if (this->fillFields_)
635 template<
class BasePhaseSystem>
648 const phasePair& pair(this->phasePairs_[VmfIter.key()]);
659 + iter.otherPhase().DUDtf()
675 const phasePair& pair(this->phasePairs_[liftModelIter.key()]);
681 rAUfs[pair.phase1().index()]*
Ff,
688 -
rAUfs[pair.phase2().index()]*
Ff,
696 wallLubricationModelTable,
697 wallLubricationModels_,
698 wallLubricationModelIter
703 pair(this->phasePairs_[wallLubricationModelIter.key()]);
709 rAUfs[pair.phase1().index()]*
Ff,
716 -
rAUfs[pair.phase2().index()]*
Ff,
725 const phaseModel& phase = this->phaseModels_[
phasei];
739 const bool implicitPhasePressure =
740 this->mesh_.solverDict(phase.volScalarField::name()).
741 template getOrDefault<Switch>
743 "implicitPhasePressure",
747 if (implicitPhasePressure)
749 this->addField(phase,
"DByAf", pPrimeByAf, DByAfs_);
756 turbulentDispersionModelTable,
757 turbulentDispersionModels_,
758 turbulentDispersionModelIter
762 pair(this->phasePairs_[turbulentDispersionModelIter.key()]);
783 if (DByAfs_.found(pair.phase1().name()))
785 this->addField(pair.phase1(),
"DByAf", DByAf1, DByAfs_);
789 if (this->fillFields_)
798 template<
class BasePhaseSystem>
811 const phasePair& pair(this->phasePairs_[KdIter.key()]);
826 if (this->fillFields_)
840 template<
class BasePhaseSystem>
853 const phasePair& pair(this->phasePairs_[KdfIter.key()]);
861 -
rAUfs[iter().index()]*Kf
868 if (this->fillFields_)
882 template<
class BasePhaseSystem>
895 const phasePair& pair(this->phasePairs_[KdIter.key()]);
903 -
rAUs[iter().index()]*
K*iter.otherPhase().U(),
909 if (this->fillFields_)
918 template<
class BasePhaseSystem>
923 const bool includeVirtualMass
945 const phaseModel& phase = this->phaseModels_[
phasei];
954 tmp<surfaceScalarField> phiCorrCoeff =
pos0(alphafBar - 0.99);
957 phiCorrCoeff.ref().boundaryFieldRef();
959 forAll(this->mesh_.boundary(), patchi)
964 !this->mesh_.boundary()[patchi].coupled()
965 || isA<cyclicAMIFvPatch>(this->mesh_.boundary()[patchi])
968 phiCorrCoeffBf[patchi] = 0;
985 if (includeVirtualMass)
990 const phasePair& pair(this->phasePairs_[VmIter.key()]);
994 const phaseModel& phase = iter();
995 const phaseModel& otherPhase = iter.otherPhase();
1003 phiCorrs[phase.index()]
1006 - phiCorrs[otherPhase.index()]
1018 template<
class BasePhaseSystem>
1024 Info<<
"Inverting drag systems: ";
1050 const phasePair& pair(this->phasePairs_[KdIter.key()]);
1052 const label phase1i = pair.phase1().index();
1053 const label phase2i = pair.phase2().index();
1098 for (label j = i + 1; j <
phases.
size(); ++ j)
1100 KdByAs[i][j] /= KdByAs[i][i];
1101 phiKds[i][j] /= phiKds[i][i];
1104 KdByAs[j][
k] -= KdByAs[j][i]*KdByAs[i][
k];
1105 phiKds[j][
k] -= phiKds[j][i]*phiKds[i][
k];
1114 detKdByAs *= KdByAs[i][i];
1115 detPhiKdfs *= phiKds[i][i];
1117 Info<<
"Min cell/face det = " <<
gMin(detKdByAs.primitiveField())
1118 <<
"/" <<
gMin(detPhiKdfs.primitiveField()) <<
endl;
1124 if (!
phases[i].stationary())
1126 for (label j = 0; j < i; j ++)
1133 for (label i =
phases.
size() - 1; i >= 0; i --)
1135 if (!
phases[i].stationary())
1137 for (label j =
phases.
size() - 1; j > i; j --)
1142 phases[i].URef() /= KdByAs[i][i];
1143 phases[i].phiRef() /= phiKds[i][i];
1149 template<
class BasePhaseSystem>
1152 const PtrList<surfaceScalarField>&
rAUfs 1155 Info<<
"Inverting drag system: ";
1160 PtrList<PtrList<surfaceScalarField>> phiKdfs(
phases.
size());
1167 new PtrList<surfaceScalarField>(
phases.
size())
1174 const phasePair& pair(this->phasePairs_[KdfIter.key()]);
1176 const label phase1i = pair.phase1().index();
1177 const label phase2i = pair.phase2().index();
1205 for (label j = i + 1; j <
phases.
size(); ++ j)
1207 phiKdfs[i][j] /= phiKdfs[i][i];
1210 phiKdfs[j][
k] -= phiKdfs[j][i]*phiKdfs[i][
k];
1218 detPhiKdfs *= phiKdfs[i][i];
1220 Info<<
"Min face det = " <<
gMin(detPhiKdfs.primitiveField()) <<
endl;
1226 if (!
phases[i].stationary())
1228 for (label j = 0; j < i; j ++)
1234 for (label i =
phases.
size() - 1; i >= 0; i --)
1236 if (!
phases[i].stationary())
1238 for (label j =
phases.
size() - 1; j > i; j --)
1242 phases[i].phiRef() /= phiKdfs[i][i];
1248 template<
class BasePhaseSystem>
1256 template<
class BasePhaseSystem>
Class which models interfacial momenum transfer between a number of phases. Drag, virtual mass...
PtrList< surfaceScalarField > AFfs(fluid.AFfs())
surfaceScalarField Vmf("Vmf", fluid.Vmf())
multiphaseSystem::phaseModelList & phases
Info<< "Creating field kinetic energy K\"<< endl;volScalarField K("K", 0.5 *magSqr(U));if(U.nOldTimes()){ volVectorField *Uold=&U.oldTime();volScalarField *Kold=&K.oldTime();*Kold==0.5 *magSqr(*Uold);while(Uold->nOldTimes()) { Uold=&Uold-> oldTime()
virtual void partialElimination(const PtrList< volScalarField > &rAUs)
Solve the drag system for the velocities and fluxes.
virtual PtrList< surfaceScalarField > phiKdPhis(const PtrList< volScalarField > &rAUs) const
Return the explicit drag force fluxes for the cell-based algorithm.
virtual void partialEliminationf(const PtrList< surfaceScalarField > &rAUfs)
As partialElimination, but for the face-based algorithm. Only solves.
Type gMin(const FieldField< Field, Type > &f)
virtual autoPtr< phaseSystem::momentumTransferTable > momentumTransfer()
Return the momentum transfer matrices for the cell-based algorithm.
virtual PtrList< surfaceScalarField > phiKdPhifs(const PtrList< surfaceScalarField > &rAUfs) const
As phiKdPhis, but for the face-based algorithm.
tmp< surfaceScalarField > flux(const volVectorField &vvf)
Return the face-flux field obtained from the given volVectorField.
virtual const HashPtrTable< surfaceScalarField > & DByAfs() const
Return the phase diffusivities divided by the momentum coefficients.
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type set(const label i, bool val=true)
A bitSet::set() method for a list of bool.
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
virtual PtrList< surfaceScalarField > phiFfs(const PtrList< surfaceScalarField > &rAUfs)
As phiFs, but for the face-based algorithm.
Ostream & endl(Ostream &os)
Add newline and flush stream.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
virtual PtrList< surfaceScalarField > phiFs(const PtrList< volScalarField > &rAUs)
Return the explicit force fluxes for the cell-based algorithm, that.
MomentumTransferPhaseSystem(const fvMesh &)
Construct from fvMesh.
Calculate the snGrad of the given volField.
GeometricBoundaryField< scalar, fvsPatchField, surfaceMesh > Boundary
Type of boundary fields.
label k
Boltzmann constant.
A HashTable of pointers to objects of type <T>, with deallocation management of the pointers...
const dimensionSet dimless
Dimensionless.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object.
GeometricField< vector, fvPatchField, volMesh > volVectorField
CGAL::Exact_predicates_exact_constructions_kernel K
const surfaceScalarField & phi() const
dimensionedScalar posPart(const dimensionedScalar &ds)
Area-weighted average a surfaceField creating a volField.
#define forAll(list, i)
Loop across all elements in list.
virtual PtrList< volVectorField > KdUByAs(const PtrList< volScalarField > &rAUs) const
Return the explicit part of the drag force for the cell-based.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Calculate the first temporal derivative.
virtual bool read()
Read base phaseProperties dictionary.
virtual autoPtr< phaseSystem::momentumTransferTable > momentumTransferf()
As momentumTransfer, but for the face-based algorithm.
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
Calculate the face-flux of the given field.
PtrList< surfaceScalarField > phiFs(fluid.phiFs(rAUs))
virtual PtrList< surfaceScalarField > ddtCorrByAs(const PtrList< volScalarField > &rAUs, const bool includeVirtualMass=false) const
Return the flux corrections for the cell-based algorithm. These.
label size() const noexcept
The number of entries in the list.
bool set(const Key &key, T *ptr)
Assign a new entry, overwrites existing.
tmp< fvMatrix< Type > > ddt(const GeometricField< Type, fvPatchField, volMesh > &vf)
Calculate the matrix for the first temporal derivative.
PtrList< surfaceScalarField > rAUfs
PtrListDictionary< phaseModel > phaseModelList
virtual PtrList< surfaceScalarField > AFfs() const
Return implicit force coefficients on the faces, for the face-based.
tmp< volScalarField > byDt(const volScalarField &vf)
fluid fillFields("rAU", dimTime/dimDensity, rAUs)
tmp< surfaceScalarField > absolute(const tmp< surfaceScalarField > &phi) const
Return the given relative flux absolute within the MRF region.
volVectorField F(fluid.F())
tmp< volVectorField > DDt(const volVectorField &U) const
Return the frame acceleration.
zeroField Sp(const Foam::zero, const GeometricField< Type, fvPatchField, volMesh > &)
A no-op source.
Calculate the divergence of the given field.
dimensionedScalar pos0(const dimensionedScalar &ds)
const dimensionSet dimForce
tmp< fvMatrix< Type > > div(const surfaceScalarField &flux, const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
static tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
const dimensionSet dimDensity
Calculate the matrix for the divergence of the given field and flux.
tmp< surfaceScalarField > absolute(const tmp< surfaceScalarField > &tphi, const volVectorField &U)
Return the given relative flux in absolute form.
PtrList< volScalarField > rAUs
surfaceScalarField snGradAlpha1(fvc::snGrad(alpha1) *mesh.magSf())
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Mesh data needed to do the Finite Volume discretisation.
virtual ~MomentumTransferPhaseSystem()
Destructor.
fvMatrix< vector > fvVectorMatrix
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
PtrList< surfaceScalarField > phiFfs(fluid.phiFfs(rAUfs))
messageStream Info
Information stream (stdout output on master, null elsewhere)
tmp< GeometricField< Type, fvPatchField, volMesh > > average(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Area-weighted average a surfaceField creating a volField.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
const dimensionedScalar & D
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
A class for managing temporary objects.
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
surfaceScalarField Ff(fluid.Ff())
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
Description for mass transfer between a pair of phases. The direction of the mass transfer is from th...
const word & name() const
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Calculate the finiteVolume matrix for implicit and explicit sources.
dimensionedScalar negPart(const dimensionedScalar &ds)
const dimensionSet dimVelocity