57 .lookupOrDefault<Switch>(
"implicitPhasePressure",
false)
75 const bool boundedPredictor =
93 label referenceMovingPhaseIndex = -1;
97 referencePhasePtr = &phases()[referencePhaseName_];
99 solvePhases.
setSize(movingPhases().size() - 1);
100 solveMovingPhaseIndices.
setSize(solvePhases.
size());
102 label solvePhasesi = 0;
103 forAll(movingPhases(), movingPhasei)
105 if (&movingPhases()[movingPhasei] != referencePhasePtr)
107 solveMovingPhaseIndices[solvePhasesi] = movingPhasei;
108 solvePhases.
set(solvePhasesi++, &movingPhases()[movingPhasei]);
112 referenceMovingPhaseIndex = movingPhasei;
118 solvePhases = movingPhases();
124 phases()[phasei].correctBoundaryConditions();
130 forAll(movingPhases(), movingPhasei)
132 alphasMoving.
set(movingPhasei, &movingPhases()[movingPhasei]);
133 phisMoving.
set(movingPhasei, &movingPhases()[movingPhasei].phi()());
148 forAll(stationaryPhases(), stationaryPhasei)
150 alphaVoid -= stationaryPhases()[stationaryPhasei];
155 if (stationaryPhases().size())
161 bool dilatation =
false;
162 forAll(movingPhases(), movingPhasei)
164 if (movingPhases()[movingPhasei].divU().
valid())
174 forAll(movingPhases(), movingPhasei)
176 const phaseModel& phase = movingPhases()[movingPhasei];
225 if (&phase2 != &phase)
229 vDot += alpha2()*phase.
divU()()();
261 else if (vDot[celli] < 0)
277 if (LTS && nAlphaSubCycles > 1)
287 alphas.
set(phasei, &phases()[phasei]);
293 if (implicitPhasePressure() && rAs.
size())
298 forAll(movingPhases(), movingPhasei)
300 const phaseModel& phase = movingPhases()[movingPhasei];
318 !(++alphaSubCycle).end();
329 forAll(solvePhases, solvePhasei)
348 ).fvmDiv(phiMoving,
alpha)
358 solveMovingPhaseIndices[solvePhasei],
364 solveMovingPhaseIndices[solvePhasei],
368 Info<< phase.
name() <<
" predicted fraction, min, max = "
370 <<
' ' <<
min(phase).value()
371 <<
' ' <<
max(phase).value()
377 if (referencePhasePtr)
380 referenceAlpha = alphaVoid;
382 forAll(solvePhases, solvePhasei)
384 referenceAlpha -= solvePhases[solvePhasei];
389 referenceMovingPhaseIndex,
393 alphaPhiPreds.
set(referenceMovingPhaseIndex, phi_);
395 forAll(solvePhases, solvePhasei)
397 alphaPhiPreds[referenceMovingPhaseIndex]
398 -= alphaPhiPreds[solveMovingPhaseIndices[solvePhasei]];
403 forAll(solvePhases, solvePhasei)
406 const label movingPhasei = solveMovingPhaseIndices[solvePhasei];
408 if (alphaSubCycle.index() == 1)
414 phase.
alphaPhiRef() += alphaPhiPreds[movingPhasei];
420 for (
int acorr=0; acorr<alphaControls.
nAlphaCorr; acorr++)
428 forAll(movingPhases(), movingPhasei)
430 const phaseModel& phase = movingPhases()[movingPhasei];
450 if (!cAlphas_.empty())
457 if (&phase2 == &phase)
continue;
464 if (cAlpha != cAlphas_.end())
468 phase.
phi() - phase2.
phi()
473 (
mag(phi_) +
mag(phir))/mesh_.magSf()
478 min(cAlpha()*phic,
max(phic))
479 *nHatf(
alpha, alpha2)
482 const word phirScheme
500 if (alphaPhiDByA.
set(movingPhasei))
502 alphaPhi += alphaPhiDByA[movingPhasei];
510 if (boundedPredictor)
526 alphaPhiBDs[movingPhasei].boundaryFieldRef();
537 alphaPhiBDPf = alphaPhiBf[
patchi];
547 boundedPredictor ? alphaPhiBDs : alphaPhis;
549 forAll(movingPhases(), movingPhasei)
551 const phaseModel& phase = movingPhases()[movingPhasei];
556 alphaPhiCorrs[movingPhasei] -= alphaPhiPreds[movingPhasei];
563 : alphaControls.
MULES,
566 alphaPhiPreds[movingPhasei],
567 alphaPhiCorrs[movingPhasei],
579 forAll(solvePhases, solvePhasei)
583 const label movingPhasei =
584 solveMovingPhaseIndices[solvePhasei];
587 alphaPhiCorrs[movingPhasei];
600 forAll(movingPhases(), movingPhasei)
602 const phaseModel& phase = movingPhases()[movingPhasei];
609 : alphaControls.
MULES,
614 ? alphaPhiBDs[movingPhasei]
615 : alphaPhis[movingPhasei],
629 boundedPredictor ? alphaPhiBDs : alphaPhis,
633 forAll(solvePhases, solvePhasei)
639 (boundedPredictor ? alphaPhiBDs : alphaPhis)
640 [solveMovingPhaseIndices[solvePhasei]];
654 if (referencePhasePtr)
657 referenceAlpha = alphaVoid;
659 forAll(solvePhases, solvePhasei)
661 referenceAlpha -= solvePhases[solvePhasei];
665 if (boundedPredictor)
675 forAll(movingPhases(), movingPhasei)
677 alphaPhis[movingPhasei] -=
679 alphaPhiPreds[movingPhasei]
680 + alphaPhiBDs[movingPhasei]
686 forAll(movingPhases(), movingPhasei)
688 alphaPhis[movingPhasei] -= alphaPhiBDs[movingPhasei];
693 forAll(movingPhases(), movingPhasei)
695 const phaseModel& phase = movingPhases()[movingPhasei];
704 ? alphaPhiPreds[movingPhasei]
705 : alphaPhiBDs[movingPhasei],
706 alphaPhis[movingPhasei],
718 forAll(solvePhases, solvePhasei)
724 alphaPhis[solveMovingPhaseIndices[solvePhasei]];
737 if (implicitPhasePressure() && rAs.
size())
744 forAll(solvePhases, solvePhasei)
757 mesh_.solution().solverDict(
"alpha")
758 .optionalSubDict(
"phasePressure")
761 alphaPhis[solveMovingPhaseIndices[solvePhasei]] +=
767 forAll(solvePhases, solvePhasei)
769 const phaseModel& phase = solvePhases[solvePhasei];
771 Info<< phase.
name() <<
" fraction, min, max = "
773 <<
' ' <<
min(phase).value()
774 <<
' ' <<
max(phase).value()
780 if (referencePhasePtr)
783 referenceAlpha = alphaVoid;
785 forAll(solvePhases, solvePhasei)
787 referenceAlpha -= solvePhases[solvePhasei];
804 forAll(movingPhases(), movingPhasei)
806 sumAlphaMoving += movingPhases()[movingPhasei];
809 Info<<
"Phase-sum volume fraction, min, max = "
810 << (sumAlphaMoving + 1 - alphaVoid())()
811 .weightedAverage(mesh_.Vsc()).value()
812 <<
' ' <<
min(sumAlphaMoving + 1 - alphaVoid()).value()
813 <<
' ' <<
max(sumAlphaMoving + 1 - alphaVoid()).value()
816 if (alphaControls.
clip)
819 forAll(movingPhases(), movingPhasei)
821 movingPhases()[movingPhasei].internalFieldRef() *=
822 alphaVoid()/sumAlphaMoving;
831 if (boundedPredictor)
833 forAll(movingPhases(), movingPhasei)
835 phaseModel& phase = movingPhases()[movingPhasei];
840 *(alphaPreds[movingPhasei] -
alpha);
842 alphaPreds[movingPhasei] =
alpha;
848 alphaPhiBDs[movingPhasei]
849 + alphaPhis[movingPhasei]
853 alphaPhiPreds[movingPhasei] += alphaPhiInc;
858 forAll(movingPhases(), movingPhasei)
860 phaseModel& phase = movingPhases()[movingPhasei];
865 *(alphaPreds[movingPhasei] -
alpha);
867 alphaPreds[movingPhasei] =
alpha;
874 alphaPhiPreds[movingPhasei] += alphaPhiInc;
881 if (boundedPredictor)
883 forAll(movingPhases(), movingPhasei)
885 phaseModel& phase = movingPhases()[movingPhasei];
887 if (alphaSubCycle.index() == 1)
901 forAll(movingPhases(), movingPhasei)
903 phaseModel& phase = movingPhases()[movingPhasei];
905 if (alphaSubCycle.index() == 1)
919 if (nAlphaSubCycles > 1)
921 forAll(solvePhases, solvePhasei)
923 solvePhases[solvePhasei].alphaPhiRef() /= nAlphaSubCycles;
927 forAll(solvePhases, solvePhasei)
935 if (alphaControls.
clip)
940 if (stationaryPhases().size())
949 if (referencePhasePtr)
951 phaseModel& referencePhase = *referencePhasePtr;
955 forAll(solvePhases, solvePhasei)
958 solvePhases[solvePhasei].alphaPhi();
966 referenceAlpha = alphaVoid;
968 forAll(solvePhases, solvePhasei)
970 referenceAlpha -= solvePhases[solvePhasei];
CMULES: Multidimensional universal limiter for explicit corrected implicit solution.
#define forAll(list, i)
Loop across all elements in list.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
dimensioned< Type > weightedAverage(const DimensionedField< scalar, GeoMesh, PrimitiveField2 > &) const
Calculate and return weighted average.
static tmp< DimensionedField< Type, GeoMesh, PrimitiveField > > New(const word &name, const Mesh &mesh, const dimensionSet &, const PrimitiveField< Type > &)
Return a temporary field constructed from name, mesh,.
Generic GeometricBoundaryField class.
Generic GeometricField class.
void maxMin(const dimensioned< Type > &minDt, const dimensioned< Type > &maxDt)
const Boundary & boundaryField() const
Return const-reference to the boundary field.
const Internal::FieldType & primitiveField() const
Return a const-reference to the primitive field.
const Internal & v() const
Return a const-reference to the dimensioned internal field.
An STL-conforming const_iterator.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
const word & name() const
Return name.
static word groupName(Name name, const word &group)
void setSize(const label)
Reset size of List.
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.
bool set(const label) const
Is element set.
label size() const
Return the number of elements in the UPtrList.
void setSize(const label)
Reset size of UPtrList. This can only be used to set the size.
A special matrix type and solver, designed for finite volume solutions of scalar equations....
SolverPerformance< Type > solve(const dictionary &)
Solve segregated or coupled returning the solution statistics.
tmp< SurfaceField< Type > > flux() const
Return the face-flux field from the matrix.
Basic first-order Euler implicit/explicit ddt using only the current and previous time-step values.
Basic second-order convection using face-gradients and Gauss' theorem.
Local time-step first-order Euler implicit/explicit ddt.
static tmp< volScalarField > localRSubDeltaT(const fvMesh &mesh, const label nAlphaSubCycles)
Calculate and return the reciprocal of the local sub-cycling.
static bool enabled(const fvMesh &mesh)
Return true if LTS is enabled.
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
virtual bool coupled() const
Return true if this patch field is coupled.
A class representing the concept of a GeometricField of 1 used to avoid unnecessary manipulations for...
virtual tmp< SurfaceField< Type > > flux(const VolField< Type > &) const
Return the interpolation weighting factors.
Class which provides interfacial momentum transfer between a number of phases. Drag,...
virtual tmp< surfaceScalarField > alphaDByAf(const PtrList< volScalarField > &rAs) const
Return the phase diffusivity.
Class to represent an interface between phases. Derivations can further specify the configuration of ...
scalar alphaMax() const
Return the maximum phase-fraction (e.g. packing limit)
virtual bool stationary() const =0
Return whether the phase is stationary.
virtual const autoPtr< volScalarField > & divU() const =0
Return the phase dilatation rate (d(alpha)/dt + div(alpha*phi))
virtual tmp< surfaceScalarField > phi() const =0
Return the volumetric flux.
label index() const
Return the index of the phase.
virtual surfaceScalarField & alphaRhoPhiRef()=0
Access the mass flux of the phase.
virtual tmp< volVectorField > U() const =0
Return the velocity.
virtual surfaceScalarField & alphaPhiRef()=0
Access the volumetric flux of the phase.
void correctInflowOutflow(surfaceScalarField &alphaPhi) const
Ensure that the flux at inflow/outflow BCs is preserved.
const word & name() const
Return the name of this phase.
virtual const volScalarField & rho() const =0
Return the density field.
virtual tmp< surfaceScalarField > alphaPhi() const =0
Return the volumetric flux of the phase.
const phaseModelList & phases() const
Return the phase models.
bool implicitPhasePressure() const
Returns true if the phase pressure is treated implicitly.
const fvMesh & mesh() const
Return the mesh.
void solve(const alphaControl &alphaControls, const PtrList< volScalarField > &rAs, const momentumTransferSystem &mts)
Solve for the phase fractions.
Selector class for relaxation factors, solver type and solution.
Perform a subCycleTime on a field or list of fields.
static tmp< SurfaceField< Type > > interpolate(const VolField< Type > &, const tmp< surfaceScalarField > &, const tmp< surfaceScalarField > &)
Return the face-interpolate of the given cell field.
A class for managing temporary objects.
A class for handling words, derived from string.
static const word null
An empty word.
A class representing the concept of a field of 0 used to avoid unnecessary manipulations for objects ...
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.
Calculate the snGrad of the given volField.
Calculate the field for explicit evaluation of implicit and explicit sources.
Calculate the matrix for the first temporal derivative.
Calculate the matrix for the laplacian of the field.
Calculate the matrix for implicit and explicit sources.
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
void correct(const RdeltaTType &rDeltaT, const RhoType &rho, volScalarField &psi, const surfaceScalarField &phiCorr, const SpType &Sp)
void limitSum(const UPtrList< const volScalarField > &psis, const PtrList< surfaceScalarField > &alphaPhiBDs, UPtrList< surfaceScalarField > &psiPhis, const surfaceScalarField &phi)
void limitSumCorr(UPtrList< scalarField > &psiPhiCorrs)
void limitCorr(const control &controls, const RdeltaTType &rDeltaT, const RhoType &rho, const volScalarField &psi, const surfaceScalarField &phiBD, surfaceScalarField &phiCorr, const SpType &Sp, const PsiMaxType &psiMax, const PsiMinType &psiMin)
void explicitSolve(const RdeltaTType &rDeltaT, const RhoType &rho, volScalarField &psi, const surfaceScalarField &psiPhi, const SpType &Sp, const SuType &Su)
void limit(const control &controls, const RdeltaTType &rDeltaT, const RhoType &rho, const volScalarField &psi, const surfaceScalarField &phi, surfaceScalarField &psiPhi, const SpType &Sp, const SuType &Su, const PsiMaxType &psiMax, const PsiMinType &psiMin, const bool returnCorr)
bool valid(const PtrList< ModelType > &l)
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< Type > > ddt(const dimensioned< Type > dt, const fvMesh &mesh)
tmp< VolField< Type > > Su(const VolField< Type > &su, const VolField< Type > &vf)
tmp< VolField< Type > > Sp(const volScalarField &sp, const VolField< Type > &vf)
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< fvMatrix< Type > > laplacian(const VolField< Type > &vf, const word &name)
tmp< fvMatrix< Type > > Sp(const volScalarField::Internal &, const VolField< Type > &)
tmp< fvMatrix< Type > > ddt(const VolField< Type > &vf)
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
void mag(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
const dimensionSet dimTime
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Switch globalBounds
Optional switch to select global bounds only.
scalar extremaCoeff
Optional coefficient to relax the local boundedness constraint.
alpha solution control structure
Switch clip
Optionally clip the phase-fractions.
label nAlphaCorr
Number of alpha correctors.
scalar vDotResidualAlpha
Compressibility source stabilisation tolerance.
MULES::control MULES
MULES controls.
bool MULESCorr
Semi-implicit MULES switch.
scalar MULESCorrRelax
Explicit correction relaxation factor (defaults to 0.5)
label nAlphaSubCycles
Number of alpha equation sub-cycles.