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];
445 phase.
alphaPhi()().boundaryField().types()
451 if (!cAlphas_.empty())
458 if (&phase2 == &phase)
continue;
460 cAlphaTable::const_iterator cAlpha
465 if (cAlpha != cAlphas_.end())
469 phase.
phi() - phase2.
phi()
474 (
mag(phi_) +
mag(phir))/mesh_.magSf()
479 min(cAlpha()*phic,
max(phic))
480 *nHatf(
alpha, alpha2)
483 const word phirScheme
501 if (alphaPhiDByA.
set(movingPhasei))
503 alphaPhi += alphaPhiDByA[movingPhasei];
511 if (boundedPredictor)
520 phase.
alphaPhi()().boundaryField().types()
528 alphaPhiBDs[movingPhasei].boundaryFieldRef();
539 alphaPhiBDPf = alphaPhiBf[
patchi];
549 boundedPredictor ? alphaPhiBDs : alphaPhis;
551 forAll(movingPhases(), movingPhasei)
553 const phaseModel& phase = movingPhases()[movingPhasei];
558 alphaPhiCorrs[movingPhasei] ==
559 alphaPhiCorrs[movingPhasei]
560 - alphaPhiPreds[movingPhasei];
567 : alphaControls.
MULES,
570 alphaPhiPreds[movingPhasei],
571 alphaPhiCorrs[movingPhasei],
583 forAll(solvePhases, solvePhasei)
587 const label movingPhasei =
588 solveMovingPhaseIndices[solvePhasei];
591 alphaPhiCorrs[movingPhasei];
604 forAll(movingPhases(), movingPhasei)
606 const phaseModel& phase = movingPhases()[movingPhasei];
613 : alphaControls.
MULES,
618 ? alphaPhiBDs[movingPhasei]
619 : alphaPhis[movingPhasei],
633 boundedPredictor ? alphaPhiBDs : alphaPhis,
637 forAll(solvePhases, solvePhasei)
643 (boundedPredictor ? alphaPhiBDs : alphaPhis)
644 [solveMovingPhaseIndices[solvePhasei]];
658 if (referencePhasePtr)
661 referenceAlpha = alphaVoid;
663 forAll(solvePhases, solvePhasei)
665 referenceAlpha -= solvePhases[solvePhasei];
669 if (boundedPredictor)
679 forAll(movingPhases(), movingPhasei)
681 alphaPhis[movingPhasei] -=
683 alphaPhiPreds[movingPhasei]
684 + alphaPhiBDs[movingPhasei]
690 forAll(movingPhases(), movingPhasei)
692 alphaPhis[movingPhasei] -= alphaPhiBDs[movingPhasei];
697 forAll(movingPhases(), movingPhasei)
699 const phaseModel& phase = movingPhases()[movingPhasei];
708 ? alphaPhiPreds[movingPhasei]
709 : alphaPhiBDs[movingPhasei],
710 alphaPhis[movingPhasei],
722 forAll(solvePhases, solvePhasei)
728 alphaPhis[solveMovingPhaseIndices[solvePhasei]];
741 if (implicitPhasePressure() && rAs.
size())
748 forAll(solvePhases, solvePhasei)
761 mesh_.solution().solverDict(
"alpha")
762 .optionalSubDict(
"phasePressure")
765 alphaPhis[solveMovingPhaseIndices[solvePhasei]] +=
771 forAll(solvePhases, solvePhasei)
773 const phaseModel& phase = solvePhases[solvePhasei];
775 Info<< phase.
name() <<
" fraction, min, max = "
777 <<
' ' <<
min(phase).value()
778 <<
' ' <<
max(phase).value()
784 if (referencePhasePtr)
787 referenceAlpha = alphaVoid;
789 forAll(solvePhases, solvePhasei)
791 referenceAlpha -= solvePhases[solvePhasei];
808 forAll(movingPhases(), movingPhasei)
810 sumAlphaMoving += movingPhases()[movingPhasei];
813 Info<<
"Phase-sum volume fraction, min, max = "
814 << (sumAlphaMoving + 1 - alphaVoid())()
815 .weightedAverage(mesh_.Vsc()).value()
816 <<
' ' <<
min(sumAlphaMoving + 1 - alphaVoid()).value()
817 <<
' ' <<
max(sumAlphaMoving + 1 - alphaVoid()).value()
820 if (alphaControls.
clip)
823 forAll(movingPhases(), movingPhasei)
825 movingPhases()[movingPhasei].internalFieldRef() *=
826 alphaVoid()/sumAlphaMoving;
835 if (boundedPredictor)
837 forAll(movingPhases(), movingPhasei)
839 phaseModel& phase = movingPhases()[movingPhasei];
844 *(alphaPreds[movingPhasei] -
alpha);
846 alphaPreds[movingPhasei] =
alpha;
852 alphaPhiBDs[movingPhasei]
853 + alphaPhis[movingPhasei]
857 alphaPhiPreds[movingPhasei] += alphaPhiInc;
862 forAll(movingPhases(), movingPhasei)
864 phaseModel& phase = movingPhases()[movingPhasei];
869 *(alphaPreds[movingPhasei] -
alpha);
871 alphaPreds[movingPhasei] =
alpha;
878 alphaPhiPreds[movingPhasei] += alphaPhiInc;
885 if (boundedPredictor)
887 forAll(movingPhases(), movingPhasei)
889 phaseModel& phase = movingPhases()[movingPhasei];
891 if (alphaSubCycle.index() == 1)
905 forAll(movingPhases(), movingPhasei)
907 phaseModel& phase = movingPhases()[movingPhasei];
909 if (alphaSubCycle.index() == 1)
923 if (nAlphaSubCycles > 1)
925 forAll(solvePhases, solvePhasei)
927 solvePhases[solvePhasei].alphaPhiRef() /= nAlphaSubCycles;
931 forAll(solvePhases, solvePhasei)
939 if (alphaControls.
clip)
944 if (stationaryPhases().size())
953 if (referencePhasePtr)
955 phaseModel& referencePhase = *referencePhasePtr;
959 forAll(solvePhases, solvePhasei)
962 solvePhases[solvePhasei].alphaPhi();
970 referenceAlpha = alphaVoid;
972 forAll(solvePhases, solvePhasei)
974 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...
static tmp< DimensionedField< Type, GeoMesh, PrimitiveField > > New(const word &name, const GeoMesh &mesh, const dimensionSet &, const PrimitiveField< Type > &)
Return a temporary field constructed from name, mesh,.
dimensioned< Type > weightedAverage(const DimensionedField< scalar, GeoMesh, PrimitiveField2 > &) const
Calculate and return weighted average.
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.
static tmp< GeometricField< Type, GeoMesh, PrimitiveField > > New(const word &name, const Internal &, const PtrList< Patch > &, const HashPtrTable< Source > &=HashPtrTable< Source >())
Return a temporary field constructed from name,.
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)
const dimensionSet & dimless
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 & dimTime
dimensioned< Type > min(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
tmp< DimensionedField< scalar, GeoMesh, Field > > mag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
dimensioned< Type > max(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
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.