50 template<
class BasePhaseSystem>
54 const phasePairKey& key
57 if (dragModels_.found(key))
59 return dragModels_[key]->K();
65 dragModel::typeName +
":K",
73 template<
class BasePhaseSystem>
77 const phasePairKey& key
80 if (dragModels_.found(key))
82 return dragModels_[key]->Kf();
88 dragModel::typeName +
":K",
96 template<
class BasePhaseSystem>
100 const phasePairKey& key
103 if (virtualMassModels_.found(key))
105 return virtualMassModels_[key]->K();
111 virtualMassModel::typeName +
":K",
121 template<
class BasePhaseSystem>
124 const phaseSystem::dmdtfTable& dmdtfs,
125 phaseSystem::momentumTransferTable& eqns
130 const phasePairKey& key = dmdtfIter.key();
131 const phasePair& pair(this->phasePairs_[key]);
135 phaseModel& phase1 = this->
phases()[pair.phase1().name()];
136 phaseModel& phase2 = this->
phases()[pair.phase2().name()];
141 if (!phase1.stationary())
143 *eqns[phase1.name()] +=
144 dmdtf21*phase2.U() +
fvm::Sp(dmdtf12, phase1.URef());
147 if (!phase2.stationary())
149 *eqns[phase2.name()] -=
150 dmdtf12*phase1.U() +
fvm::Sp(dmdtf21, phase2.URef());
158 template<
class BasePhaseSystem>
165 BasePhaseSystem(mesh)
167 this->generatePairsAndSubModels
173 this->generatePairsAndSubModels
179 this->generatePairsAndSubModels
185 this->generatePairsAndSubModels
188 wallLubricationModels_
191 this->generatePairsAndSubModels
193 "turbulentDispersion",
194 turbulentDispersionModels_
204 const phasePair& pair(this->phasePairs_[dragModelIter.key()]);
214 this->
mesh().time().timeName(),
230 this->
mesh().time().timeName(),
241 virtualMassModelTable,
246 const phasePair& pair(this->phasePairs_[virtualMassModelIter.key()]);
256 this->
mesh().time().timeName(),
272 this->
mesh().time().timeName(),
285 template<
class BasePhaseSystem>
293 template<
class BasePhaseSystem>
298 autoPtr<phaseSystem::momentumTransferTable> eqnsPtr
305 forAll(this->movingPhases(), movingPhasei)
307 const phaseModel& phase = this->movingPhases()[movingPhasei];
324 *Kds_[dragModelIter.key()] = dragModelIter()->K();
325 *Kdfs_[dragModelIter.key()] = dragModelIter()->Kf();
332 const phasePair& pair(this->phasePairs_[KdIter.key()]);
336 if (!iter().stationary())
348 virtualMassModelTable,
353 *Vms_[virtualMassModelIter.key()] = virtualMassModelIter()->K();
354 *Vmfs_[virtualMassModelIter.key()] = virtualMassModelIter()->Kf();
361 const phasePair& pair(this->phasePairs_[VmIter.key()]);
365 const phaseModel& phase = iter();
366 const phaseModel& otherPhase = iter.otherPhase();
368 if (!phase.stationary())
384 + this->MRF_.DDt(Vm, U - otherPhase.U());
393 template<
class BasePhaseSystem>
398 autoPtr<phaseSystem::momentumTransferTable> eqnsPtr
405 forAll(this->movingPhases(), movingPhasei)
407 const phaseModel& phase = this->movingPhases()[movingPhasei];
417 PtrList<fvVectorMatrix> UgradUs(this->phaseModels_.size());
418 forAll(this->phaseModels_, phasei)
420 const phaseModel& phase = this->phaseModels_[
phasei];
422 if (!phase.stationary())
445 const phasePair& pair(this->phasePairs_[VmIter.key()]);
449 const phaseModel& phase = iter();
450 const phaseModel& otherPhase = iter.otherPhase();
452 if (!phase.stationary())
454 *eqns[phase.name()] -=
457 UgradUs[phase.index()]
458 - (UgradUs[otherPhase.index()] & otherPhase.U())
468 template<
class BasePhaseSystem>
472 PtrList<surfaceScalarField> AFfs(this->phaseModels_.size());
478 const phasePair& pair(this->phasePairs_[KdfIter.key()]);
482 addField(iter(),
"AFf", Kf, AFfs);
490 const phasePair& pair(this->phasePairs_[VmfIter.key()]);
494 addField(iter(),
"AFf",
byDt(Vmf), AFfs);
504 template<
class BasePhaseSystem>
508 const PtrList<volScalarField>& rAUs
511 PtrList<surfaceScalarField>
phiFs(this->phaseModels_.size());
522 const phasePair& pair(this->phasePairs_[liftModelIter.key()]);
543 wallLubricationModelTable,
544 wallLubricationModels_,
545 wallLubricationModelIter
550 pair(this->phasePairs_[wallLubricationModelIter.key()]);
569 forAll(this->phaseModels_, phasei)
571 const phaseModel& phase = this->phaseModels_[
phasei];
583 addField(phase,
"phiF", pPrimeByAf*snGradAlpha1,
phiFs);
589 turbulentDispersionModelTable,
590 turbulentDispersionModels_,
591 turbulentDispersionModelIter
595 pair(this->phasePairs_[turbulentDispersionModelIter.key()]);
613 pair.phase1()/
max(alpha12, pair.phase1().residualAlpha())
614 )*this->mesh_.magSf()
620 pair.phase2()/
max(alpha12, pair.phase2().residualAlpha())
621 )*this->mesh_.magSf()
624 addField(pair.phase1(),
"phiF", DByA1f*snGradAlpha1By12,
phiFs);
625 addField(pair.phase2(),
"phiF", DByA2f*snGradAlpha2By12,
phiFs);
628 if (this->fillFields_)
637 template<
class BasePhaseSystem>
641 const PtrList<surfaceScalarField>& rAUfs
644 PtrList<surfaceScalarField>
phiFfs(this->phaseModels_.size());
650 const phasePair& pair(this->phasePairs_[VmfIter.key()]);
658 -rAUfs[iter().index()]*Vmf
668 + iter.otherPhase().DUDtf()
684 const phasePair& pair(this->phasePairs_[liftModelIter.key()]);
690 rAUfs[pair.phase1().index()]*Ff,
697 -rAUfs[pair.phase2().index()]*Ff,
705 wallLubricationModelTable,
706 wallLubricationModels_,
707 wallLubricationModelIter
712 pair(this->phasePairs_[wallLubricationModelIter.key()]);
718 rAUfs[pair.phase1().index()]*Ff,
725 -rAUfs[pair.phase2().index()]*Ff,
731 forAll(this->phaseModels_, phasei)
733 const phaseModel& phase = this->phaseModels_[
phasei];
745 addField(phase,
"phiFf", pPrimeByAf*snGradAlpha1,
phiFfs);
751 turbulentDispersionModelTable,
752 turbulentDispersionModels_,
753 turbulentDispersionModelIter
758 pair(this->phasePairs_[turbulentDispersionModelIter.key()]);
764 rAUfs[pair.phase1().index()]*Ff,
771 -rAUfs[pair.phase2().index()]*Ff,
776 if (this->fillFields_)
785 template<
class BasePhaseSystem>
789 const PtrList<volScalarField>& rAUs
792 PtrList<surfaceScalarField> phiKdPhis(this->phaseModels_.size());
798 const phasePair& pair(this->phasePairs_[KdIter.key()]);
810 iter.otherPhase().U()
817 if (this->fillFields_)
831 template<
class BasePhaseSystem>
835 const PtrList<surfaceScalarField>& rAUfs
838 PtrList<surfaceScalarField> phiKdPhifs(this->phaseModels_.size());
844 const phasePair& pair(this->phasePairs_[KdfIter.key()]);
852 -rAUfs[iter().index()]*Kf
856 iter.otherPhase().U()
863 if (this->fillFields_)
877 template<
class BasePhaseSystem>
881 const PtrList<volScalarField>& rAUs
884 PtrList<volVectorField> KdUByAs(this->phaseModels_.size());
890 const phasePair& pair(this->phasePairs_[KdIter.key()]);
898 -rAUs[iter().index()]*K*iter.otherPhase().U(),
904 if (this->fillFields_)
913 template<
class BasePhaseSystem>
918 this->mesh_.solverDict(phase.volScalarField::name()).
919 template lookupOrDefault<Switch>
921 "implicitPhasePressure",
927 template<
class BasePhaseSystem>
931 bool implicitPressure =
false;
933 forAll(this->phaseModels_, phasei)
935 const phaseModel& phase = this->phaseModels_[
phasei];
937 implicitPressure = implicitPressure || implicitPhasePressure(phase);
940 return implicitPressure;
944 template<
class BasePhaseSystem>
948 const PtrList<volScalarField>& rAUs,
949 const PtrList<surfaceScalarField>& rAUfs
952 PtrList<surfaceScalarField> DByAfs(this->phaseModels_.size());
957 forAll(this->phaseModels_, phasei)
959 const phaseModel& phase = this->phaseModels_[
phasei];
966 addField(phase,
"DByAf", pPrimeByAf, DByAfs);
968 forAll(this->phaseModels_, phasej)
970 if (phasej != phasei)
972 const phaseModel& phase2 = this->phaseModels_[phasej];
981 /
max(1 - phase, phase2.residualAlpha())
992 turbulentDispersionModelTable,
993 turbulentDispersionModels_,
994 turbulentDispersionModelIter
998 pair(this->phasePairs_[turbulentDispersionModelIter.key()]);
1014 rAUfs[pair.phase1().index()]*Df
1015 /
max(alpha12f, pair.phase1().residualAlpha()),
1022 rAUfs[pair.phase2().index()]*Df
1023 /
max(alpha12f, pair.phase2().residualAlpha()),
1031 forAll(this->phaseModels_, phasei)
1033 const phaseModel& phase = this->phaseModels_[
phasei];
1040 addField(phase,
"DByAf", pPrimeByAf, DByAfs);
1042 forAll(this->phaseModels_, phasej)
1044 if (phasej != phasei)
1046 const phaseModel& phase2 = this->phaseModels_[phasej];
1055 /
max(1 - phase, phase2.residualAlpha())
1066 turbulentDispersionModelTable,
1067 turbulentDispersionModels_,
1068 turbulentDispersionModelIter
1072 pair(this->phasePairs_[turbulentDispersionModelIter.key()]);
1084 rAUs[pair.phase1().index()]*D
1085 /
max(alpha12, pair.phase1().residualAlpha())
1095 rAUs[pair.phase2().index()]*D
1096 /
max(alpha12, pair.phase2().residualAlpha())
1107 template<
class BasePhaseSystem>
1111 const PtrList<volScalarField>& rAUs,
1112 const bool includeVirtualMass
1115 PtrList<surfaceScalarField> ddtCorrByAs(this->phaseModels_.size());
1118 PtrList<surfaceScalarField> phiCorrs(this->phaseModels_.size());
1120 forAll(this->movingPhases(), movingPhasei)
1122 const phaseModel& phase = this->movingPhases()[movingPhasei];
1123 const label phasei = phase.index();
1128 this->
MRF().zeroFilter
1132 ? (this->mesh_.Sf() & phase.Uf()().
oldTime())()
1141 forAll(this->movingPhases(), movingPhasei)
1143 const phaseModel& phase = this->movingPhases()[movingPhasei];
1144 const label phasei = phase.index();
1153 tmp<surfaceScalarField> phiCorrCoeff =
pos0(alphafBar - 0.99);
1155 surfaceScalarField::Boundary& phiCorrCoeffBf =
1156 phiCorrCoeff.ref().boundaryFieldRef();
1163 !this->mesh_.boundary()[
patchi].coupled()
1164 || isA<cyclicAMIFvPatch>(this->mesh_.boundary()[
patchi])
1167 phiCorrCoeffBf[
patchi] = 0;
1184 if (includeVirtualMass)
1189 const phasePair& pair(this->phasePairs_[VmIter.key()]);
1193 const phaseModel& phase = iter();
1194 const phaseModel& otherPhase = iter.otherPhase();
1202 phiCorrs[phase.index()]
1209 - phiCorrs[otherPhase.index()]
1221 template<
class BasePhaseSystem>
1224 const PtrList<volScalarField>& rAUs,
1225 const PtrList<volVectorField>& KdUByAs,
1226 const PtrList<surfaceScalarField>& alphafs,
1227 const PtrList<surfaceScalarField>& phiKdPhis
1230 Info<<
"Inverting drag systems: ";
1236 volVectorField Um(this->movingPhases()[0]*this->movingPhases()[0].
U());
1240 label movingPhasei=1;
1241 movingPhasei<this->movingPhases().size();
1246 this->movingPhases()[movingPhasei]
1247 *this->movingPhases()[movingPhasei].U();
1254 if (!phases[i].stationary())
1256 phases[i].URef() += KdUByAs[i];
1257 phases[i].phiRef() += phiKdPhis[i];
1263 PtrList<PtrList<volScalarField>> KdByAs(phases.size());
1264 PtrList<PtrList<surfaceScalarField>> phiKds(phases.size());
1271 new PtrList<volScalarField>(phases.size())
1277 new PtrList<surfaceScalarField>(phases.size())
1284 const phasePair& pair(this->phasePairs_[KdIter.key()]);
1286 const label phase1i = pair.phase1().index();
1287 const label phase2i = pair.phase2().index();
1330 for (
label i = 0; i < phases.size(); i++)
1332 for (
label j = i + 1; j < phases.size(); j++)
1334 KdByAs[i][j] /= KdByAs[i][i];
1335 phiKds[i][j] /= phiKds[i][i];
1336 for (
label k = i + 1;
k < phases.size(); ++
k)
1338 KdByAs[j][
k] -= KdByAs[j][i]*KdByAs[i][
k];
1339 phiKds[j][
k] -= phiKds[j][i]*phiKds[i][
k];
1348 for (
label i = 1; i < phases.size(); i++)
1350 detKdByAs *= KdByAs[i][i];
1351 detPhiKdfs *= phiKds[i][i];
1354 Info<<
"Min cell/face det = " <<
gMin(detKdByAs.primitiveField())
1355 <<
"/" <<
gMin(detPhiKdfs.primitiveField()) <<
endl;
1359 for (
label i = 1; i < phases.size(); i++)
1361 if (!phases[i].stationary())
1363 for (
label j = 0; j < i; j ++)
1365 phases[i].URef() -= KdByAs[i][j]*phases[j].U();
1366 phases[i].phiRef() -= phiKds[i][j]*phases[j].phi();
1370 for (
label i = phases.size() - 1; i >= 0; i--)
1372 if (!phases[i].stationary())
1374 for (
label j = phases.size() - 1; j > i; j--)
1376 phases[i].URef() -= KdByAs[i][j]*phases[j].U();
1377 phases[i].phiRef() -= phiKds[i][j]*phases[j].phi();
1379 phases[i].URef() /= KdByAs[i][i];
1380 phases[i].phiRef() /= phiKds[i][i];
1385 this->setMixtureU(Um);
1386 this->setMixturePhi(alphafs, this->
phi());
1390 template<
class BasePhaseSystem>
1393 const PtrList<surfaceScalarField>& rAUfs,
1394 const PtrList<surfaceScalarField>& alphafs,
1395 const PtrList<surfaceScalarField>& phiKdPhifs
1398 Info<<
"Inverting drag system: ";
1406 if (!phases[i].stationary())
1408 phases[i].phiRef() += phiKdPhifs[i];
1414 PtrList<PtrList<surfaceScalarField>> phiKdfs(phases.size());
1421 new PtrList<surfaceScalarField>(phases.size())
1428 const phasePair& pair(this->phasePairs_[KdfIter.key()]);
1430 const label phase1i = pair.phase1().index();
1431 const label phase2i = pair.phase2().index();
1457 for (
label i = 0; i < phases.size(); i++)
1459 for (
label j = i + 1; j < phases.size(); j++)
1461 phiKdfs[i][j] /= phiKdfs[i][i];
1462 for (
label k = i + 1;
k < phases.size(); ++
k)
1464 phiKdfs[j][
k] -= phiKdfs[j][i]*phiKdfs[i][
k];
1472 for (
label i = 1; i < phases.size(); i++)
1474 detPhiKdfs *= phiKdfs[i][i];
1477 Info<<
"Min face det = " 1478 <<
gMin(detPhiKdfs.primitiveField()) <<
endl;
1482 for (
label i = 1; i < phases.size(); i++)
1484 if (!phases[i].stationary())
1486 for (
label j = 0; j < i; j ++)
1488 phases[i].phiRef() -= phiKdfs[i][j]*phases[j].phi();
1492 for (
label i = phases.size() - 1; i >= 0; i--)
1494 if (!phases[i].stationary())
1496 for (
label j = phases.size() - 1; j > i; j--)
1498 phases[i].phiRef() -= phiKdfs[i][j]*phases[j].phi();
1500 phases[i].phiRef() /= phiKdfs[i][i];
1505 this->setMixturePhi(alphafs, this->
phi());
1509 template<
class BasePhaseSystem>
#define forAll(list, i)
Loop across all elements in list.
tmp< GeometricField< Type, fvPatchField, volMesh > > DDt(const surfaceScalarField &phi, const GeometricField< Type, fvPatchField, volMesh > &psi)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
virtual PtrList< surfaceScalarField > phiFs(const PtrList< volScalarField > &rAUs)
Return the explicit force fluxes for the cell-based algorithm, that.
virtual tmp< surfaceScalarField > Kdf(const phasePairKey &key) const
Return the face drag coefficient for the phase pair.
const dimensionedScalar F
Faraday constant: default SI units: [C/mol].
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
Type gMin(const FieldField< Field, Type > &f)
HashPtrTable< fvVectorMatrix > momentumTransferTable
virtual autoPtr< phaseSystem::momentumTransferTable > momentumTransferf()
As momentumTransfer, but for the face-based algorithm.
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
static int compare(const Pair< word > &a, const Pair< word > &b)
Compare Pairs.
virtual bool read()
Read base phaseProperties dictionary.
Ostream & endl(Ostream &os)
Add newline and flush stream.
fluid fillFields("rAU", dimTime/dimDensity, rAUs)
MomentumTransferPhaseSystem(const fvMesh &)
Construct from fvMesh.
Calculate the snGrad of the given volField.
const dimensionSet dimless
label k
Boltzmann constant.
tmp< fvMatrix< Type > > Sp(const volScalarField::Internal &, const GeometricField< Type, fvPatchField, volMesh > &)
GeometricField< vector, fvPatchField, volMesh > volVectorField
CGAL::Exact_predicates_exact_constructions_kernel K
static const dimensionSet dimK
Coefficient dimensions.
dimensionedScalar posPart(const dimensionedScalar &ds)
Area-weighted average a surfaceField creating a volField.
virtual bool implicitPhasePressure() const
Returns true if the phase pressure is treated implicitly.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Calculate the first temporal derivative.
const dimensionSet dimTime
PtrList< surfaceScalarField > phiFs(fluid.phiFs(rAUs))
autoPtr< BasicCompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const typename BasicCompressibleMomentumTransportModel::transportModel &transport)
Calculate the face-flux of the given field.
static word groupName(Name name, const word &group)
virtual void partialEliminationf(const PtrList< surfaceScalarField > &rAUfs, const PtrList< surfaceScalarField > &alphafs, const PtrList< surfaceScalarField > &phiKdPhifs)
As partialElimination, but for the face-based algorithm. Only solves.
virtual tmp< volScalarField > Vm(const phasePairKey &key) const
Return the virtual mass coefficient for the phase pair.
const dimensionSet dimDensity
tmp< fvMatrix< Type > > ddt(const GeometricField< Type, fvPatchField, volMesh > &vf)
Calculate the matrix for the first temporal derivative.
PtrListDictionary< phaseModel > phaseModelList
virtual PtrList< volVectorField > KdUByAs(const PtrList< volScalarField > &rAUs) const
Return the explicit part of the drag force for the cell-based.
const dimensionSet dimForce
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
virtual PtrList< surfaceScalarField > phiKdPhis(const PtrList< volScalarField > &rAUs) const
Return the explicit drag force fluxes for the cell-based algorithm.
Calculate the divergence of the given field.
dimensionedScalar pos0(const dimensionedScalar &ds)
PtrList< surfaceScalarField > phiFfs(fluid.phiFfs(rAUfs))
tmp< fvMatrix< Type > > div(const surfaceScalarField &flux, const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
const dimensionSet dimVelocity
const dimensionSet dimMass
virtual PtrList< surfaceScalarField > ddtCorrByAs(const PtrList< volScalarField > &rAUs, const bool includeVirtualMass=false) const
Return the flux corrections for the cell-based algorithm. These.
tmp< volScalarField > byDt(const volScalarField &vf)
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 tmp< volScalarField::Internal > & Sp
Calculate the mesh motion flux and convert fluxes from absolute to relative and back.
Calculate the matrix for the divergence of the given field and flux.
virtual ~MomentumTransferPhaseSystem()
Destructor.
virtual PtrList< surfaceScalarField > phiFfs(const PtrList< surfaceScalarField > &rAUfs)
As phiFs, but for the face-based algorithm.
tmp< surfaceScalarField > absolute(const tmp< surfaceScalarField > &tphi, const volVectorField &U)
Return the given relative flux in absolute form.
static const dimensionSet dimK
Coefficient dimensions.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
virtual void partialElimination(const PtrList< volScalarField > &rAUs, const PtrList< volVectorField > &KdUByAs, const PtrList< surfaceScalarField > &alphafs, const PtrList< surfaceScalarField > &phiKdPhis)
Solve the drag system for the velocities and fluxes.
fvMatrix< vector > fvVectorMatrix
phaseSystem::phaseModelList & phases
tmp< GeometricField< Type, fvPatchField, volMesh > > average(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Area-weighted average a surfaceField creating a volField.
virtual tmp< volScalarField > Kd(const phasePairKey &key) const
Return the drag coefficient for the phase pair.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
A class for managing temporary objects.
tmp< surfaceScalarField > flux(const volVectorField &vvf)
Return the face-flux field obtained from the given volVectorField.
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
virtual PtrList< surfaceScalarField > AFfs() const
Return implicit force coefficients on the faces, for the face-based.
virtual PtrList< surfaceScalarField > DByAfs(const PtrList< volScalarField > &rAUs, const PtrList< surfaceScalarField > &rAUfs) const
Return the phase diffusivity.
void addDmdtUfs(const phaseSystem::dmdtfTable &dmdtfs, phaseSystem::momentumTransferTable &eqns)
Add momentum transfer terms which result from bulk mass transfers.
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Calculate the matrix for implicit and explicit sources.
dimensionedScalar negPart(const dimensionedScalar &ds)
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.