Go to the documentation of this file.
29 #include "alphaContactAngleFvPatchScalarField.H"
33 #include "surfaceInterpolate.H"
42 void Foam::multiphaseMixture::calcAlphas()
47 for (
const phase& ph : phases_)
49 alphas_ += level * ph;
67 "transportProperties",
70 IOobject::MUST_READ_IF_MODIFIED,
75 phases_(
lookup(
"phases"), phase::iNew(
U,
phi)),
120 sigmas_(
lookup(
"sigmas")),
121 dimSigma_(1, 0, -2, 0, 0),
128 rhoPhi_.setOriented();
140 auto iter = phases_.cbegin();
142 tmp<volScalarField>
trho = iter()*iter().rho();
145 for (++iter; iter != phases_.cend(); ++iter)
147 rho += iter()*iter().rho();
157 auto iter = phases_.cbegin();
159 tmp<scalarField>
trho = iter().boundaryField()[patchi]*iter().rho().value();
162 for (++iter; iter != phases_.cend(); ++iter)
164 rho += iter().boundaryField()[patchi]*iter().rho().value();
174 auto iter = phases_.cbegin();
176 tmp<volScalarField> tmu = iter()*iter().rho()*iter().nu();
179 for (++iter; iter != phases_.cend(); ++iter)
181 mu += iter()*iter().rho()*iter().nu();
191 auto iter = phases_.cbegin();
193 tmp<scalarField> tmu =
195 iter().boundaryField()[patchi]
196 *iter().rho().value()
202 for (++iter; iter != phases_.cend(); ++iter)
206 iter().boundaryField()[patchi]
207 *iter().rho().value()
219 auto iter = phases_.cbegin();
221 tmp<surfaceScalarField> tmuf =
225 for (++iter; iter != phases_.cend(); ++iter)
245 return nu_.boundaryField()[patchi];
259 tmp<surfaceScalarField> tstf
265 "surfaceTensionForce",
266 mesh_.time().timeName(),
279 const phase&
alpha1 = iter1();
283 for (++iter2; iter2 != phases_.cend(); ++iter2)
285 const phase&
alpha2 = iter2();
292 <<
"Cannot find interface " << interfacePair(
alpha1,
alpha2)
293 <<
" in list of sigma values"
341 !(++alphaSubCycle).
end();
362 for (phase& ph : phases_)
391 return gradAlphaf/(
mag(gradAlphaf) + deltaN_);
412 void Foam::multiphaseMixture::correctContactAngle
416 surfaceVectorField::Boundary& nHatb
419 const volScalarField::Boundary& gbf
422 const fvBoundaryMesh&
boundary = mesh_.boundary();
426 if (isA<alphaContactAngleFvPatchScalarField>(gbf[patchi]))
428 const alphaContactAngleFvPatchScalarField& acap =
429 refCast<const alphaContactAngleFvPatchScalarField>(gbf[patchi]);
435 mesh_.Sf().boundaryField()[patchi]
436 /mesh_.magSf().boundaryField()[patchi]
445 <<
"Cannot find interface " << interfacePair(
alpha1,
alpha2)
446 <<
"\n in table of theta properties for patch "
447 << acap.patch().name()
451 const bool matched = (tp.key().first() ==
alpha1.name());
453 const scalar theta0 =
degToRad(tp().theta0(matched));
456 const scalar uTheta = tp().uTheta();
461 const scalar thetaA =
degToRad(tp().thetaA(matched));
462 const scalar thetaR =
degToRad(tp().thetaR(matched));
467 U_.boundaryField()[patchi].patchInternalField()
468 - U_.boundaryField()[patchi]
470 Uwall -= (AfHatPatch & Uwall)*AfHatPatch;
475 nHatPatch - (AfHatPatch & nHatPatch)*AfHatPatch
479 nWall /= (
mag(nWall) + SMALL);
485 theta += (thetaA - thetaR)*
tanh(uwall/uTheta);
499 b2[facei] =
cos(
acos(a12[facei]) - theta[facei]);
507 nHatPatch = a*AfHatPatch +
b*nHatPatch;
509 nHatPatch /= (
mag(nHatPatch) + deltaN_.value());
521 tmp<surfaceVectorField> tnHatfv = nHatfv(
alpha1,
alpha2);
526 return -
fvc::div(tnHatfv & mesh_.Sf());
533 tmp<volScalarField> tnearInt
540 mesh_.time().timeName(),
548 for (
const phase& ph : phases_)
550 tnearInt.ref() =
max(tnearInt(),
pos0(ph - 0.01)*
pos0(0.99 - ph));
557 void Foam::multiphaseMixture::solveAlphas
562 static label nSolves(-1);
565 const word alphaScheme(
"div(phi,alpha)");
571 PtrList<surfaceScalarField> alphaPhiCorrs(phases_.size());
574 for (phase&
alpha : phases_)
593 for (phase&
alpha2 : phases_)
609 1.0/mesh_.time().deltaT().value(),
633 mesh_.time().timeName(),
642 for (phase&
alpha : phases_)
657 <<
alpha.weightedAverage(mesh_.V()).value()
667 Info<<
"Phase-sum volume fraction, min, max = "
668 << sumAlpha.weightedAverage(mesh_.V()).value()
669 <<
' ' <<
min(sumAlpha).value()
670 <<
' ' <<
max(sumAlpha).value()
675 for (phase&
alpha : phases_)
690 PtrList<entry> phaseData(
lookup(
"phases"));
693 for (phase& ph : phases_)
695 readOK &= ph.read(phaseData[
phasei++].
dict());
698 readEntry(
"sigmas", sigmas_);
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< surfaceScalarField > flux(const volVectorField &vvf)
Return the face-flux field obtained from the given volVectorField.
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Dimensionless.
void explicitSolve(const RdeltaTType &rDeltaT, const RhoType &rho, volScalarField &psi, const surfaceScalarField &phiPsi, const SpType &Sp, const SuType &Su)
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
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.
const dimensionedScalar mu
Atomic mass unit.
A class for managing temporary objects.
static constexpr const zero Zero
Global zero (0)
const volScalarField & alpha2
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
multiphaseMixture(const volVectorField &U, const surfaceScalarField &phi)
Construct from components.
void correct()
Correct the mixture properties.
const Time & time() const
Return time.
Calculate the snGrad of the given volField.
static word timeName(const scalar t, const int precision=precision_)
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)
tmp< volScalarField > nu() const
Return the kinematic laminar viscosity.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensionedScalar pos0(const dimensionedScalar &ds)
const volScalarField & alpha1
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
word alpharScheme("div(phirb,alpha)")
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
virtual bool read()=0
Read transportProperties dictionary.
tmp< volScalarField > trho
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
surfaceScalarField phir(fvc::flux(UdmModel.Udm()))
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
tmp< surfaceScalarField > nuf() const
Return the face-interpolated dynamic laminar viscosity.
dimensionedScalar tanh(const dimensionedScalar &ds)
surfaceScalarField alphaPhi(phi.name()+alpha1.name(), fvc::flux(phi, alpha1, alphaScheme))
messageStream Info
Information stream (uses stdout - output is on the master only)
const cellModel * lookup(const word &modelName)
Deprecated(2017-11) equivalent to cellModel::ptr static method.
void limitSum(UPtrList< scalarField > &phiPsiCorrs)
tmp< surfaceScalarField > surfaceTensionForce() const
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
bool read()
Read base transportProperties dictionary.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
void solve()
Solve for the mixture phase-fractions.
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
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< volScalarField > rho() const
Return the mixture density.
constexpr scalar degToRad(const scalar deg) noexcept
Conversion from degrees to radians.
errorManipArg< error, int > exit(error &err, const int errNo=1)
GeometricField< vector, fvPatchField, volMesh > volVectorField
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
tmp< volScalarField > mu() const
Return the dynamic laminar viscosity.
forAllConstIters(mixture.phases(), phase)
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Internal & ref(const bool updateAccessTime=true)
Return a reference to the dimensioned internal 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 e
Elementary charge.
tmp< volScalarField > nearInterface() const
Indicator of the proximity of the interface.
void setOriented(const bool oriented=true)
Set the oriented flag.
dimensionedScalar det(const dimensionedSphericalTensor &dt)
dimensionedScalar sigma("sigma", dimMass/sqr(dimTime), transportProperties)
GeometricField< vector, fvsPatchField, surfaceMesh > surfaceVectorField
dimensionedScalar cbrt(const dimensionedScalar &ds)
MULES: Multidimensional universal limiter for explicit solution.
constant condensation/saturation model.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
dimensionedScalar cos(const dimensionedScalar &ds)
tmp< surfaceScalarField > muf() const
Return the face-interpolated dynamic laminar viscosity.