35 #include "surfaceInterpolate.H" 51 namespace multiphaseInter
68 limitedPhiAlphas_(phaseModels_.size()),
69 Su_(phaseModels_.size()),
70 Sp_(phaseModels_.size())
85 const multiphaseInter::phaseModel& pm = iter()();
112 this->alphaTransfer(Su_, Sp_);
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_)
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_)
396 <<
alpha.weightedAverage(mesh_.V()).value()
397 <<
" Min(alpha) = " <<
min(
alpha).value()
398 <<
" Max(alpha) = " <<
max(
alpha).value()
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();
460 return limitedPhiAlphas_;
const fvMesh & mesh() const
Return mesh.
fvsPatchField< scalar > fvsPatchScalarField
UPtrList< phaseModel > phases_
Unallocated phase list.
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
bool emplace(const Key &key, Args &&... args)
Emplace insert a new entry, not overwriting existing entries.
errorManipArg< error, int > exit(error &err, const int errNo=1)
virtual bool read()
Read thermophysical properties dictionary.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
tmp< surfaceScalarField > flux(const volVectorField &vvf)
Return the face-flux field obtained from the given volVectorField.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type set(const label i, bool val=true)
A bitSet::set() method for a list of bool.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Calculate the snGrad of the given volField.
const word & name() const
The name of this phase.
const volScalarField & alpha2
const dimensionSet dimless
Dimensionless.
const dictionary & solverDict(const word &name) const
The solver controls dictionary for the given field. Same as solversDict().subDict(...)
DimensionedField< scalar, volMesh > Internal
The internal field type from which this GeometricField is derived.
SuSpTable & Sp()
Access Sp.
Area-weighted average a surfaceField creating a volField.
SuSpTable & Su()
Access Su.
#define forAll(list, i)
Loop across all elements in list.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Calculate the first temporal derivative.
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...
label size() const noexcept
The number of elements in table.
const fvMesh & mesh_
Reference to the mesh.
void solveAlphas()
Solve alphas.
virtual void solve()
Solve for the phase fractions.
void limitSum(UPtrList< scalarField > &phiPsiCorrs)
multiphaseSystem(const fvMesh &)
Construct from fvMesh.
const phaseModel & phase(const label i) const
Constant access phase model i.
Calculate the gradient of the given field.
surfaceScalarField phir(fvc::flux(UdmModel.Udm()))
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Calculate the face-flux of the given field.
Calculate the matrix for the first temporal derivative.
#define forAllIters(container, iter)
Iterate across all elements in the container object.
dimensionedScalar ddtAlphaMax() const
Access to ddtAlphaMax.
Perform a subCycleTime on a field.
const compressionFluxTable & limitedPhiAlphas() const
Access to compression fluxes for phaes.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
zeroField Sp(const Foam::zero, const GeometricField< Type, fvPatchField, volMesh > &)
A no-op source.
Calculate the divergence of the given field.
defineTypeNameAndDebug(interfaceCompositionModel, 0)
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
scalarTable cAlphas_
Table for compression factors between phases.
virtual bool coupled() const
True if the patch field is coupled.
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.
surfaceScalarField::Boundary & phicBf
const word & name() const noexcept
Return const reference to name.
surfaceScalarField phic(mixture.cAlpha() *mag(alphaPhic/mesh.magSf()))
SuSpTable Su_
Su phase source terms.
phaseModelTable phaseModels_
Phase models.
SuSpTable Sp_
Sp phase source terms.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Mesh data needed to do the Finite Volume discretisation.
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
scalar maxDiffNo() const
Maximum diffusion number.
messageStream Info
Information stream (stdout output on master, null elsewhere)
defineRunTimeSelectionTable(interfaceCompositionModel, dictionary)
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
IOobject newIOobject(const word &name, IOobjectOption ioOpt) const
Create an IOobject at the current time instance (timeName) with the specified options.
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
void setSize(const label n)
Alias for resize()
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
void explicitSolve(const RdeltaTType &rDeltaT, const RhoType &rho, volScalarField &psi, const surfaceScalarField &phiPsi, const SpType &Sp, const SuType &Su)
const UPtrList< phaseModel > & phases() const
Return phases.
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
void calculateSuSp()
Calculate Sp and Su.
CMULES: Multidimensional universal limiter for explicit corrected implicit solution.
Calculate the finiteVolume matrix for implicit and explicit sources.
forAllConstIters(mixture.phases(), phase)
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie...
static constexpr const zero Zero
Global zero (0)
const volScalarField & alpha1