46 const PtrList<volScalarField>& rAUs,
47 const PtrList<surfaceScalarField>& rAUfs
59 const bool splitPhaseFlux
61 alphaControls.lookupOrDefault<Switch>(
"splitPhaseFlux",
false)
66 const bool meanFluxReference
68 alphaControls.lookupOrDefault<Switch>(
"meanFluxReference",
false)
73 phaseModel* referencePhasePtr =
nullptr;
84 label solvePhasesi = 0;
89 solvePhases.set(solvePhasesi++, &
movingPhases()[movingPhasei]);
103 PtrList<surfaceScalarField> alphaPhiDbyA0s(
phases().size());
106 const PtrList<surfaceScalarField>
DByAfs(this->
DByAfs(rAUs, rAUfs));
108 forAll(solvePhases, solvePhasei)
110 const phaseModel& phase = solvePhases[solvePhasei];
140 tmp<surfaceScalarField> tphiMoving(
phi_);
147 bool dilatation =
false;
159 PtrList<volScalarField::Internal> Sps(
phases().size());
160 PtrList<volScalarField::Internal> Sus(
phases().size());
166 const label phasei = phase.index();
190 min(alpha.v(), scalar(1))
210 const phaseModel& phase2 =
phases()[phasej];
213 if (&phase2 != &phase)
215 if (phase.divU().valid())
220 if (phase2.divU().valid())
234 Sp[celli] -=
dgdt[celli]/
max(1 - alpha[celli], 1
e-4);
235 Su[celli] +=
dgdt[celli]/
max(1 - alpha[celli], 1
e-4);
237 else if (
dgdt[celli] < 0)
239 Sp[celli] +=
dgdt[celli]/
max(alpha[celli], 1
e-4);
245 tmp<volScalarField> trSubDeltaT;
253 List<volScalarField*> alphaPtrs(
phases().size());
261 subCycle<volScalarField, subCycleFields> alphaSubCycle
266 !(++alphaSubCycle).
end();
270 PtrList<surfaceScalarField> alphaPhis(
phases().size());
285 splitPhaseFlux ?
phi_ : phase.phi()(),
287 "div(phi," + alpha.
name() +
')' 301 if (&phase2 == &phase)
continue;
309 phasePairKey(phase.name(), phase2.name())
322 *
nHatf(alpha, alpha2);
325 const word phirScheme
328 + alpha2.name() +
',' + alpha.name()
347 if (&phase2 == &phase)
continue;
353 phasePairKey(phase.name(), phase2.name())
361 phase.phi() - phase2.phi()
372 *
nHatf(alpha, alpha2)
375 const word phirScheme
378 + alpha2.name() +
',' + alpha.name()
392 if (alphaPhiDbyA0s.set(phase.index()))
397 *alphaPhiDbyA0s[phase.index()];
400 phase.correctInflowOutflow(alphaPhi);
412 min(alphaVoid.primitiveField(), phase.alphaMax())(),
421 UPtrList<const volScalarField> alphasMoving
426 UPtrList<surfaceScalarField> alphaPhisMoving
435 alphasMoving.
set(movingPhasei, &phase);
440 &alphaPhis[phase.index()]
447 forAll(solvePhases, solvePhasei)
449 phaseModel& phase = solvePhases[solvePhasei];
453 phase.correctInflowOutflow(alphaPhi);
464 if (alphaSubCycle.index() == 1)
476 const PtrList<surfaceScalarField>
DByAfs 481 forAll(solvePhases, solvePhasei)
483 phaseModel& phase = solvePhases[solvePhasei];
501 phase.alphaPhiRef() += alphaEqn.flux();
506 forAll(solvePhases, solvePhasei)
508 phaseModel& phase = solvePhases[solvePhasei];
510 Info<< phase.name() <<
" fraction, min, max = " 511 << phase.weightedAverage(
mesh_.
V()).value()
512 <<
' ' <<
min(phase).value()
513 <<
' ' <<
max(phase).value()
517 if (referencePhasePtr)
520 referenceAlpha = alphaVoid;
522 forAll(solvePhases, solvePhasei)
524 referenceAlpha -= solvePhases[solvePhasei];
545 Info<<
"Phase-sum volume fraction, min, max = " 547 .weightedAverage(
mesh_.
V()).value()
562 forAll(solvePhases, solvePhasei)
564 phaseModel& phase = solvePhases[solvePhasei];
570 forAll(solvePhases, solvePhasei)
572 phaseModel& phase = solvePhases[solvePhasei];
574 phase.alphaRhoPhiRef() =
580 if (referencePhasePtr)
582 phaseModel& referencePhase = *referencePhasePtr;
584 referencePhase.alphaPhiRef() =
phi_;
586 forAll(solvePhases, solvePhasei)
588 phaseModel& phase = solvePhases[solvePhasei];
589 referencePhase.alphaPhiRef() -= phase.alphaPhi();
592 referencePhase.alphaRhoPhiRef() =
594 *referencePhase.alphaPhi();
597 referenceAlpha = alphaVoid;
599 forAll(solvePhases, solvePhasei)
601 referenceAlpha -= solvePhases[solvePhasei];
void limit(const RdeltaTType &rDeltaT, const RhoType &rho, const volScalarField &psi, const surfaceScalarField &phi, surfaceScalarField &phiPsi, const SpType &Sp, const SuType &Su, const PsiMaxType &psiMax, const PsiMinType &psiMin, const bool returnCorr)
fvMatrix< scalar > fvScalarMatrix
#define forAll(list, i)
Loop across all elements in list.
const phaseModelPartialList & movingPhases() const
Return the models for phases that are moving.
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 word & name() const
Return name.
static tmp< DimensionedField< Type, GeoMesh > > New(const word &name, const Mesh &mesh, const dimensionSet &)
Return a temporary field constructed from name, mesh.
volScalarField dgdt(alpha1 *fvc::div(phi))
tmp< surfaceScalarField > nHatf(const volScalarField &alpha1, const volScalarField &alpha2) const
Normal to interface between two phases dotted with face areas.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
bool interpolate(const vector &p1, const vector &p2, const vector &o, vector &n, scalar l)
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
static tmp< volScalarField > localRSubDeltaT(const fvMesh &mesh, const label nAlphaSubCycles)
Calculate and return the reciprocal of the local sub-cycling.
IOobject(const word &name, const fileName &instance, const objectRegistry ®istry, readOption r=NO_READ, writeOption w=NO_WRITE, bool registerObject=true)
Construct from name, instance, registry, io options.
volScalarField alpha(IOobject("alpha", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
bool empty() const
Return true if the hash table is empty.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Calculate the matrix for the laplacian of the field.
Calculate the snGrad of the given volField.
surfaceScalarField phir(fvc::flux(UdmModel.Udm()))
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
const dimensionSet dimless
const Time & time() const
Return the top-level database.
const dictionary & solverDict(const word &name) const
Return the solver controls dictionary for the given field.
const DimensionedField< scalar, volMesh > & V() const
Return cell volumes.
DimensionedField< scalar, volMesh > Internal
Type of the internal field from which this GeometricField is derived.
const phaseModelPartialList & stationaryPhases() const
Return the models for phases that are stationary.
virtual void solve(const PtrList< volScalarField > &rAUs, const PtrList< surfaceScalarField > &rAUfs)
Solve for the phase fractions.
tmp< GeometricField< Type, fvPatchField, volMesh > > ddt(const dimensioned< Type > dt, const fvMesh &mesh)
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
dictionary()
Construct top-level dictionary null.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Calculate the first temporal derivative.
const phaseModelList & phases() const
Return the phase models.
const dimensionSet dimTime
static bool enabled(const fvMesh &mesh)
Return true if LTS is enabled.
void limitSum(UPtrList< scalarField > &phiPsiCorrs)
Calculate the face-flux of the given field.
static word groupName(Name name, const word &group)
friend class const_iterator
Declare friendship with the const_iterator.
tmp< fvMatrix< Type > > ddt(const GeometricField< Type, fvPatchField, volMesh > &vf)
Calculate the matrix for the first temporal derivative.
word referencePhaseName_
Name of optional reference phase which is not solved for.
static const word null
An empty word.
UPtrList< phaseModel > phaseModelPartialList
surfaceScalarField alphaPhi(phi.name()+alpha1.name(), fvc::flux(phi, alpha1, alphaScheme))
const fvMesh & mesh_
Reference to the mesh.
Calculate the field for explicit evaluation of implicit and explicit sources.
cAlphaTable cAlphas_
Interface compression coefficients.
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
Calculate the divergence of the given field.
const surfaceScalarField & magSf() const
Return cell face area magnitudes.
bool set(const label) const
Is element set.
tmp< volScalarField > sumAlphaMoving() const
Return the sum of the phase fractions of the moving phases.
const label nAlphaSubCycles(alphaControls.lookup< label >("nAlphaSubCycles"))
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
tmp< volScalarField > divU
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.
Calculate the mesh motion flux and convert fluxes from absolute to relative and back.
tmp< surfaceScalarField > absolute(const tmp< surfaceScalarField > &tphi, const volVectorField &U)
Return the given relative flux in absolute form.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
tmp< fvMatrix< Type > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
virtual PtrList< surfaceScalarField > DByAfs(const PtrList< volScalarField > &rAUs, const PtrList< surfaceScalarField > &rAUfs) const =0
Return the phase diffusivity.
dimensioned< scalar > mag(const dimensioned< Type > &)
const label nAlphaCorr(alphaControls.lookup< label >("nAlphaCorr"))
MULES: Multidimensional universal limiter for explicit solution.
const doubleScalar e
Elementary charge.
surfaceScalarField phi_
Total volumetric flux.
tmp< surfaceScalarField > flux(const volVectorField &vvf)
Return the face-flux field obtained from the given volVectorField.
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
void explicitSolve(const RdeltaTType &rDeltaT, const RhoType &rho, volScalarField &psi, const surfaceScalarField &phiPsi, const SpType &Sp, const SuType &Su)
virtual bool implicitPhasePressure() const
Returns true if the phase pressure is treated implicitly.
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Calculate the matrix for implicit and explicit sources.