35#include "surfaceInterpolate.H"
68 limitedPhiAlphas_(phaseModels_.size()),
69 Su_(phaseModels_.size()),
70 Sp_(phaseModels_.size())
85 const multiphaseInter::phaseModel& pm = iter()();
127 mesh_.newIOobject(
"rhoPhiSum"),
137 !(++alphaSubCycle).
end();
141 rhoPhiSum += (mesh_.time().deltaT()/totalDeltaT)*rhoPhi_;
182 for (multiphaseInter::phaseModel&
phase1 : phases_)
191 "phi" +
alpha1.name() +
"Corr",
196 "div(phi," +
alpha1.name() +
')'
203 for (multiphaseInter::phaseModel&
phase2 : phases_)
211 if (!cAlphas_.found(key12))
214 <<
"Phase compression factor (cAlpha) not found for : "
218 scalar cAlpha = cAlphas_.find(key12)();
238 forAll(phiAlphaCorr.boundaryField(), patchi)
241 phiAlphaCorr.boundaryFieldRef()[patchi];
243 if (!phiAlphaCorrp.coupled())
247 alpha1.boundaryField()[patchi];
249 forAll(phiAlphaCorrp, facei)
251 if (phi1p[facei] < 0)
253 phiAlphaCorrp[facei] = alpha1p[facei]*phi1p[facei];
263 for (
const multiphaseInter::phaseModel& phase : phases_)
265 Su_[phase.name()] =
Zero;
266 Sp_[phase.name()] =
Zero;
278 for (multiphaseInter::phaseModel& phase : phases_)
289 1.0/mesh_.time().deltaTValue(),
307 mesh_.newIOobject(
"sumAlpha"),
313 for (multiphaseInter::phaseModel& phase : phases_)
327 fv::EulerDdtScheme<scalar>(mesh_).fvmDdt(
alpha1)
328 + fv::gaussConvectionScheme<scalar>
332 upwind<scalar>(mesh_,
phi)
338 alpha1Eqn.boundaryManipulate(
alpha1.boundaryFieldRef());
342 phiAlpha += alpha1Eqn.flux();
356 phase.alphaPhi() = phiAlpha;
365 mesh_.newIOobject(
"sumAlpha"),
373 for (multiphaseInter::phaseModel& phase : phases_)
382 Info<<
"Phase-sum volume fraction, min, max = "
383 << sumAlpha.weightedAverage(mesh_.V()).value()
384 <<
' ' <<
min(sumAlpha).value()
385 <<
' ' <<
max(sumAlpha).value()
390 for (multiphaseInter::phaseModel& phase : phases_)
395 Info<<
alpha.name() <<
" volume fraction = "
396 <<
alpha.weightedAverage(mesh_.V()).value()
397 <<
" Min(alpha) = " <<
min(
alpha).value()
398 <<
" Max(alpha) = " <<
max(
alpha).value()
406const Foam::UPtrList<Foam::multiphaseInter::phaseModel>&
444 auto iter = phaseModels_.cbegin();
446 scalar maxVal =
max(iter()->diffNo()).value();
448 for (++iter; iter != phaseModels_.cend(); ++iter)
450 maxVal =
max(maxVal,
max(iter()->diffNo()).value());
453 return maxVal * mesh_.time().deltaTValue();
CMULES: Multidimensional universal limiter for explicit corrected implicit solution.
surfaceScalarField::Boundary & phicBf
surfaceScalarField phic(mixture.cAlpha() *mag(alphaPhic/mesh.magSf()))
const volScalarField & alpha1
const volScalarField & alpha2
label size() const noexcept
The number of elements in list.
dimensioned< Type > weightedAverage(const DimensionedField< scalar, GeoMesh > &weights, const label comm=UPstream::worldComm) const
Return the global weighted average.
DimensionedField< scalar, volMesh > Internal
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
GeometricBoundaryField< scalar, fvsPatchField, surfaceMesh > Boundary
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
label size() const noexcept
The number of elements in table.
bool emplace(const Key &key, Args &&... args)
Emplace insert a new entry, not overwriting existing entries.
bool set(const label i, bool val=true)
A bitSet::set() method for a list of bool.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie,...
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie,...
void setSize(const label n)
Alias for resize().
virtual const volScalarField & alpha() const
Thermal diffusivity for enthalpy of mixture [kg/m/s].
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, IOobjectOption::readOption readOpt=IOobjectOption::MUST_READ) const
Find entry and assign to T val. FatalIOError if it is found and the number of tokens is incorrect,...
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > flux() const
Return the face-flux field from the matrix.
SolverPerformance< Type > solve(const dictionary &)
Solve returning the solution statistics.
void boundaryManipulate(typename GeometricField< Type, fvPatchField, volMesh >::Boundary &values)
Manipulate based on a boundary field.
Mesh data needed to do the Finite Volume discretisation.
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.
virtual bool coupled() const
True if the patch field is coupled.
A class representing the concept of a GeometricField of 1 used to avoid unnecessary manipulations for...
virtual void alphaTransfer(SuSpTable &Su, SuSpTable &Sp)=0
Calculate mass transfer for alpha's.
const fvMesh & mesh_
Reference to the mesh.
const surfaceScalarField & phi() const
Constant access to the total flux.
multiphaseInterSystem(const fvMesh &mesh)
Construct from fvMesh.
const fvMesh & mesh() const
Return mesh.
tmp< surfaceScalarField > nHatf(const volScalarField &alpha1, const volScalarField &alpha2) const
Interface normal surface vector.
surfaceScalarField rhoPhi_
Mixture total mass flux.
phaseModelTable phaseModels_
Phase models.
dimensionedScalar ddtAlphaMax() const
Access to ddtAlphaMax.
SuSpTable & Su()
Access Su.
compressionFluxTable limitedPhiAlphas_
Compression fluxed for phases.
const phaseModel & phase(const label i) const
Constant access phase model i.
const UPtrList< phaseModel > & phases() const
Return phases.
UPtrList< phaseModel > phases_
Unallocated phase list.
scalarTable cAlphas_
Table for compression factors between phases.
const compressionFluxTable & limitedPhiAlphas() const
Access to compression fluxes for phaes.
HashTable< surfaceScalarField > compressionFluxTable
SuSpTable & Sp()
Access Sp.
HashTable< volScalarField::Internal > SuSpTable
void calculateSuSp()
Calculate Sp and Su.
dimensionedScalar ddtAlphaMax_
Maximum volumen rate change.
multiphaseSystem(const fvMesh &)
Construct from fvMesh.
SuSpTable Sp_
Sp phase source terms.
scalar maxDiffNo() const
Maximum diffusion number.
SuSpTable Su_
Su phase source terms.
virtual void solve()
Solve for the phase fractions.
virtual bool read()
Read thermophysical properties dictionary.
void solveAlphas()
Solve alphas.
const word & name() const
The name of this phase.
IOobject newIOobject(const word &name, IOobjectOption ioOpt) const
Create an IOobject at the current time instance (timeName) with the specified options.
A class representing the concept of a field of 1 used to avoid unnecessary manipulations for objects ...
An ordered or unorder pair of phase names. Typically specified as follows.
bool end() const
Return true if the number of sub-cycles has been reached.
Perform a subCycleTime on a field.
Upwind differencing scheme class.
A class for handling words, derived from Foam::string.
A class representing the concept of a field of 0 used to avoid unnecessary manipulations for objects ...
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
surfaceScalarField phir(fvc::flux(UdmModel.Udm()))
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Area-weighted average a surfaceField creating a volField.
Calculate the first temporal derivative.
Calculate the divergence of the given field.
Calculate the face-flux of the given field.
Calculate the gradient 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 matrix for the first temporal derivative.
Calculate the finiteVolume matrix for implicit and explicit sources.
void explicitSolve(const RdeltaTType &rDeltaT, const RhoType &rho, volScalarField &psi, const surfaceScalarField &phiPsi, const SpType &Sp, const SuType &Su)
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)
void limitSum(UPtrList< scalarField > &phiPsiCorrs)
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.
tmp< surfaceScalarField > flux(const volVectorField &vvf)
Return the face-flux field obtained from the given volVectorField.
zeroField Sp(const Foam::zero, const GeometricField< Type, fvPatchField, volMesh > &)
A no-op source.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
const dimensionSet dimless
Dimensionless.
fvMatrix< scalar > fvScalarMatrix
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
messageStream Info
Information stream (stdout output on master, null elsewhere).
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
errorManipArg< error, int > exit(error &err, const int errNo=1)
fvsPatchField< scalar > fvsPatchScalarField
#define defineRunTimeSelectionTable(baseType, argNames)
Define run-time selection table.
#define forAll(list, i)
Loop across all elements in list.
#define forAllIters(container, iter)
Iterate across all elements in the container object.
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.