51 template<
class BasePhaseSystem>
71 *eqns[phase1.
name()] +=
77 *eqns[phase2.
name()] -=
84 template<
class BasePhaseSystem>
93 result.
ref() += field;
103 result = field().clone();
111 template<
class BasePhaseSystem>
118 BasePhaseSystem(mesh)
120 this->generateInterfacialModels(dragModels_);
121 this->generateInterfacialModels(virtualMassModels_);
122 this->generateInterfacialModels(liftModels_);
123 this->generateInterfacialModels(wallLubricationModels_);
124 this->generateInterfacialModels(turbulentDispersionModels_);
130 template<
class BasePhaseSystem>
138 template<
class BasePhaseSystem>
150 forAll(this->movingPhases(), movingPhasei)
152 const phaseModel& phase = this->movingPhases()[movingPhasei];
165 template<
class BasePhaseSystem>
177 forAll(this->movingPhases(), movingPhasei)
179 const phaseModel& phase = this->movingPhases()[movingPhasei];
192 template<
class BasePhaseSystem>
230 wallLubricationModels_,
231 wallLubricationModelIter
235 wallLubricationModelIter()->interface();
256 forAll(this->movingPhases(), movingPhasei)
258 const phaseModel& phase = this->movingPhases()[movingPhasei];
274 turbulentDispersionModels_,
275 turbulentDispersionModelIter
279 turbulentDispersionModelIter()->interface();
286 const volScalarField alpha12(interface.phase1() + interface.phase2());
292 /
max(alpha12, interface.phase1().residualAlpha())
293 )*this->mesh_.magSf()
300 /
max(alpha12, interface.phase2().residualAlpha())
301 )*this->mesh_.magSf()
304 addField(interface.phase1(),
"F", Df*snGradAlpha1By12, Fs);
305 addField(interface.phase2(),
"F", Df*snGradAlpha2By12, Fs);
312 template<
class BasePhaseSystem>
350 wallLubricationModels_,
351 wallLubricationModelIter
355 wallLubricationModelIter()->interface();
376 forAll(this->movingPhases(), movingPhasei)
378 const phaseModel& phase = this->movingPhases()[movingPhasei];
394 turbulentDispersionModels_,
395 turbulentDispersionModelIter
399 turbulentDispersionModelIter()->interface();
406 const volScalarField alpha12(interface.phase1() + interface.phase2());
412 /
max(alpha12, interface.phase1().residualAlpha())
413 )*this->mesh_.magSf()
420 /
max(alpha12, interface.phase2().residualAlpha())
421 )*this->mesh_.magSf()
424 addField(interface.phase1(),
"F", Df*snGradAlpha1By12, Ffs);
425 addField(interface.phase2(),
"F", Df*snGradAlpha2By12, Ffs);
432 template<
class BasePhaseSystem>
438 const label n = ADVs.size();
450 AD(i, j) = ADVs[i][j][ci];
467 ADVs[i][j][ci] = source[i];
474 template<
class BasePhaseSystem>
475 template<
template<
class>
class PatchField,
class GeoMesh>
481 const label n = ADVs.size();
491 ADps[i].set(j, &ADVs[i][j]);
505 ADps[i].set(j, &ADVs[i][j].boundaryFieldRef()[
patchi]);
514 template<
class BasePhaseSystem>
531 invADVs[i].set(i, As[i].
clone());
537 labelList movingPhases(this->phases().size(), -1);
539 forAll(this->movingPhases(), movingPhasei)
541 movingPhases[this->movingPhases()[movingPhasei].index()] = movingPhasei;
558 Kds_.insert(dragModelIter.key(), tKd.ptr());
566 !interface.phase1().stationary()
567 && interface.phase1().U()()
568 .boundaryField()[
patchi].fixesValue()
571 !interface.phase2().stationary()
572 && interface.phase2().U()()
573 .boundaryField()[
patchi].fixesValue()
585 const phaseModel& otherPhase = iter.otherPhase();
598 invADVs[i][i] += Kdij;
599 invADVfs[i][i] += Kdijf;
601 const label j = movingPhases[otherPhase.
index()];
605 invADVs[i].set(j, -Kdij);
606 invADVfs[i].set(j, -Kdijf);
623 if (!invADVs[i].set(j))
668 if (i != -1 && !ADUDts.
set(i))
671 ADUDts.
set(i, DUDt.
A());
672 HDUDts.
set(i, DUDt.
H());
691 const phaseModel& otherPhase = iter.otherPhase();
705 invADVs[i][i] += AVm;
717 const label j = movingPhases[otherPhase.
index()];
723 invADVs[i][j] -= AVm;
743 template<
class BasePhaseSystem>
761 labelList movingPhases(this->phases().size(), -1);
763 forAll(this->movingPhases(), movingPhasei)
765 movingPhases[this->movingPhases()[movingPhasei].index()] = movingPhasei;
781 const phaseModel& otherPhase = iter.otherPhase();
797 invADVfs[i][i] += Kdfij;
799 const label j = movingPhases[otherPhase.
index()];
803 invADVfs[i].
set(j, -Kdfij);
813 if (!invADVfs[i].set(j))
847 if (i != -1 && !AUgradUs.
set(i))
850 AUgradUs.
set(i, UgradU.
A());
851 HUgradUs.
set(i, UgradU.
H());
870 const phaseModel& otherPhase = iter.otherPhase();
904 const label j = movingPhases[otherPhase.
index()];
922 otherPhase.
phi()().oldTime()
941 template<
class BasePhaseSystem>
946 this->mesh_.solution().solverDict(phase.volScalarField::name()).
947 template lookupOrDefault<Switch>
949 "implicitPhasePressure",
955 template<
class BasePhaseSystem>
959 bool implicitPressure =
false;
961 forAll(this->phaseModels_, phasei)
963 const phaseModel& phase = this->phaseModels_[phasei];
965 implicitPressure = implicitPressure || implicitPhasePressure(phase);
968 return implicitPressure;
972 template<
class BasePhaseSystem>
982 forAll(this->movingPhases(), movingPhasei)
984 const phaseModel& phase = this->movingPhases()[movingPhasei];
999 turbulentDispersionModels_,
1000 turbulentDispersionModelIter
1004 turbulentDispersionModelIter()->interface();
1020 /
max(alpha1f + alpha2f, interface.phase1().residualAlpha())
1025 rAs[interface.phase1().index()],
1026 rAs[interface.phase2().index()]
1028 *turbulentDispersionModelIter()->
D()
1037 template<
class BasePhaseSystem>
1044 forAll(this->movingPhases(), movingPhasei)
1046 const phaseModel& phase = this->movingPhases()[movingPhasei];
1077 forAll(this->movingPhases(), movingPhasei)
1079 const phaseModel& phase = this->movingPhases()[movingPhasei];
1108 const phaseModel& otherPhase = iter.otherPhase();
1109 const label otherPhasei = otherPhase.
index();
1122 *(VmDdtCorrs[phasei] - VmDdtCorrs[otherPhasei]),
1133 template<
class BasePhaseSystem>
1140 labelList movingPhases(this->phases().size(), -1);
1143 forAll(this->movingPhases(), movingPhasei)
1145 movingPhases[this->movingPhases()[movingPhasei].index()] = movingPhasei;
1162 const phaseModel& otherPhase = iter.otherPhase();
1165 const label j = movingPhases[otherPhase.
index()];
1178 K1*(j == -1 ? -Uphis[i] : (Uphis[j] - Uphis[i])),
1187 *(j == -1 ? -phase.
phi() : (otherPhase.
phi() - phase.
phi())),
1196 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 mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
Generic GeometricField class.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
Boundary & boundaryFieldRef()
Return a reference to the boundary field.
static tmp< GeometricField< Type, PatchField, GeoMesh > > New(const word &name, const Internal &, const PtrList< PatchField< Type >> &, const HashPtrTable< Source > &=HashPtrTable< Source >())
Return a temporary field constructed from name,.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void size(const label)
Override size to be inconsistent with allocated storage.
void clear()
Clear the list, i.e. set size to zero.
void setSize(const label)
Reset size of List.
void invADVs(List< UPtrList< scalarField >> &ADVs) const
Invert the ADVs matrix inplace.
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.
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.
MomentumTransferPhaseSystem(const fvMesh &)
Construct from fvMesh.
virtual autoPtr< phaseSystem::momentumTransferTable > momentumTransferf()
As momentumTransfer, but for the face-based algorithm.
virtual PtrList< PtrList< surfaceScalarField > > invADVfs(const PtrList< surfaceScalarField > &Afs, PtrList< surfaceScalarField > &HVmfs) const
Return the inverse of the central + drag + virtual mass.
virtual tmp< surfaceScalarField > alphaDByAf(const PtrList< volScalarField > &rAs) const
Return the phase diffusivity.
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,...
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
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, if not found return the given default.
A special matrix type and solver, designed for finite volume solutions of scalar equations....
tmp< volScalarField > A() const
Return the central coefficient.
tmp< VolField< Type > > H() const
Return the H operation source.
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 tmp< fvVectorMatrix > DUDt() const =0
Return the substantive acceleration matrix.
virtual bool stationary() const =0
Return whether the phase is stationary.
virtual tmp< surfaceScalarField > phi() const =0
Return the volumetric flux.
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.
virtual tmp< fvVectorMatrix > UgradU() const =0
Return the velocity transport matrix.
const word & name() const
Return the name of this phase.
virtual tmp< surfaceScalarField > pPrimef() const =0
Return the face-phase-pressure'.
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.
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/kmol].
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< 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)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const HashTable< dimensionSet > & dimensions()
Get the table of dimension sets.
void addField(const label phasei, const word &name, tmp< GeoField > field, PtrList< GeoField > &fieldList)
void LUBacksubstitute(const scalarSquareMatrix &luMmatrix, const labelList &pivotIndices, List< Type > &source)
LU back-substitution with given source, returning the solution.
const dimensionSet dimless
void LUDecompose(scalarSquareMatrix &matrix, labelList &pivotIndices)
LU decompose the matrix with pivoting.
tmp< volScalarField > byDt(const volScalarField &vf)
const dimensionSet dimTime
dimensionedScalar negPart(const dimensionedScalar &ds)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
const dimensionSet dimMass
const dimensionSet dimVelocity
dimensionedScalar posPart(const dimensionedScalar &ds)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.