Go to the documentation of this file.
30 #include "alphaContactAngleFvPatchScalarField.H"
35 #include "surfaceInterpolate.H"
46 void Foam::multiphaseSystem::calcAlphas()
51 for (
const phaseModel&
phase : phases_)
53 alphas_ += level *
phase;
59 void Foam::multiphaseSystem::solveAlphas()
61 PtrList<surfaceScalarField> alphaPhiCorrs(phases_.size());
64 for (phaseModel& phase : phases_)
73 "phi" +
alpha1.name() +
"Corr",
78 "div(phi," +
alpha1.name() +
')'
85 for (phaseModel&
phase2 : phases_)
89 if (&
phase2 == &phase)
continue;
93 const auto cAlpha = cAlphas_.cfind(interfacePair(phase,
phase2));
105 const word phirScheme
122 1.0/mesh_.time().deltaT().value(),
144 mesh_.time().timeName(),
153 for (phaseModel& phase : phases_)
156 alphaPhi += upwind<scalar>(mesh_, phi_).flux(phase);
168 Info<< phase.
name() <<
" volume fraction, min, max = "
169 << phase.weightedAverage(mesh_.V()).value()
170 <<
' ' <<
min(phase).value()
171 <<
' ' <<
max(phase).value()
179 Info<<
"Phase-sum volume fraction, min, max = "
180 << sumAlpha.weightedAverage(mesh_.V()).value()
181 <<
' ' <<
min(sumAlpha).value()
182 <<
' ' <<
max(sumAlpha).value()
187 for (phaseModel& phase : phases_)
219 return gradAlphaf/(
mag(gradAlphaf) + deltaN_);
240 void Foam::multiphaseSystem::correctContactAngle
244 surfaceVectorField::Boundary& nHatb
247 const volScalarField::Boundary& gbf
250 const fvBoundaryMesh&
boundary = mesh_.boundary();
254 if (isA<alphaContactAngleFvPatchScalarField>(gbf[patchi]))
256 const alphaContactAngleFvPatchScalarField& acap =
257 refCast<const alphaContactAngleFvPatchScalarField>(gbf[patchi]);
263 mesh_.Sf().boundaryField()[patchi]
264 /mesh_.magSf().boundaryField()[patchi]
273 <<
"Cannot find interface " << interfacePair(
phase1,
phase2)
274 <<
"\n in table of theta properties for patch "
275 << acap.patch().name()
279 bool matched = (tp.key().first() ==
phase1.
name());
281 const scalar theta0 =
degToRad(tp().theta0(matched));
284 scalar uTheta = tp().uTheta();
289 const scalar thetaA =
degToRad(tp().thetaA(matched));
290 const scalar thetaR =
degToRad(tp().thetaR(matched));
298 Uwall -= (AfHatPatch & Uwall)*AfHatPatch;
303 nHatPatch - (AfHatPatch & nHatPatch)*AfHatPatch
307 nWall /= (
mag(nWall) + SMALL);
313 theta += (thetaA - thetaR)*
tanh(uwall/uTheta);
327 b2[facei] =
cos(
acos(a12[facei]) - theta[facei]);
335 nHatPatch = a*AfHatPatch +
b*nHatPatch;
337 nHatPatch /= (
mag(nHatPatch) + deltaN_.value());
349 tmp<surfaceVectorField> tnHatfv = nHatfv(
phase1,
phase2);
354 return -
fvc::div(tnHatfv & mesh_.Sf());
370 "transportProperties",
388 mesh_.time().timeName(),
397 sigmas_(
lookup(
"sigmas")),
398 dimSigma_(1, 0, -2, 0, 0),
399 cAlphas_(
lookup(
"interfaceCompression")),
400 Cvms_(
lookup(
"virtualMass")),
420 *phases_.lookup(iter.key().first()),
421 *phases_.lookup(iter.key().second())
437 if (sigmas_.found(
key) && !cAlphas_.found(
key))
440 <<
"Compression coefficient not specified for phase pair ("
442 <<
") for which a surface tension coefficient is specified"
454 auto iter = phases_.cbegin();
459 for (++iter; iter != phases_.cend(); ++iter)
461 rho += iter()*iter().rho();
471 auto iter = phases_.cbegin();
476 for (++iter; iter != phases_.cend(); ++iter)
478 rho += iter().boundaryField()[patchi]*iter().rho().value();
487 auto iter = phases_.cbegin();
492 for (++iter; iter != phases_.cend(); ++iter)
494 mu += iter()*(iter().rho()*iter().nu());
504 auto iter = phases_.cbegin();
507 iter().boundaryField()[patchi]
508 *(iter().rho().value()*iter().nu().value());
511 for (++iter; iter != phases_.cend(); ++iter)
514 iter().boundaryField()[patchi]
515 *(iter().rho().value()*iter().nu().value());
518 return tmu/
rho(patchi);
534 mesh_.time().timeName(),
582 mesh_.time().timeName(),
619 volVectorField::Boundary& SvmBf =
620 tSvm.
ref().boundaryFieldRef();
627 isA<fixedValueFvsPatchScalarField>
633 SvmBf[patchi] =
Zero;
676 isA<fixedValueFvsPatchScalarField>
686 dragCoeffsPtr().
set(iter.key(), Kptr);
689 return dragCoeffsPtr;
706 mesh_.time().timeName(),
724 dmIter.
good() && dcIter.good();
730 &
phase == &dmIter()->phase1()
731 || &
phase == &dmIter()->phase2()
734 tdragCoeff.ref() += *dcIter();
754 mesh_.time().timeName(),
766 tSurfaceTension.
ref().setOriented();
779 tSurfaceTension.ref() +=
789 return tSurfaceTension;
803 mesh_.time().timeName(),
877 !(++alphaSubCycle).
end();
930 lookup(
"sigmas") >> sigmas_;
931 lookup(
"interfaceCompression") >> cAlphas_;
932 lookup(
"virtualMass") >> Cvms_;
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
tmp< volScalarField > nearInterface() const
Indicator of the proximity of the interface.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
bool read(const dictionary &phaseDict)
Read base transportProperties dictionary.
tmp< surfaceScalarField > flux(const volVectorField &vvf)
Return the face-flux field obtained from the given volVectorField.
void explicitSolve(const RdeltaTType &rDeltaT, const RhoType &rho, volScalarField &psi, const surfaceScalarField &phiPsi, const SpType &Sp, const SuType &Su)
const phaseModel & phase1() const
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
void solve()
Solve for the mixture phase-fractions.
bool good() const noexcept
True if pointer/reference is non-null.
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)
dimensionedScalar deltaT() const
Return time step.
tmp< volScalarField > rho() const
Return the mixture density.
const dimensionedScalar mu
Atomic mass unit.
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
A class for managing temporary objects.
static constexpr const zero Zero
Global zero (0)
const dimensionSet dimDensity
const surfaceScalarField & alphaPhi() const
const volScalarField & alpha2
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Calculate the snGrad of the given volField.
static word timeName(const scalar t, const int precision=precision_)
Name pair for the interface.
virtual bool read()
Read object.
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
Calculate the divergence of the given field.
const word & name() const
Return const reference to name.
Unit conversion functions.
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Ostream & endl(Ostream &os)
Add newline and flush stream.
const phaseModel & phase(const label i) const
Constant access phase model i.
dimensionedScalar pos0(const dimensionedScalar &ds)
const volScalarField & alpha1
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
tmp< surfaceScalarField > surfaceTension(const phaseModel &phase) const
A class for managing sub-cycling times.
const phaseModel & phase2() const
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
#define forAll(list, i)
Loop across all elements in list.
Field< vector > vectorField
Specialisation of Field<T> for vector.
surfaceScalarField phic(mixture.cAlpha() *mag(alphaPhic/mesh.magSf()))
CGAL::Exact_predicates_exact_constructions_kernel K
void correct()
Correct the phase properties.
tmp< volScalarField > trho
label timeIndex() const noexcept
Return current time index.
void set(T *p) noexcept
Deprecated(2018-02) Identical to reset().
surfaceScalarField phir(fvc::flux(UdmModel.Udm()))
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
dimensionedScalar tanh(const dimensionedScalar &ds)
surfaceScalarField alphaPhi(phi.name()+alpha1.name(), fvc::flux(phi, alpha1, alphaScheme))
messageStream Info
Information stream (stdout output on master, null elsewhere)
const volVectorField & DDtU() const
void limitSum(UPtrList< scalarField > &phiPsiCorrs)
autoPtr< dragCoeffFields > dragCoeffs() const
Return the drag coefficients for all of the interfaces.
autoPtr< multiphaseSystem::dragCoeffFields > dragCoeffs(fluid.dragCoeffs())
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....
GeometricField< scalar, fvPatchField, volMesh > volScalarField
T * ptr() noexcept
Same as release().
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Lookup type of boundary radiation properties.
Return a pointer to a new phase created on freestore.
static autoPtr< dragModel > New(const dictionary &dict, const phaseModel &phase1, const phaseModel &phase2)
bool read()
Read base transportProperties dictionary.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
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.
const surfaceScalarField & phi() const
constexpr scalar degToRad(const scalar deg) noexcept
Conversion from degrees to radians.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A HashTable similar to std::unordered_map.
typename parent_type::const_iterator const_iterator
const word & name() const
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const volVectorField & U() const
void correctInflowOutflow(surfaceScalarField &alphaPhi) const
Ensure that the flux at inflow/outflow BCs is preserved.
forAllConstIters(mixture.phases(), phase)
const dimensionedScalar & residualPhaseFraction() const
A HashTable of pointers to objects of type <T>, with deallocation management of the pointers.
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Internal & ref(const bool updateAccessTime=true)
Return a reference to the dimensioned internal field.
virtual tmp< volScalarField > K(const volScalarField &Ur) const =0
The drag function K used in the momentum eq.
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
dimensionedScalar acos(const dimensionedScalar &ds)
Calculate the gradient of the given field.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Calculate the face-flux of the given field.
const dimensionedScalar & residualSlip() const
const dimensionedScalar e
Elementary charge.
tmp< volScalarField > dragCoeff(const phaseModel &phase, const dragCoeffFields &dragCoeffs) const
Return the sum of the drag coefficients for the given phase.
const dimensionedScalar & rho() const
tmp< volVectorField > Svm(const phaseModel &phase) const
Return the virtual-mass source for the given phase.
dimensionedScalar det(const dimensionedSphericalTensor &dt)
dimensionedScalar sigma("sigma", dimMass/sqr(dimTime), transportProperties)
tmp< volScalarField > nu() const
Return the mixture laminar viscosity.
tmp< volScalarField > Cvm(const phaseModel &phase) const
Return the virtual-mass coefficient for the given phase.
GeometricField< vector, fvsPatchField, surfaceMesh > surfaceVectorField
dimensionedScalar cbrt(const dimensionedScalar &ds)
Area-weighted average a surfaceField creating a volField.
MULES: Multidimensional universal limiter for explicit solution.
#define WarningInFunction
Report a warning using Foam::Warning.
const Time & time() const noexcept
Return time registry.
multiphaseSystem(const volVectorField &U, const surfaceScalarField &phi)
Construct from components.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
const dimensionSet dimless
Dimensionless.
const dimensionedScalar & rho() const
Return const-access to phase1 density.
dimensionedScalar cos(const dimensionedScalar &ds)