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())
383 + this->MRF_.DDt(Vm, U - otherPhase.U());
392 template<
class BasePhaseSystem>
397 autoPtr<phaseSystem::momentumTransferTable> eqnsPtr
404 forAll(this->movingPhases(), movingPhasei)
406 const phaseModel& phase = this->movingPhases()[movingPhasei];
416 PtrList<fvVectorMatrix> UgradUs(this->phaseModels_.size());
419 const phaseModel& phase = this->phaseModels_[
phasei];
421 if (!phase.stationary())
442 const phasePair& pair(this->phasePairs_[VmIter.key()]);
446 const phaseModel& phase = iter();
447 const phaseModel& otherPhase = iter.otherPhase();
449 if (!phase.stationary())
451 *eqns[phase.name()] -=
454 UgradUs[phase.index()]
455 - (UgradUs[otherPhase.index()] & otherPhase.U())
465 template<
class BasePhaseSystem>
469 PtrList<surfaceScalarField> AFfs(this->phaseModels_.size());
475 const phasePair& pair(this->phasePairs_[KdfIter.key()]);
479 addField(iter(),
"AFf", Kf, AFfs);
487 const phasePair& pair(this->phasePairs_[VmfIter.key()]);
491 addField(iter(),
"AFf",
byDt(Vmf), AFfs);
501 template<
class BasePhaseSystem>
505 const PtrList<volScalarField>& rAUs
508 PtrList<surfaceScalarField>
phiFs(this->phaseModels_.size());
519 const phasePair& pair(this->phasePairs_[liftModelIter.key()]);
540 wallLubricationModelTable,
541 wallLubricationModels_,
542 wallLubricationModelIter
547 pair(this->phasePairs_[wallLubricationModelIter.key()]);
568 const phaseModel& phase = this->phaseModels_[
phasei];
580 addField(phase,
"phiF", pPrimeByAf*snGradAlpha1,
phiFs);
586 turbulentDispersionModelTable,
587 turbulentDispersionModels_,
588 turbulentDispersionModelIter
592 pair(this->phasePairs_[turbulentDispersionModelIter.key()]);
610 pair.phase1()/
max(alpha12, pair.phase1().residualAlpha())
611 )*this->mesh_.magSf()
617 pair.phase2()/
max(alpha12, pair.phase2().residualAlpha())
618 )*this->mesh_.magSf()
621 addField(pair.phase1(),
"phiF", DByA1f*snGradAlpha1By12,
phiFs);
622 addField(pair.phase2(),
"phiF", DByA2f*snGradAlpha2By12,
phiFs);
625 if (this->fillFields_)
634 template<
class BasePhaseSystem>
638 const PtrList<surfaceScalarField>& rAUfs
641 PtrList<surfaceScalarField>
phiFfs(this->phaseModels_.size());
647 const phasePair& pair(this->phasePairs_[VmfIter.key()]);
655 -rAUfs[iter().index()]*Vmf
658 + iter.otherPhase().DUDtf()
674 const phasePair& pair(this->phasePairs_[liftModelIter.key()]);
680 rAUfs[pair.phase1().index()]*Ff,
687 -rAUfs[pair.phase2().index()]*Ff,
695 wallLubricationModelTable,
696 wallLubricationModels_,
697 wallLubricationModelIter
702 pair(this->phasePairs_[wallLubricationModelIter.key()]);
708 rAUfs[pair.phase1().index()]*Ff,
715 -rAUfs[pair.phase2().index()]*Ff,
723 const phaseModel& phase = this->phaseModels_[
phasei];
735 addField(phase,
"phiFf", pPrimeByAf*snGradAlpha1,
phiFfs);
741 turbulentDispersionModelTable,
742 turbulentDispersionModels_,
743 turbulentDispersionModelIter
748 pair(this->phasePairs_[turbulentDispersionModelIter.key()]);
754 rAUfs[pair.phase1().index()]*Ff,
761 -rAUfs[pair.phase2().index()]*Ff,
766 if (this->fillFields_)
775 template<
class BasePhaseSystem>
779 const PtrList<volScalarField>& rAUs
782 PtrList<surfaceScalarField> phiKdPhis(this->phaseModels_.size());
788 const phasePair& pair(this->phasePairs_[KdIter.key()]);
803 if (this->fillFields_)
817 template<
class BasePhaseSystem>
821 const PtrList<surfaceScalarField>& rAUfs
824 PtrList<surfaceScalarField> phiKdPhifs(this->phaseModels_.size());
830 const phasePair& pair(this->phasePairs_[KdfIter.key()]);
838 -rAUfs[iter().index()]*Kf
845 if (this->fillFields_)
859 template<
class BasePhaseSystem>
863 const PtrList<volScalarField>& rAUs
866 PtrList<volVectorField> KdUByAs(this->phaseModels_.size());
872 const phasePair& pair(this->phasePairs_[KdIter.key()]);
880 -rAUs[iter().index()]*K*iter.otherPhase().U(),
886 if (this->fillFields_)
895 template<
class BasePhaseSystem>
900 this->mesh_.solverDict(phase.volScalarField::name()).
901 template lookupOrDefault<Switch>
903 "implicitPhasePressure",
909 template<
class BasePhaseSystem>
913 bool implicitPressure =
false;
917 const phaseModel& phase = this->phaseModels_[
phasei];
919 implicitPressure = implicitPressure || implicitPhasePressure(phase);
922 return implicitPressure;
926 template<
class BasePhaseSystem>
930 const PtrList<volScalarField>& rAUs,
931 const PtrList<surfaceScalarField>& rAUfs
934 PtrList<surfaceScalarField> DByAfs(this->phaseModels_.size());
941 const phaseModel& phase = this->phaseModels_[
phasei];
948 addField(phase,
"DByAf", pPrimeByAf, DByAfs);
950 forAll(this->phaseModels_, phasej)
954 const phaseModel& phase2 = this->phaseModels_[phasej];
963 /
max(1 - phase, phase2.residualAlpha())
974 turbulentDispersionModelTable,
975 turbulentDispersionModels_,
976 turbulentDispersionModelIter
980 pair(this->phasePairs_[turbulentDispersionModelIter.key()]);
996 rAUfs[pair.phase1().index()]*Df
997 /
max(alpha12f, pair.phase1().residualAlpha()),
1004 rAUfs[pair.phase2().index()]*Df
1005 /
max(alpha12f, pair.phase2().residualAlpha()),
1015 const phaseModel& phase = this->phaseModels_[
phasei];
1022 addField(phase,
"DByAf", pPrimeByAf, DByAfs);
1024 forAll(this->phaseModels_, phasej)
1028 const phaseModel& phase2 = this->phaseModels_[phasej];
1037 /
max(1 - phase, phase2.residualAlpha())
1048 turbulentDispersionModelTable,
1049 turbulentDispersionModels_,
1050 turbulentDispersionModelIter
1054 pair(this->phasePairs_[turbulentDispersionModelIter.key()]);
1066 rAUs[pair.phase1().index()]*D
1067 /
max(alpha12, pair.phase1().residualAlpha())
1077 rAUs[pair.phase2().index()]*D
1078 /
max(alpha12, pair.phase2().residualAlpha())
1089 template<
class BasePhaseSystem>
1093 const PtrList<volScalarField>& rAUs,
1094 const bool includeVirtualMass
1097 PtrList<surfaceScalarField> ddtCorrByAs(this->phaseModels_.size());
1100 PtrList<surfaceScalarField> phiCorrs(this->phaseModels_.size());
1103 const phaseModel& phase = this->phaseModels_[
phasei];
1116 const phaseModel& phase = this->phaseModels_[
phasei];
1125 tmp<surfaceScalarField> phiCorrCoeff =
pos0(alphafBar - 0.99);
1127 surfaceScalarField::Boundary& phiCorrCoeffBf =
1128 phiCorrCoeff.ref().boundaryFieldRef();
1135 !this->mesh_.boundary()[
patchi].coupled()
1136 || isA<cyclicAMIFvPatch>(this->mesh_.boundary()[
patchi])
1139 phiCorrCoeffBf[
patchi] = 0;
1156 if (includeVirtualMass)
1161 const phasePair& pair(this->phasePairs_[VmIter.key()]);
1165 const phaseModel& phase = iter();
1166 const phaseModel& otherPhase = iter.otherPhase();
1174 phiCorrs[phase.index()]
1175 + this->
MRF().absolute(otherPhase.phi())
1177 - phiCorrs[otherPhase.index()]
1189 template<
class BasePhaseSystem>
1192 const PtrList<volScalarField>& rAUs,
1193 const PtrList<volVectorField>& KdUByAs,
1194 const PtrList<surfaceScalarField>& alphafs,
1195 const PtrList<surfaceScalarField>& phiKdPhis
1198 Info<<
"Inverting drag systems: ";
1204 volVectorField Um(this->movingPhases()[0]*this->movingPhases()[0].
U());
1208 label movingPhasei=1;
1209 movingPhasei<this->movingPhases().size();
1214 this->movingPhases()[movingPhasei]
1215 *this->movingPhases()[movingPhasei].U();
1222 if (!phases[i].stationary())
1224 phases[i].URef() += KdUByAs[i];
1225 phases[i].phiRef() += phiKdPhis[i];
1231 PtrList<PtrList<volScalarField>> KdByAs(phases.size());
1232 PtrList<PtrList<surfaceScalarField>> phiKds(phases.size());
1239 new PtrList<volScalarField>(phases.size())
1245 new PtrList<surfaceScalarField>(phases.size())
1252 const phasePair& pair(this->phasePairs_[KdIter.key()]);
1254 const label phase1i = pair.phase1().index();
1255 const label phase2i = pair.phase2().index();
1298 for (
label i = 0; i < phases.size(); i++)
1300 for (
label j = i + 1; j < phases.size(); j++)
1302 KdByAs[i][j] /= KdByAs[i][i];
1303 phiKds[i][j] /= phiKds[i][i];
1304 for (
label k = i + 1;
k < phases.size(); ++
k)
1306 KdByAs[j][
k] -= KdByAs[j][i]*KdByAs[i][
k];
1307 phiKds[j][
k] -= phiKds[j][i]*phiKds[i][
k];
1316 for (
label i = 1; i < phases.size(); i++)
1318 detKdByAs *= KdByAs[i][i];
1319 detPhiKdfs *= phiKds[i][i];
1322 Info<<
"Min cell/face det = " <<
gMin(detKdByAs.primitiveField())
1323 <<
"/" <<
gMin(detPhiKdfs.primitiveField()) <<
endl;
1327 for (
label i = 1; i < phases.size(); i++)
1329 if (!phases[i].stationary())
1331 for (
label j = 0; j < i; j ++)
1333 phases[i].URef() -= KdByAs[i][j]*phases[j].U();
1334 phases[i].phiRef() -= phiKds[i][j]*phases[j].phi();
1338 for (
label i = phases.size() - 1; i >= 0; i--)
1340 if (!phases[i].stationary())
1342 for (
label j = phases.size() - 1; j > i; j--)
1344 phases[i].URef() -= KdByAs[i][j]*phases[j].U();
1345 phases[i].phiRef() -= phiKds[i][j]*phases[j].phi();
1347 phases[i].URef() /= KdByAs[i][i];
1348 phases[i].phiRef() /= phiKds[i][i];
1353 this->setMixtureU(Um);
1354 this->setMixturePhi(alphafs, this->
phi());
1358 template<
class BasePhaseSystem>
1361 const PtrList<surfaceScalarField>& rAUfs,
1362 const PtrList<surfaceScalarField>& alphafs,
1363 const PtrList<surfaceScalarField>& phiKdPhifs
1366 Info<<
"Inverting drag system: ";
1374 if (!phases[i].stationary())
1376 phases[i].phiRef() += phiKdPhifs[i];
1382 PtrList<PtrList<surfaceScalarField>> phiKdfs(phases.size());
1389 new PtrList<surfaceScalarField>(phases.size())
1396 const phasePair& pair(this->phasePairs_[KdfIter.key()]);
1398 const label phase1i = pair.phase1().index();
1399 const label phase2i = pair.phase2().index();
1425 for (
label i = 0; i < phases.size(); i++)
1427 for (
label j = i + 1; j < phases.size(); j++)
1429 phiKdfs[i][j] /= phiKdfs[i][i];
1430 for (
label k = i + 1;
k < phases.size(); ++
k)
1432 phiKdfs[j][
k] -= phiKdfs[j][i]*phiKdfs[i][
k];
1440 for (
label i = 1; i < phases.size(); i++)
1442 detPhiKdfs *= phiKdfs[i][i];
1445 Info<<
"Min face det = " 1446 <<
gMin(detPhiKdfs.primitiveField()) <<
endl;
1450 for (
label i = 1; i < phases.size(); i++)
1452 if (!phases[i].stationary())
1454 for (
label j = 0; j < i; j ++)
1456 phases[i].phiRef() -= phiKdfs[i][j]*phases[j].phi();
1460 for (
label i = phases.size() - 1; i >= 0; i--)
1462 if (!phases[i].stationary())
1464 for (
label j = phases.size() - 1; j > i; j--)
1466 phases[i].phiRef() -= phiKdfs[i][j]*phases[j].phi();
1468 phases[i].phiRef() /= phiKdfs[i][i];
1473 this->setMixturePhi(alphafs, this->
phi());
1477 template<
class BasePhaseSystem>
const dimensionedScalar & F
Faraday constant: default SI units: [C/mol].
#define forAll(list, i)
Loop across all elements in list.
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.
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.
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.
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.
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.
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)
const dimensionSet dimForce
PtrList< surfaceScalarField > phiFfs(fluid.phiFfs(rAUfs))
tmp< fvMatrix< Type > > div(const surfaceScalarField &flux, const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
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 dimensionSet dimDensity
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.
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
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
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
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...
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
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.
const dimensionSet dimVelocity