31#include "BlendedInterfacialModel.H"
33#include "virtualMassModel.H"
35#include "wallLubricationModel.H"
36#include "turbulentDispersionModel.H"
53template<
class BasePhaseSystem>
57 const phasePairKey& key
60 if (dragModels_.found(key))
62 return dragModels_[
key]->K();
66 return volScalarField::New
68 dragModel::typeName +
":K",
76template<
class BasePhaseSystem>
80 const phasePairKey& key
83 if (dragModels_.found(key))
85 return dragModels_[
key]->Kf();
89 return surfaceScalarField::New
91 dragModel::typeName +
":K",
99template<
class BasePhaseSystem>
103 const phasePairKey& key
106 if (virtualMassModels_.found(key))
108 return virtualMassModels_[
key]->K();
112 return volScalarField::New
114 virtualMassModel::typeName +
":K",
122template<
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());
167template<
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()
270template<
class BasePhaseSystem>
278template<
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())
338 *Vms_[virtualMassModelIter.key()] = virtualMassModelIter()->K();
339 *Vmfs_[virtualMassModelIter.key()] = virtualMassModelIter()->Kf();
346 const phasePair& pair(this->phasePairs_[VmIter.key()]);
353 if (!
phase.stationary())
368 + this->MRF_.DDt(Vm,
U - otherPhase.
U());
374 addMassTransferMomentumTransfer(eqns);
380template<
class BasePhaseSystem>
392 forAll(this->movingPhases(), movingPhasei)
409 if (!
phase.stationary())
430 const phasePair& pair(this->phasePairs_[VmIter.key()]);
437 if (!
phase.stationary())
442 UgradUs[
phase.index()]
443 - (UgradUs[otherPhase.
index()] & otherPhase.
U())
450 addMassTransferMomentumTransfer(eqns);
456template<
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_)
495template<
class BasePhaseSystem>
513 const phasePair& pair(this->phasePairs_[liftModelIter.key()]);
535 wallLubricationModels_,
536 wallLubricationModelIter
541 pair(this->phasePairs_[wallLubricationModelIter.key()]);
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_);
595 turbulentDispersionModels_,
596 turbulentDispersionModelIter
600 pair(this->phasePairs_[turbulentDispersionModelIter.key()]);
623 this->addField(pair.
phase1(),
"DByAf", DByA1f, DByAfs_);
627 if (this->fillFields_)
636template<
class BasePhaseSystem>
649 const phasePair& pair(this->phasePairs_[VmfIter.key()]);
660 + iter.otherPhase().DUDtf()
676 const phasePair& pair(this->phasePairs_[liftModelIter.key()]);
698 wallLubricationModels_,
699 wallLubricationModelIter
704 pair(this->phasePairs_[wallLubricationModelIter.key()]);
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_);
758 turbulentDispersionModels_,
759 turbulentDispersionModelIter
763 pair(this->phasePairs_[turbulentDispersionModelIter.key()]);
786 this->addField(pair.
phase1(),
"DByAf", DByAf1, DByAfs_);
790 if (this->fillFields_)
799template<
class BasePhaseSystem>
812 const phasePair& pair(this->phasePairs_[KdIter.key()]);
821 *this->
MRF().absolute(iter.otherPhase().phi()),
827 if (this->fillFields_)
841template<
class BasePhaseSystem>
854 const phasePair& pair(this->phasePairs_[KdfIter.key()]);
862 -
rAUfs[iter().index()]*Kf
863 *this->
MRF().absolute(iter.otherPhase().phi()),
869 if (this->fillFields_)
883template<
class BasePhaseSystem>
896 const phasePair& pair(this->phasePairs_[KdIter.key()]);
904 -
rAUs[iter().index()]*
K*iter.otherPhase().U(),
910 if (this->fillFields_)
919template<
class BasePhaseSystem>
924 const bool includeVirtualMass
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()]);
1004 phiCorrs[
phase.index()]
1005 + this->MRF().absolute(otherPhase.
phi())
1007 - phiCorrs[otherPhase.
index()]
1019template<
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();
1097 for (label i = 0; i <
phases.size(); ++ i)
1099 for (label j = i + 1; j <
phases.size(); ++ j)
1101 KdByAs[i][j] /= KdByAs[i][i];
1102 phiKds[i][j] /= phiKds[i][i];
1103 for (label
k = i + 1;
k <
phases.size(); ++
k)
1105 KdByAs[j][
k] -= KdByAs[j][i]*KdByAs[i][
k];
1106 phiKds[j][
k] -= phiKds[j][i]*phiKds[i][
k];
1113 for (label i = 1; i <
phases.size(); ++ i)
1115 detKdByAs *= KdByAs[i][i];
1116 detPhiKdfs *= phiKds[i][i];
1123 for (label i = 1; i <
phases.size(); ++ i)
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];
1150template<
class BasePhaseSystem>
1156 Info<<
"Inverting drag system: ";
1175 const phasePair& pair(this->phasePairs_[KdfIter.key()]);
1177 const label phase1i = pair.
phase1().index();
1178 const label phase2i = pair.
phase2().index();
1204 for (label i = 0; i <
phases.size(); ++ i)
1206 for (label j = i + 1; j <
phases.size(); ++ j)
1208 phiKdfs[i][j] /= phiKdfs[i][i];
1209 for (label
k = i + 1;
k <
phases.size(); ++
k)
1211 phiKdfs[j][
k] -= phiKdfs[j][i]*phiKdfs[i][
k];
1217 for (label i = 1; i <
phases.size(); ++ i)
1219 detPhiKdfs *= phiKdfs[i][i];
1225 for (label i = 1; i <
phases.size(); ++ i)
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];
1249template<
class BasePhaseSystem>
1257template<
class BasePhaseSystem>
1260 if (BasePhaseSystem::read())
CGAL::Exact_predicates_exact_constructions_kernel K
const GeometricField< Type, PatchField, GeoMesh > & oldTime() const
Return old time field.
const Internal::FieldType & primitiveField() const
Return a const-reference to the internal field.
A HashTable of pointers to objects of type <T>, with deallocation management of the pointers.
bool set(const Key &key, T *ptr)
Assign a new entry, overwriting existing entries.
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
Class which models interfacial momenum transfer between a number of phases. Drag, virtual mass,...
virtual PtrList< surfaceScalarField > AFfs() const
Return implicit force coefficients on the faces, for the face-based.
virtual PtrList< surfaceScalarField > phiFs(const PtrList< volScalarField > &rAUs)
Return the explicit force fluxes for the cell-based algorithm, that.
virtual autoPtr< phaseSystem::momentumTransferTable > momentumTransfer()
Return the momentum transfer matrices for the cell-based algorithm.
virtual PtrList< surfaceScalarField > ddtCorrByAs(const PtrList< volScalarField > &rAUs, const bool includeVirtualMass=false) const
Return the flux corrections for the cell-based algorithm. These.
virtual void partialElimination(const PtrList< volScalarField > &rAUs)
Solve the drag system for the velocities and fluxes.
virtual PtrList< surfaceScalarField > phiKdPhifs(const PtrList< surfaceScalarField > &rAUfs) const
As phiKdPhis, but for the face-based algorithm.
virtual ~MomentumTransferPhaseSystem()
Destructor.
virtual PtrList< volVectorField > KdUByAs(const PtrList< volScalarField > &rAUs) const
Return the explicit part of the drag force for the cell-based.
virtual const HashPtrTable< surfaceScalarField > & DByAfs() const
Return the phase diffusivities divided by the momentum coefficients.
virtual void partialEliminationf(const PtrList< surfaceScalarField > &rAUfs)
As partialElimination, but for the face-based algorithm. Only solves.
virtual PtrList< surfaceScalarField > phiFfs(const PtrList< surfaceScalarField > &rAUfs)
As phiFs, but for the face-based algorithm.
virtual autoPtr< phaseSystem::momentumTransferTable > momentumTransferf()
As momentumTransfer, but for the face-based algorithm.
virtual PtrList< surfaceScalarField > phiKdPhis(const PtrList< volScalarField > &rAUs) const
Return the explicit drag force fluxes for the cell-based algorithm.
virtual bool read()
Read base phaseProperties dictionary.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
const T * set(const label i) const
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A special matrix type and solver, designed for finite volume solutions of scalar equations....
const GeometricField< Type, fvPatchField, volMesh > & psi(const label i=0) const
Return psi.
Mesh data needed to do the Finite Volume discretisation.
const word & name() const
The name of this phase.
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
const volVectorField & U() const
const surfaceScalarField & phi() const
const phaseModel & otherPhase() const
Return the other phase in this two-phase system.
virtual tmp< volVectorField > DUDt() const =0
Return the substantive acceleration.
label index() const
Return the index of the phase.
Description for mass transfer between a pair of phases. The direction of the mass transfer is from th...
virtual word name() const
Pair name.
const multiphaseInter::phaseModel & phase1() const
const multiphaseInter::phaseModel & phase2() const
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
const word & name() const
const dimensionedScalar & rho() const
Return const-access to phase1 density.
A class for managing temporary objects.
tmp< volScalarField > Kd() const
Return the drag coefficient.
tmp< surfaceScalarField > Kdf() const
Return the face drag coefficient.
tmp< volScalarField > Vm() const
Return the virtual mass coefficient.
Info<< "Creating field kinetic energy K\n"<< 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()
Area-weighted average a surfaceField creating a volField.
Calculate the first temporal derivative.
Calculate the divergence of the given field.
Calculate the face-flux of the given field.
Calculate the snGrad of the given volField.
Calculate the matrix for the first temporal derivative.
Calculate the matrix for the divergence of the given field and flux.
Calculate the finiteVolume matrix for implicit and explicit sources.
PtrList< surfaceScalarField > phiFs(fluid.phiFs(rAUs))
fluid fillFields("rAU", dimTime/dimDensity, rAUs)
PtrList< surfaceScalarField > phiFfs(fluid.phiFfs(rAUfs))
PtrList< volScalarField > rAUs
PtrList< surfaceScalarField > rAUfs
PtrList< surfaceScalarField > AFfs(fluid.AFfs())
volVectorField F(fluid.F())
surfaceScalarField snGradAlpha1(fvc::snGrad(alpha1) *mesh.magSf())
surfaceScalarField Vmf("Vmf", fluid.Vmf())
surfaceScalarField Ff(fluid.Ff())
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.
tmp< GeometricField< Type, fvPatchField, volMesh > > average(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Area-weighted average a surfaceField creating a volField.
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
tmp< surfaceScalarField > flux(const volVectorField &vvf)
Return the face-flux field obtained from the given volVectorField.
tmp< fvMatrix< Type > > div(const surfaceScalarField &flux, const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
tmp< fvMatrix< Type > > ddt(const GeometricField< Type, fvPatchField, volMesh > &vf)
zeroField Sp(const Foam::zero, const GeometricField< Type, fvPatchField, volMesh > &)
A no-op source.
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const dimensionSet dimless
Dimensionless.
dimensionedScalar pos0(const dimensionedScalar &ds)
tmp< volScalarField > byDt(const volScalarField &vf)
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
const dimensionSet dimVelocity
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensionedScalar negPart(const dimensionedScalar &ds)
fvMatrix< vector > fvVectorMatrix
const dimensionSet dimForce
Type gMin(const FieldField< Field, Type > &f)
const dimensionSet dimDensity
dimensionedScalar posPart(const dimensionedScalar &ds)
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
const dimensionedScalar & D
multiphaseSystem::phaseModelList & phases
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object.