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();
68 dragModel::typeName +
":K",
76 template<
class BasePhaseSystem>
80 const phasePairKey&
key 83 if (dragModels_.found(
key))
85 return dragModels_[
key]->Kf();
91 dragModel::typeName +
":K",
99 template<
class BasePhaseSystem>
103 const phasePairKey&
key 106 if (virtualMassModels_.found(
key))
108 return virtualMassModels_[
key]->K();
114 virtualMassModel::typeName +
":K",
122 template<
class BasePhaseSystem>
128 phaseSystem::phasePairTable,
133 const phasePair& pair(phasePairIter());
146 if (!pair.phase1().stationary())
151 eqn += dmdt21*pair.phase2().U() -
fvm::Sp(dmdt21, eqn.psi());
154 if (!pair.phase2().stationary())
159 eqn -= dmdt12*pair.phase1().U() -
fvm::Sp(dmdt12, eqn.psi());
167 template<
class BasePhaseSystem>
174 BasePhaseSystem(
mesh)
176 this->generatePairsAndSubModels
182 this->generatePairsAndSubModels
188 this->generatePairsAndSubModels
194 this->generatePairsAndSubModels
197 wallLubricationModels_
200 this->generatePairsAndSubModels
202 "turbulentDispersion",
203 turbulentDispersionModels_
213 const phasePair& pair(this->phasePairs_[dragModelIter.key()]);
231 dragModelIter()->Kf()
243 const phasePair& pair(this->phasePairs_[virtualMassModelIter.key()]);
251 virtualMassModelIter()->K()
261 virtualMassModelIter()->Kf()
270 template<
class BasePhaseSystem>
278 template<
class BasePhaseSystem>
290 forAll(this->movingPhases(), movingPhasei)
309 *Kds_[dragModelIter.key()] = dragModelIter()->K();
310 *Kdfs_[dragModelIter.key()] = dragModelIter()->Kf();
317 const phasePair& pair(this->phasePairs_[KdIter.key()]);
321 if (!iter().stationary())
333 virtualMassModelTable,
338 *Vms_[virtualMassModelIter.key()] = virtualMassModelIter()->K();
339 *Vmfs_[virtualMassModelIter.key()] = virtualMassModelIter()->Kf();
346 const phasePair& pair(this->phasePairs_[VmIter.key()]);
350 const phaseModel& phase = iter();
351 const phaseModel& otherPhase = iter.otherPhase();
353 if (!phase.stationary())
368 + this->MRF_.DDt(Vm,
U - otherPhase.U());
374 addMassTransferMomentumTransfer(eqns);
380 template<
class BasePhaseSystem>
392 forAll(this->movingPhases(), movingPhasei)
404 PtrList<fvVectorMatrix> UgradUs(this->phaseModels_.size());
407 const phaseModel& phase = this->phaseModels_[
phasei];
409 if (!phase.stationary())
430 const phasePair& pair(this->phasePairs_[VmIter.key()]);
434 const phaseModel& phase = iter();
435 const phaseModel& otherPhase = iter.otherPhase();
437 if (!phase.stationary())
439 *eqns[phase.name()] -=
442 UgradUs[phase.index()]
443 - (UgradUs[otherPhase.index()] & otherPhase.U())
450 addMassTransferMomentumTransfer(eqns);
456 template<
class BasePhaseSystem>
466 const phasePair& pair(this->phasePairs_[KdfIter.key()]);
470 this->addField(iter(),
"AFf", Kf,
AFfs);
478 const phasePair& pair(this->phasePairs_[VmfIter.key()]);
486 if (this->fillFields_)
495 template<
class BasePhaseSystem>
513 const phasePair& pair(this->phasePairs_[liftModelIter.key()]);
534 wallLubricationModelTable,
535 wallLubricationModels_,
536 wallLubricationModelIter
541 pair(this->phasePairs_[wallLubricationModelIter.key()]);
563 const phaseModel& phase = this->phaseModels_[
phasei];
577 const bool implicitPhasePressure =
578 this->mesh_.solverDict(phase.volScalarField::name()).
579 template getOrDefault<Switch>
581 "implicitPhasePressure",
585 if (implicitPhasePressure)
587 this->addField(phase,
"DByAf", pPrimeByAf, DByAfs_);
594 turbulentDispersionModelTable,
595 turbulentDispersionModels_,
596 turbulentDispersionModelIter
600 pair(this->phasePairs_[turbulentDispersionModelIter.key()]);
621 if (DByAfs_.found(pair.phase1().name()))
623 this->addField(pair.phase1(),
"DByAf", DByA1f, DByAfs_);
627 if (this->fillFields_)
636 template<
class BasePhaseSystem>
649 const phasePair& pair(this->phasePairs_[VmfIter.key()]);
660 + iter.otherPhase().DUDtf()
676 const phasePair& pair(this->phasePairs_[liftModelIter.key()]);
682 rAUfs[pair.phase1().index()]*
Ff,
689 -
rAUfs[pair.phase2().index()]*
Ff,
697 wallLubricationModelTable,
698 wallLubricationModels_,
699 wallLubricationModelIter
704 pair(this->phasePairs_[wallLubricationModelIter.key()]);
710 rAUfs[pair.phase1().index()]*
Ff,
717 -
rAUfs[pair.phase2().index()]*
Ff,
726 const phaseModel& phase = this->phaseModels_[
phasei];
740 const bool implicitPhasePressure =
741 this->mesh_.solverDict(phase.volScalarField::name()).
742 template getOrDefault<Switch>
744 "implicitPhasePressure",
748 if (implicitPhasePressure)
750 this->addField(phase,
"DByAf", pPrimeByAf, DByAfs_);
757 turbulentDispersionModelTable,
758 turbulentDispersionModels_,
759 turbulentDispersionModelIter
763 pair(this->phasePairs_[turbulentDispersionModelIter.key()]);
784 if (DByAfs_.found(pair.phase1().name()))
786 this->addField(pair.phase1(),
"DByAf", DByAf1, DByAfs_);
790 if (this->fillFields_)
799 template<
class BasePhaseSystem>
812 const phasePair& pair(this->phasePairs_[KdIter.key()]);
827 if (this->fillFields_)
841 template<
class BasePhaseSystem>
854 const phasePair& pair(this->phasePairs_[KdfIter.key()]);
862 -
rAUfs[iter().index()]*Kf
869 if (this->fillFields_)
883 template<
class BasePhaseSystem>
896 const phasePair& pair(this->phasePairs_[KdIter.key()]);
904 -
rAUs[iter().index()]*
K*iter.otherPhase().U(),
910 if (this->fillFields_)
919 template<
class BasePhaseSystem>
924 const bool includeVirtualMass
946 const phaseModel& phase = this->phaseModels_[
phasei];
955 tmp<surfaceScalarField> phiCorrCoeff =
pos0(alphafBar - 0.99);
958 phiCorrCoeff.ref().boundaryFieldRef();
960 forAll(this->mesh_.boundary(), patchi)
965 !this->mesh_.boundary()[patchi].coupled()
966 || isA<cyclicAMIFvPatch>(this->mesh_.boundary()[patchi])
969 phiCorrCoeffBf[patchi] = 0;
986 if (includeVirtualMass)
991 const phasePair& pair(this->phasePairs_[VmIter.key()]);
995 const phaseModel& phase = iter();
996 const phaseModel& otherPhase = iter.otherPhase();
1004 phiCorrs[phase.index()]
1007 - phiCorrs[otherPhase.index()]
1019 template<
class BasePhaseSystem>
1025 Info<<
"Inverting drag systems: ";
1051 const phasePair& pair(this->phasePairs_[KdIter.key()]);
1053 const label phase1i = pair.phase1().index();
1054 const label phase2i = pair.phase2().index();
1099 for (label j = i + 1; j <
phases.
size(); ++ j)
1101 KdByAs[i][j] /= KdByAs[i][i];
1102 phiKds[i][j] /= phiKds[i][i];
1105 KdByAs[j][
k] -= KdByAs[j][i]*KdByAs[i][
k];
1106 phiKds[j][
k] -= phiKds[j][i]*phiKds[i][
k];
1115 detKdByAs *= KdByAs[i][i];
1116 detPhiKdfs *= phiKds[i][i];
1118 Info<<
"Min cell/face det = " <<
gMin(detKdByAs.primitiveField())
1119 <<
"/" <<
gMin(detPhiKdfs.primitiveField()) <<
endl;
1125 if (!
phases[i].stationary())
1127 for (label j = 0; j < i; j ++)
1134 for (label i =
phases.
size() - 1; i >= 0; i --)
1136 if (!
phases[i].stationary())
1138 for (label j =
phases.
size() - 1; j > i; j --)
1143 phases[i].URef() /= KdByAs[i][i];
1144 phases[i].phiRef() /= phiKds[i][i];
1150 template<
class BasePhaseSystem>
1153 const PtrList<surfaceScalarField>&
rAUfs 1156 Info<<
"Inverting drag system: ";
1161 PtrList<PtrList<surfaceScalarField>> phiKdfs(
phases.
size());
1168 new PtrList<surfaceScalarField>(
phases.
size())
1175 const phasePair& pair(this->phasePairs_[KdfIter.key()]);
1177 const label phase1i = pair.phase1().index();
1178 const label phase2i = pair.phase2().index();
1206 for (label j = i + 1; j <
phases.
size(); ++ j)
1208 phiKdfs[i][j] /= phiKdfs[i][i];
1211 phiKdfs[j][
k] -= phiKdfs[j][i]*phiKdfs[i][
k];
1219 detPhiKdfs *= phiKdfs[i][i];
1221 Info<<
"Min face det = " <<
gMin(detPhiKdfs.primitiveField()) <<
endl;
1227 if (!
phases[i].stationary())
1229 for (label j = 0; j < i; j ++)
1235 for (label i =
phases.
size() - 1; i >= 0; i --)
1237 if (!
phases[i].stationary())
1239 for (label j =
phases.
size() - 1; j > i; j --)
1243 phases[i].phiRef() /= phiKdfs[i][i];
1249 template<
class BasePhaseSystem>
1257 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