49 template<
class BasePhaseSystem>
69 *eqns[phase1.
name()] +=
75 *eqns[phase2.
name()] -=
82 template<
class BasePhaseSystem>
91 result.
ref() += field;
101 result = field().clone();
109 template<
class BasePhaseSystem>
116 BasePhaseSystem(mesh)
118 this->generateInterfacialModels(dragModels_);
119 this->generateInterfacialModels(virtualMassModels_);
120 this->generateInterfacialModels(liftModels_);
121 this->generateInterfacialModels(wallLubricationModels_);
122 this->generateInterfacialModels(turbulentDispersionModels_);
128 template<
class BasePhaseSystem>
136 template<
class BasePhaseSystem>
148 forAll(this->movingPhases(), movingPhasei)
150 const phaseModel& phase = this->movingPhases()[movingPhasei];
179 this->mesh().time().name(),
197 *Kds_[dragModelIter.key()] = dragModelIter()->K();
208 !interface.phase1().stationary()
209 && interface.phase1().U()()
210 .boundaryField()[
patchi].fixesValue()
213 !interface.phase2().stationary()
214 && interface.phase2().U()()
215 .boundaryField()[
patchi].fixesValue()
220 K.boundaryField()[
patchi].patchInternalField();
236 virtualMassModelIter()->interface();
246 this->mesh().time().name(),
264 *Vms_[virtualMassModelIter.key()] = virtualMassModelIter()->K();
276 const phaseModel& otherPhase = iter.otherPhase();
301 + this->MRF_.DDt(VmPhase,
U - otherPhase.
U());
310 template<
class BasePhaseSystem>
322 forAll(this->movingPhases(), movingPhasei)
324 const phaseModel& phase = this->movingPhases()[movingPhasei];
353 this->mesh().time().name(),
371 *Kdfs_[dragModelIter.key()] = dragModelIter()->Kf();
385 virtualMassModelIter()->interface();
395 this->mesh().time().name(),
413 *Vms_[virtualMassModelIter.key()] = virtualMassModelIter()->K();
418 forAll(this->phaseModels_, phasei)
420 const phaseModel& phase = this->phaseModels_[phasei];
451 const phaseModel& otherPhase = iter.otherPhase();
461 *eqns[phase.
name()] -=
464 UgradUs[phase.
index()]
465 - (UgradUs[otherPhase.
index()] & otherPhase.
U())
475 template<
class BasePhaseSystem>
490 const phaseModel& otherPhase = iter.otherPhase();
517 const phaseModel& otherPhase = iter.otherPhase();
535 template<
class BasePhaseSystem>
573 wallLubricationModels_,
574 wallLubricationModelIter
578 wallLubricationModelIter()->interface();
599 forAll(this->phaseModels_, phasei)
601 const phaseModel& phase = this->phaseModels_[phasei];
619 turbulentDispersionModels_,
620 turbulentDispersionModelIter
624 turbulentDispersionModelIter()->interface();
631 const volScalarField alpha12(interface.phase1() + interface.phase2());
637 /
max(alpha12, interface.phase1().residualAlpha())
638 )*this->mesh_.magSf()
645 /
max(alpha12, interface.phase2().residualAlpha())
646 )*this->mesh_.magSf()
649 addField(interface.phase1(),
"F", Df*snGradAlpha1By12, Fs);
650 addField(interface.phase2(),
"F", Df*snGradAlpha2By12, Fs);
653 if (this->fillFields_)
662 template<
class BasePhaseSystem>
677 const phaseModel& otherPhase = iter.otherPhase();
738 wallLubricationModels_,
739 wallLubricationModelIter
743 wallLubricationModelIter()->interface();
764 forAll(this->phaseModels_, phasei)
766 const phaseModel& phase = this->phaseModels_[phasei];
782 turbulentDispersionModels_,
783 turbulentDispersionModelIter
787 turbulentDispersionModelIter()->interface();
794 const volScalarField alpha12(interface.phase1() + interface.phase2());
800 /
max(alpha12, interface.phase1().residualAlpha())
801 )*this->mesh_.magSf()
808 /
max(alpha12, interface.phase2().residualAlpha())
809 )*this->mesh_.magSf()
812 addField(interface.phase1(),
"F", Df*snGradAlpha1By12, Ffs);
813 addField(interface.phase2(),
"F", Df*snGradAlpha2By12, Ffs);
816 if (this->fillFields_)
825 template<
class BasePhaseSystem>
840 const phaseModel& otherPhase = iter.otherPhase();
853 this->MRF().absolute(otherPhase.
phi()),
861 if (this->fillFields_)
875 template<
class BasePhaseSystem>
890 const phaseModel& otherPhase = iter.otherPhase();
905 this->MRF().absolute(otherPhase.
phi()),
913 if (this->fillFields_)
927 template<
class BasePhaseSystem>
941 const phaseModel& otherPhase = iter.otherPhase();
954 if (this->fillFields_)
963 template<
class BasePhaseSystem>
978 const phaseModel& otherPhase = iter.otherPhase();
991 if (this->fillFields_)
1000 template<
class BasePhaseSystem>
1005 this->mesh_.solution().solverDict(phase.volScalarField::name()).
1006 template lookupOrDefault<Switch>
1008 "implicitPhasePressure",
1014 template<
class BasePhaseSystem>
1018 bool implicitPressure =
false;
1020 forAll(this->phaseModels_, phasei)
1022 const phaseModel& phase = this->phaseModels_[phasei];
1024 implicitPressure = implicitPressure || implicitPhasePressure(phase);
1027 return implicitPressure;
1031 template<
class BasePhaseSystem>
1042 forAll(this->phaseModels_, phasei)
1044 const phaseModel& phase = this->phaseModels_[phasei];
1068 turbulentDispersionModels_,
1069 turbulentDispersionModelIter
1073 turbulentDispersionModelIter()->interface();
1089 /
max(alpha1f + alpha2f, interface.phase1().residualAlpha())
1096 rAUfs[interface.phase1().index()],
1097 rAUfs[interface.phase2().index()]
1106 rAUs[interface.phase1().index()],
1107 rAUs[interface.phase2().index()]
1109 *turbulentDispersionModelIter()->
D()
1119 template<
class BasePhaseSystem>
1126 forAll(this->movingPhases(), movingPhasei)
1128 const phaseModel& phase = this->movingPhases()[movingPhasei];
1159 forAll(this->movingPhases(), movingPhasei)
1161 const phaseModel& phase = this->movingPhases()[movingPhasei];
1191 const phaseModel& otherPhase = iter.otherPhase();
1192 const label otherPhasei = otherPhase.
index();
1210 otherPhase.
Uf().valid()
1211 ? (this->mesh_.Sf() & otherPhase.
Uf()())()
1212 : otherPhase.
phi()()
1214 -
fvc::flux(VmDdtCoeffs[otherPhasei]*otherPhase.
U())
1216 - VmDdtCorrs[otherPhase.
index()]
1228 template<
class BasePhaseSystem>
1241 if (!phases[i].stationary())
1277 : (Uphis[phase2i] - Uphis[phase1i])
1290 : (phase2.
phi() - phase1.
phi())
1311 : (Uphis[phase1i] - Uphis[phase2i])
1324 : (phase1.
phi() - phase2.
phi())
1333 template<
class BasePhaseSystem>
1343 Info<<
"Inverting drag systems: ";
1349 volVectorField Um(this->movingPhases()[0]*this->movingPhases()[0].
U());
1353 label movingPhasei=1;
1354 movingPhasei<this->movingPhases().size();
1359 this->movingPhases()[movingPhasei]
1360 *this->movingPhases()[movingPhasei].U();
1367 if (!phases[i].stationary())
1369 phases[i].URef() += rAUs[i]*KdUs[i];
1370 phases[i].phiRef() += rAUfs[i]*KdPhis[i];
1449 this->fillFields(
"KdByAs",
dimless, KdByAs[i]);
1450 this->fillFields(
"KdByAfs",
dimless, KdByAfs[i]);
1457 for (
label i = 0; i < phases.size(); i++)
1459 for (
label j = i + 1; j < phases.size(); j++)
1461 KdByAs[i][j] /= KdByAs[i][i];
1462 KdByAfs[i][j] /= KdByAfs[i][i];
1463 for (
label k = i + 1;
k < phases.size(); ++
k)
1465 KdByAs[j][
k] -= KdByAs[j][i]*KdByAs[i][
k];
1466 KdByAfs[j][
k] -= KdByAfs[j][i]*KdByAfs[i][
k];
1475 for (
label i = 1; i < phases.size(); i++)
1477 detKdByAs *= KdByAs[i][i];
1478 detPhiKdfs *= KdByAfs[i][i];
1486 for (
label i = 1; i < phases.size(); i++)
1488 if (!phases[i].stationary())
1490 for (
label j = 0; j < i; j ++)
1492 phases[i].URef() -= KdByAs[i][j]*phases[j].U();
1493 phases[i].phiRef() -= KdByAfs[i][j]*phases[j].phi();
1497 for (
label i = phases.size() - 1; i >= 0; i--)
1499 if (!phases[i].stationary())
1501 for (
label j = phases.size() - 1; j > i; j--)
1503 phases[i].URef() -= KdByAs[i][j]*phases[j].U();
1504 phases[i].phiRef() -= KdByAfs[i][j]*phases[j].phi();
1506 phases[i].URef() /= KdByAs[i][i];
1507 phases[i].phiRef() /= KdByAfs[i][i];
1512 this->setMixtureU(Um);
1513 this->setMixturePhi(alphafs, this->phi());
1517 template<
class BasePhaseSystem>
1525 Info<<
"Inverting drag system: ";
1533 if (!phases[i].stationary())
1535 phases[i].phiRef() += rAUfs[i]*KdPhifs[i];
1592 this->fillFields(
"phiKdf",
dimless, phiKdfs[phasei]);
1594 phiKdfs[phasei][phasei] = 1;
1598 for (
label i = 0; i < phases.size(); i++)
1600 for (
label j = i + 1; j < phases.size(); j++)
1602 phiKdfs[i][j] /= phiKdfs[i][i];
1603 for (
label k = i + 1;
k < phases.size(); ++
k)
1605 phiKdfs[j][
k] -= phiKdfs[j][i]*phiKdfs[i][
k];
1613 for (
label i = 1; i < phases.size(); i++)
1615 detPhiKdfs *= phiKdfs[i][i];
1618 Info<<
"Min face det = "
1623 for (
label i = 1; i < phases.size(); i++)
1625 if (!phases[i].stationary())
1627 for (
label j = 0; j < i; j ++)
1629 phases[i].phiRef() -= phiKdfs[i][j]*phases[j].phi();
1633 for (
label i = phases.size() - 1; i >= 0; i--)
1635 if (!phases[i].stationary())
1637 for (
label j = phases.size() - 1; j > i; j--)
1639 phases[i].phiRef() -= phiKdfs[i][j]*phases[j].phi();
1641 phases[i].phiRef() /= phiKdfs[i][i];
1646 this->setMixturePhi(alphafs, this->phi());
1650 template<
class BasePhaseSystem>
static const Foam::dimensionedScalar D("D", Foam::dimTemperature, 257.14)
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Generic GeometricField class.
const Internal::FieldType & primitiveField() const
Return a const-reference to the internal field.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
static word groupName(Name name, const word &group)
virtual void partialElimination(const PtrList< volScalarField > &rAUs, const PtrList< volVectorField > &KdUs, const PtrList< surfaceScalarField > &alphafs, const PtrList< surfaceScalarField > &rAUfs, const PtrList< surfaceScalarField > &KdPhis)
Solve the drag system for the velocities and fluxes.
virtual void dragCorrs(PtrList< volVectorField > &dragCorrs, PtrList< surfaceScalarField > &dragCorrf) const
Set the cell and faces drag correction fields.
virtual PtrList< surfaceScalarField > ddtCorrs() const
Return the flux corrections for the cell-based algorithm. These.
virtual autoPtr< phaseSystem::momentumTransferTable > momentumTransfer()
Return the momentum transfer matrices for the cell-based algorithm.
virtual tmp< surfaceScalarField > alphaDByAf(const PtrList< volScalarField > &rAUs, const PtrList< surfaceScalarField > &rAUfs) const
Return the phase diffusivity.
virtual PtrList< volVectorField > KdUs() const
Return the explicit part of the drag force for the cell-based.
virtual void partialEliminationf(const PtrList< surfaceScalarField > &rAUfs, const PtrList< surfaceScalarField > &alphafs, const PtrList< surfaceScalarField > &KdPhifs)
As partialElimination, but for the face-based algorithm. Only solves.
virtual PtrList< volScalarField > Kds() const
Return the implicit part of the drag force.
void addDmdtUfs(const phaseSystem::dmdtfTable &dmdtfs, phaseSystem::momentumTransferTable &eqns)
Add momentum transfer terms which result from bulk mass transfers.
virtual ~MomentumTransferPhaseSystem()
Destructor.
virtual PtrList< surfaceScalarField > Ffs() const
As Fs, but for the face-based algorithm.
virtual bool implicitPhasePressure() const
Returns true if the phase pressure is treated implicitly.
virtual PtrList< surfaceScalarField > Fs() const
Return the explicit force fluxes for the cell-based algorithm, that.
virtual PtrList< surfaceScalarField > KdVmfs() const
Return implicit force coefficients on the faces, for the face-based.
MomentumTransferPhaseSystem(const fvMesh &)
Construct from fvMesh.
virtual autoPtr< phaseSystem::momentumTransferTable > momentumTransferf()
As momentumTransfer, but for the face-based algorithm.
virtual PtrList< surfaceScalarField > KdPhifs() const
As KdPhis, but for the face-based algorithm.
virtual PtrList< surfaceScalarField > KdPhis() const
Return the explicit drag force fluxes for the cell-based algorithm.
virtual bool read()
Read base phaseProperties dictionary.
void addTmpField(tmp< surfaceScalarField > &result, const tmp< surfaceScalarField > &field) const
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
bool set(const label) const
Is element set.
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
label size() const
Return the number of elements in the UPtrList.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
static const dimensionSet dimK
Coefficient dimensions.
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Mesh data needed to do the Finite Volume discretisation.
Class to represent an interface between phases. Derivations can further specify the configuration of ...
const phaseModel & phase1() const
Return phase 1.
const phaseModel & phase2() const
Return phase 2.
virtual const autoPtr< surfaceVectorField > & Uf() const =0
Return the face velocity.
const dimensionedScalar & residualAlpha() const
Return the residual phase-fraction for given phase.
virtual surfaceScalarField & phiRef()=0
Access the volumetric flux.
virtual bool stationary() const =0
Return whether the phase is stationary.
virtual tmp< volScalarField > pPrime() const =0
Return the phase-pressure'.
virtual tmp< surfaceScalarField > phi() const =0
Return the volumetric flux.
virtual tmp< volVectorField > DUDt() const =0
Return the substantive acceleration.
virtual tmp< surfaceScalarField > DUDtf() const =0
Return the substantive acceleration on the faces.
label index() const
Return the index of the phase.
virtual tmp< volVectorField > U() const =0
Return the velocity.
virtual volVectorField & URef()=0
Access the velocity.
const word & name() const
Return the name of this phase.
virtual const volScalarField & rho() const =0
Return the density field.
Pimple no-loop control class. Implements various option flags, but leaves loop controls to the deriva...
virtual const dictionary & dict() const
Return the solution dictionary.
A class for managing temporary objects.
bool valid() const
Is this temporary object valid,.
bool isTmp() const
Return true if this is really a temporary object.
T & ref() const
Return non-const reference or generate a fatal error.
static const dimensionSet dimK
Coefficient dimensions.
pimpleControl pimple(mesh)
Calculate the first temporal derivative.
Calculate the divergence of the given field.
Calculate the face-flux of the given field.
Calculate the mesh motion flux and convert fluxes from absolute to relative and back.
Reconstruct volField from a face flux 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 matrix for implicit and explicit sources.
const dimensionedScalar F
Faraday constant: default SI units: [C/mol].
tmp< SurfaceField< typename innerProduct< vector, Type >::type > > flux(const VolField< Type > &vf)
Return the face-flux field obtained from the given volVectorField.
static tmp< SurfaceField< Type > > interpolate(const VolField< Type > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
tmp< VolField< typename outerProduct< vector, Type >::type > > reconstruct(const SurfaceField< Type > &ssf)
tmp< VolField< Type > > Sp(const volScalarField &sp, const VolField< Type > &vf)
tmp< VolField< Type > > DDt(const surfaceScalarField &phi, const VolField< Type > &psi)
tmp< VolField< Type > > div(const SurfaceField< Type > &ssf)
tmp< surfaceScalarField > absolute(const tmp< surfaceScalarField > &tphi, const volVectorField &U)
Return the given relative flux in absolute form.
tmp< SurfaceField< Type > > snGrad(const VolField< Type > &vf, const word &name)
tmp< SurfaceField< typename Foam::flux< Type >::type > > ddtCorr(const VolField< Type > &U, const SurfaceField< Type > &Uf)
tmp< fvMatrix< Type > > Sp(const volScalarField::Internal &, const VolField< Type > &)
tmp< fvMatrix< Type > > div(const surfaceScalarField &flux, const VolField< Type > &vf, const word &name)
tmp< fvMatrix< Type > > ddt(const VolField< Type > &vf)
void addField(const Group &group, const word &name, tmp< GeoField > field, PtrList< GeoField > &fieldList)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const dimensionSet dimless
const dimensionSet dimAcceleration
tmp< volScalarField > byDt(const volScalarField &vf)
const dimensionSet dimTime
dimensionedScalar negPart(const dimensionedScalar &ds)
const dimensionSet dimDensity
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
const dimensionSet dimMass
const dimensionSet dimVelocity
const dimensionSet dimArea
Type gMin(const FieldField< Field, Type > &f)
word name(const complex &)
Return a string representation of a complex.
dimensionedScalar posPart(const dimensionedScalar &ds)