27 #include "alphaContactAngleFvPatchScalarField.H" 37 #include "surfaceInterpolate.H" 49 void Foam::compressibleMultiphaseMixture::calcAlphas()
54 forAllIter(PtrDictionary<phaseModel>, phases_, phase)
56 alphas_ += level*phase();
77 IOobject::MUST_READ_IF_MODIFIED,
110 phases_(
lookup(
"phases"), phaseModel::iNew(p_, T_)),
158 sigmas_(
lookup(
"sigmas")),
159 dimSigma_(1, 0, -2, 0, 0),
176 forAllIter(PtrDictionary<phaseModel>, phases_, phasei)
189 for (++phasei; phasei != phases_.end(); ++
phasei)
194 forAllIter(PtrDictionary<phaseModel>, phases_, phasei)
203 forAllIter(PtrDictionary<phaseModel>, phases_, phasei)
216 for (++phasei; phasei != phases_.end(); ++
phasei)
237 for (++phasei; phasei != phases_.end(); ++
phasei)
241 *
phasei().thermo().mu(patchi);
244 return mu/rho_.boundaryField()[
patchi];
257 for (++phasei; phasei != phases_.end(); ++
phasei)
259 talphaEff.ref() +=
phasei()*
phasei().thermo().alphaEff(alphat);
272 for (++phasei; phasei != phases_.end(); ++
phasei)
284 tmp<surfaceScalarField> tstf
288 "surfaceTensionForce",
298 const phaseModel& alpha1 = phase1();
303 for (; phase2 != phases_.end(); ++phase2)
305 const phaseModel& alpha2 = phase2();
307 sigmaTable::const_iterator sigma =
308 sigmas_.find(interfacePair(alpha1, alpha2));
310 if (sigma == sigmas_.end())
313 <<
"Cannot find interface " << interfacePair(alpha1, alpha2)
314 <<
" in list of sigma values" 333 const Time& runTime = mesh_.time();
335 const dictionary& alphaControls = mesh_.solution().solverDict(
"alpha");
337 scalar cAlpha(alphaControls.lookup<scalar>(
"cAlpha"));
349 !(++alphaSubCycle).end();
353 rhoPhiSum += (runTime.deltaT()/totalDeltaT)*rhoPhi_;
389 return gradAlphaf/(
mag(gradAlphaf) + deltaN_);
400 return nHatfv(alpha1, alpha2) & mesh_.Sf();
406 const phaseModel& alpha1,
407 const phaseModel& alpha2
410 tmp<surfaceVectorField> tnHatfv = nHatfv(alpha1, alpha2);
418 tnHatfv.ref().boundaryFieldRef()
422 return -
fvc::div(tnHatfv & mesh_.Sf());
429 tmp<volScalarField> tnearInt
442 max(tnearInt(),
pos0(phase() - 0.01)*
pos0(0.99 - phase()));
449 void Foam::compressibleMultiphaseMixture::solveAlphas
454 static label nSolves=-1;
463 UPtrList<const volScalarField> alphas(phases_.size());
464 PtrList<surfaceScalarField> alphaPhis(phases_.size());
467 forAllIter(PtrDictionary<phaseModel>, phases_, phase)
469 const phaseModel& alpha = phase();
471 alphas.set(phasei, &alpha);
478 phi_.name() + alpha.name(),
490 forAllIter(PtrDictionary<phaseModel>, phases_, phase2)
492 phaseModel& alpha2 = phase2();
494 if (&alpha2 == &alpha)
continue;
509 1.0/mesh_.time().deltaT().value(),
533 mesh_.time().timeName(),
544 forAllIter(PtrDictionary<phaseModel>, phases_, phase)
546 phaseModel& alpha = phase();
555 mesh_.time().timeName(),
567 mesh_.time().timeName(),
572 divU.v()*
min(alpha.v(), scalar(1))
580 if (dgdt[celli] < 0.0 && alpha[celli] > 0.0)
582 Sp[celli] += dgdt[celli]*alpha[celli];
583 Su[celli] -= dgdt[celli]*alpha[celli];
585 else if (dgdt[celli] > 0.0 && alpha[celli] < 1.0)
587 Sp[celli] -= dgdt[celli]*(1.0 - alpha[celli]);
594 const phaseModel& alpha2 = phase2();
596 if (&alpha2 == &alpha)
continue;
602 if (dgdt2[celli] > 0.0 && alpha2[celli] < 1.0)
604 Sp[celli] -= dgdt2[celli]*(1.0 - alpha2[celli]);
605 Su[celli] += dgdt2[celli]*alpha[celli];
607 else if (dgdt2[celli] < 0.0 && alpha2[celli] > 0.0)
609 Sp[celli] += dgdt2[celli]*alpha2[celli];
625 Info<< alpha.name() <<
" volume fraction, min, max = " 626 << alpha.weightedAverage(mesh_.V()).value()
627 <<
' ' <<
min(alpha).value()
628 <<
' ' <<
max(alpha).value()
636 Info<<
"Phase-sum volume fraction, min, max = " 637 << sumAlpha.weightedAverage(mesh_.V()).value()
638 <<
' ' <<
min(sumAlpha).value()
639 <<
' ' <<
max(sumAlpha).value()
virtual tmp< volScalarField > nu() const
Kinematic viscosity of mixture [m^2/s].
scalar Cv(const scalar p, const scalar T) const
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)
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
#define forAll(list, i)
Loop across all elements in list.
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
fluidReactionThermo & thermo
errorManipArg< error, int > exit(error &err, const int errNo=1)
compressibleMultiphaseMixture(const volVectorField &U, const surfaceScalarField &phi)
Construct from components.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
void correctContactAngle(const volScalarField &alpha1, const volScalarField &alpha2, const volVectorField::Boundary &Ubf, const dimensionedScalar &deltaN, surfaceVectorField::Boundary &nHatbf)
Correct the contact angle for the two volume fraction fields.
const word alphaScheme(mesh.schemes().div(divAlphaName)[1].wordToken())
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
volScalarField alpha(IOobject("alpha", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
static tmp< GeometricField< scalar, fvsPatchField, surfaceMesh > > New(const word &name, const Internal &, const PtrList< fvsPatchField< scalar >> &)
Return a temporary field constructed from name,.
GeometricField< vector, fvsPatchField, surfaceMesh > surfaceVectorField
Ostream & endl(Ostream &os)
Add newline and flush stream.
surfaceScalarField phir(fvc::flux(mixture.Udm()))
Calculate the snGrad of the given volField.
const dimensionSet dimless
GeometricField< vector, fvPatchField, volMesh > volVectorField
T & first()
Return the first element of the list.
DimensionedField< scalar, volMesh > Internal
Type of the internal field from which this GeometricField is derived.
CGAL::Exact_predicates_exact_constructions_kernel K
GeometricField< scalar, fvPatchField, volMesh > volScalarField
const dimensionedScalar sigma
Stefan-Boltzmann constant: default SI units: [W/m^2/K^4].
tmp< volScalarField > nearInterface() const
Indicator of the proximity of the interface.
const dimensionSet dimTime
stressControl lookup("compactNormalStress") >> compactNormalStress
void limitSum(UPtrList< scalarField > &phiPsiCorrs)
void solve()
Solve for the mixture phase-fractions.
tmp< volScalarField > rCv() const
Return the phase-averaged reciprocal Cv.
Calculate the gradient of the given field.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Calculate the face-flux of the given field.
const dimensionSet dimDensity
void correctRho(const volScalarField &dp)
Update densities for given pressure change.
virtual void correctThermo()
Correct the thermodynamics of each phase.
surfaceScalarField alphaPhi(phi.name()+alpha1.name(), fvc::flux(phi, alpha1, alphaScheme))
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
Calculate the divergence of the given field.
dimensionedScalar pos0(const dimensionedScalar &ds)
const dimensionedScalar mu
Atomic mass unit.
const label nAlphaSubCycles(alphaControls.lookup< label >("nAlphaSubCycles"))
defineTypeNameAndDebug(combustionModel, 0)
tmp< volScalarField > divU
const dimensionSet dimMass
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 tmp< volScalarField::Internal > & Sp
Calculate the mesh motion flux and convert fluxes from absolute to relative and back.
Internal & ref()
Return a reference to the dimensioned internal field.
virtual tmp< volScalarField > alphaEff(const volScalarField &alphat) const
Effective thermal diffusivity of mixture [W/m/K].
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
volScalarField::Internal dgdt(IOobject("dgdt", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), alpha1 *fvc::div(phi))
tmp< surfaceScalarField > absolute(const tmp< surfaceScalarField > &tphi, const volVectorField &U)
Return the given relative flux in absolute form.
virtual void correct()
Update properties.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
virtual void correct()
Correct the fvModel.
word alpharScheme("div(phirb,alpha)")
dimensioned< scalar > mag(const dimensioned< Type > &)
MULES: Multidimensional universal limiter for explicit solution.
const doubleScalar e
Elementary charge.
const tmp< volScalarField::Internal > & Su
A class for managing temporary objects.
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)
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
friend class const_iterator
tmp< surfaceScalarField > surfaceTensionForce() const