29 #include "surfaceTensionModel.H" 34 #include "surfaceInterpolate.H" 71 phaseModelTable phaseModels;
73 for (
const word& phaseName : phaseNames)
92 const phaseModelTable& phaseModels
95 auto iter = phaseModels.cbegin();
103 for (++iter; iter != phaseModels.cend(); ++iter)
116 const phasePairKey&
key = iter.key();
119 if (phasePairs_.found(
key))
123 else if (
key.ordered())
133 phaseModels_[
key.first()],
134 phaseModels_[
key.second()]
149 phaseModels_[
key.first()],
150 phaseModels_[
key.second()]
165 if (phaseIter1()->
name() != phaseIter2()->
name())
169 phaseIter1()->
name(),
170 phaseIter2()->
name(),
174 phasePairKey keyInverse
176 phaseIter2()->
name(),
177 phaseIter1()->
name(),
183 !totalPhasePairs_.found(
key)
184 && !totalPhasePairs_.found(keyInverse)
194 phaseModels_[
key.first()],
195 phaseModels_[
key.second()]
213 basicThermo(
mesh, word::null, phasePropertiesName),
234 IOobject::READ_IF_PRESENT,
251 phaseModels_(generatePhaseModels(phaseNames_)),
266 if (
found(
"surfaceTension"))
274 if (
found(
"interfacePorous"))
337 auto iter = phaseModels_.cbegin();
341 iter()() * iter()->hc()
344 for (++iter; iter != phaseModels_.cend(); ++iter)
346 tAlphaHc.ref() += iter()() * iter()->hc();
381 auto iter = phaseModels_.cbegin();
385 iter()() * iter()->
rho()
388 for (++iter; iter != phaseModels_.cend(); ++iter)
390 tmpRho.ref() += iter()() * iter()->rho();
402 auto iter = phaseModels_.cbegin();
404 tmp<scalarField> tmpRho
406 iter()().boundaryField()[patchI]
407 * iter()->
rho()().boundaryField()[patchI]
410 for (++iter; iter != phaseModels_.cend(); ++iter)
414 iter()().boundaryField()[patchI]
415 * iter()->rho()().boundaryField()[patchI]
425 auto iter = phaseModels_.cbegin();
427 tmp<volScalarField> tmpCp
429 iter()() * iter()->
Cp()
432 for (++iter; iter != phaseModels_.cend(); ++iter)
434 tmpCp.ref() += iter()() * iter()->Cp();
448 auto iter = phaseModels_.cbegin();
450 tmp<scalarField> tmpCp
452 iter()() * iter()->
Cp(
p,
T, patchI)
455 for (++iter; iter != phaseModels_.cend(); ++iter)
457 tmpCp.ref() += iter()() * iter()->Cp(
p,
T, patchI);
466 auto iter = phaseModels_.cbegin();
468 tmp<volScalarField> tmpCv
470 iter()() * iter()->
Cv()
473 for (++iter; iter != phaseModels_.cend(); ++iter)
475 tmpCv.ref() += iter()() * iter()->Cv();
489 auto iter = phaseModels_.cbegin();
491 tmp<scalarField> tmpCv
493 iter()() * iter()->
Cv(
p,
T, patchI)
496 for (++iter; iter != phaseModels_.cend(); ++iter)
498 tmpCv.ref() += iter()() * iter()->Cv(
p,
T, patchI);
519 auto iter = phaseModels_.cbegin();
523 iter()() * iter()->
Cp()
528 iter()() * iter()->
Cv()
531 for (++iter; iter != phaseModels_.cend(); ++iter)
533 tmpCp.ref() += iter()() * iter()->Cp();
534 tmpCv.ref() += iter()() * iter()->Cv();
537 return (tmpCp/tmpCv);
550 gamma()().boundaryField()[patchI]
557 auto iter = phaseModels_.cbegin();
561 iter()() * iter()->Cpv()
564 for (++iter; iter != phaseModels_.cend(); ++iter)
566 tmpCpv.
ref() += iter()() * iter()->Cpv();
580 auto iter = phaseModels_.cbegin();
582 tmp<scalarField> tmpCpv
584 iter()() * iter()->Cpv(
p,
T, patchI)
587 for (++iter; iter != phaseModels_.cend(); ++iter)
589 tmpCpv.ref() += iter()() * iter()->Cpv(
p,
T, patchI);
598 auto iter = phaseModels_.cbegin();
600 tmp<volScalarField> tmpCpByCpv
602 iter()() * iter()->CpByCpv()
605 for (++iter; iter != phaseModels_.cend(); ++iter)
607 tmpCpByCpv.ref() += iter()() * iter()->CpByCpv();
621 auto iter = phaseModels_.cbegin();
623 tmp<scalarField> tmpCpv
625 iter()().boundaryField()[patchI]
626 * iter()->CpByCpv(
p,
T, patchI)
629 for (++iter; iter != phaseModels_.cend(); ++iter)
633 iter()().boundaryField()[patchI]
634 * iter()->CpByCpv(
p,
T, patchI)
651 auto iter = phaseModels_.cbegin();
655 iter()() * iter()->
kappa()
658 for (++iter; iter != phaseModels_.cend(); ++iter)
660 tmpkappa.ref() += iter()() * iter()->kappa();
672 auto iter = phaseModels_.cbegin();
674 tmp<scalarField> tmpKappa
676 iter()().boundaryField()[patchI]
677 * iter()->
kappa(patchI)
680 for (++iter; iter != phaseModels_.cend(); ++iter)
684 iter()().boundaryField()[patchI]
685 * iter()->kappa(patchI)
695 phaseModelTable::const_iterator phaseModelIter = phaseModels_.begin();
697 tmp<volScalarField> talphaEff
699 phaseModelIter()()*phaseModelIter()->alphahe()
702 for (; phaseModelIter != phaseModels_.end(); ++phaseModelIter)
704 talphaEff.ref() += phaseModelIter()()*phaseModelIter()->alphahe();
716 phaseModelTable::const_iterator phaseModelIter = phaseModels_.begin();
718 tmp<scalarField> talphaEff
720 phaseModelIter()().boundaryField()[patchi]
721 *phaseModelIter()->alphahe(patchi)
724 for (; phaseModelIter != phaseModels_.end(); ++phaseModelIter)
727 phaseModelIter()().boundaryField()[patchi]
728 *phaseModelIter()->alphahe(patchi);
752 return kappa(patchI) + kappat;
761 auto iter = phaseModels_.cbegin();
765 iter()() * iter()->
alpha()
768 for (++iter; iter != phaseModels_.cend(); ++iter)
770 tmpAlpha.ref() += iter()() * iter()->alpha();
773 tmpAlpha.ref() += alphat;
785 auto iter = phaseModels_.cbegin();
789 iter()().boundaryField()[patchI]
790 * iter()->
alpha(patchI)
793 for (++iter; iter != phaseModels_.cend(); ++iter)
797 iter()().boundaryField()[patchI]
798 * iter()->alpha(patchI)
802 tmpAlpha.
ref() += alphat;
816 auto iter = phaseModels_.cbegin();
820 iter()() * iter()->
mu()
823 for (++iter; iter != phaseModels_.cend(); ++iter)
825 tmpMu.ref() += iter()() * iter()->mu();
837 auto iter = phaseModels_.cbegin();
839 tmp<scalarField> tmpMu
841 iter()().boundaryField()[patchI]
845 for (++iter; iter != phaseModels_.cend(); ++iter)
849 iter()().boundaryField()[patchI]
860 auto iter = phaseModels_.cbegin();
862 tmp<volScalarField> tmpNu
864 iter()() * iter()->
nu()
867 for (++iter; iter != phaseModels_.cend(); ++iter)
869 tmpNu.ref() += iter()() * iter()->nu();
881 auto iter = phaseModels_.cbegin();
883 tmp<scalarField> tmpNu
885 iter()().boundaryField()[patchI]
889 for (++iter; iter != phaseModels_.cend(); ++iter)
893 iter()().boundaryField()[patchI]
910 return turb_->muEff();
922 return turb_->nuEff();
930 this->
kappa() + this->
Cp()*turb_->mut()/Prt_
943 this->
kappa(patchi) +
Cp*turb_->mut(patchi)/Prt_.value()
952 return this->
alpha() + turb_->mut()/Prt_;
959 return (this->
alpha(patchi) + turb_->mut(patchi))/Prt_.value();
1002 iter()->correctTurbulence();
1010 return phaseModels_;
1017 return phaseModels_;
1024 return totalPhasePairs_;
1031 return totalPhasePairs_;
1039 if (!iter()->
thermo().incompressible())
1051 return phaseModels_[phaseName]->thermo().incompressible();
1059 if (!iter()->
thermo().isochoric())
1082 "surfaceTensionForce",
1083 mesh_.time().timeName(),
1090 auto& stf = tstf.ref();
1093 if (surfaceTensionModels_.size())
1101 for (++iter2; iter2 != phaseModels_.cend(); ++iter2)
1110 phasePairKey(iter1()->
name(), iter2()->
name())
1133 mesh_.time().timeName(),
1140 auto& stf = tstf.ref();
1144 stf += iter()() * iter()->U();
1154 return surfaceTensionModels_[
key]->sigma();
1163 return 1.0/(phaseModels_[
key]->thermo().rho());
1178 for (++iterk; iterk != phaseModels_.cend(); ++iterk)
1180 if (iteri()().
name() != iterk()().
name())
1192 if (interfacePorousModelTable_.found(keyik))
1195 interfacePorousModelTable_[keyik];
1197 Udiag += Vc*interfacePtr->
S();
1211 tmp<surfaceVectorField> tnHatfv = nHatfv(
alpha1,
alpha2);
1214 return -
fvc::div(tnHatfv.ref() & mesh_.Sf());
1240 mesh_.time().timeName(),
1247 auto& nearInt = tnearInt.ref();
1255 for (++iter2; iter2 != phaseModels_.cend(); ++iter2)
1300 return gradAlphaf/(
mag(gradAlphaf) + deltaN);
1334 return gradAlphaf/(
mag(gradAlphaf) + deltaN);
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
virtual tmp< volScalarField > coeffs(const word &key) const
Return coefficients (1/rho)
void generatePairsAndSubModels(const word &modelName, HashTable< autoPtr< modelType >, phasePairKey, phasePairKey::hash > &models)
Generate pairs and sub-model tables.
const fvMesh & mesh() const
Return mesh.
virtual tmp< volScalarField > Cv() const
Return Cv of the mixture.
void generatePairs(const dictTable &modelDicts)
Generate pairs.
const phaseModelTable & phases() const
Constant access the phases.
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &f1)
virtual bool incompressible() const
Return true if the equation of state is incompressible for all.
const surfaceScalarField & phi() const
Constant access to the total flux.
virtual tmp< volScalarField > hc() const
Chemical enthalpy of the mixture [J/kg].
static const word phasePropertiesName
Default name of the phase properties dictionary.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
virtual bool read()
Read object.
multiphaseInterSystem(const fvMesh &mesh)
Construct from fvMesh.
virtual bool read()
Read base phaseProperties dictionary.
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
static autoPtr< phaseModel > New(const multiphaseInterSystem &fluid, const word &phaseName)
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
virtual tmp< volScalarField > mu() const
Dynamic viscosity of mixture [kg/m/s].
virtual volScalarField & he()
Return access to the internal energy field [J/Kg].
GeometricField< vector, fvsPatchField, surfaceMesh > surfaceVectorField
virtual tmp< scalarField > rhoEoS(const scalarField &p, const scalarField &T, const labelList &cells) const
Density from pressure and temperature.
const dimensionSet dimViscosity
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
virtual tmp< volScalarField > alphahe() const
Thermal diffusivity for energy of mixture [kg/m/s].
tmp< volScalarField > alphaEff() const
Effective thermal turbulent diffusivity of mixture [kg/m/s].
Calculate the snGrad of the given volField.
const word & name() const
The name of this phase.
surfaceTensionModelTable surfaceTensionModels_
Surface tension models.
const volScalarField & alpha2
const volScalarField & Cv
const dimensionSet dimless
Dimensionless.
virtual tmp< volScalarField > gamma() const
Gamma = Cp/Cv [].
GeometricField< vector, fvPatchField, volMesh > volVectorField
CGAL::Exact_predicates_exact_constructions_kernel K
const dimensionedScalar kappa
Coulomb constant: default SI units: [N.m2/C2].
tmp< volScalarField > kappaEff() const
Effective thermal turbulent diffusivity for temperature.
virtual void correct()
Correct the mixture thermos.
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
tmp< volScalarField > K(const volScalarField &alpha1, const volScalarField &alpha2) const
Interface curvature.
virtual tmp< volScalarField > S() const =0
Momentum source.
virtual ~multiphaseInterSystem()
Destructor.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
psiReactionThermo & thermo
dimensionedScalar pos(const dimensionedScalar &ds)
const dimensionSet dimVolume(pow3(dimLength))
const fvMesh & mesh_
Reference to the mesh.
virtual void correctTurbulence()
Correct the turbulence.
const dimensionedScalar & Prt() const
Return Prandt number.
const dimensionedScalar e
Elementary charge.
surfaceScalarField phi_
Mixture total volumetric flux.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Calculate the gradient of the given field.
A class for handling words, derived from Foam::string.
virtual tmp< volScalarField > surfaceTensionCoeff(const phasePairKey &key) const
Return the surface tension coefficient.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensionedScalar cbrt(const dimensionedScalar &ds)
void setOriented(bool on=true) noexcept
Set the oriented flag: on/off.
#define forAllIters(container, iter)
Iterate across all elements in the container object.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
const phasePairTable & totalPhasePairs() const
Constant access the total phase pairs.
surfaceScalarField rhoPhi_
Mixture total mass flux.
Calculate the divergence of the given field.
An ordered or unorder pair of phase names. Typically specified as follows.
void calcMu()
Calculate and return the laminar viscosity.
tmp< surfaceScalarField > generatePhi(const HashTable< autoPtr< multiphaseInter::phaseModel >> &phaseModels) const
Generate the mixture flux.
const volScalarField & Cp
virtual tmp< volScalarField > kappa() const
Thermal diffusivity for temperature of mixture [J/m/s/K].
defineTypeNameAndDebug(combustionModel, 0)
virtual tmp< volScalarField > W() const
Molecular weight [kg/kmol] of the mixture.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
tmp< volScalarField > nearInterface() const
Near Interface of alpha'n.
interfacePorousModelTable interfacePorousModelTable_
Interface porous models.
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 dimensionSet dimDensity
HashTable< autoPtr< multiphaseInter::phaseModel > > generatePhaseModels(const wordList &names) const
Generate the phases.
Represents 0/1 range or concept. Used for tagged dispatch or clamping.
void generatePairsTable()
Generate pair table.
const dimensionedScalar mu
Atomic mass unit.
List< word > wordList
List of word.
tmp< surfaceVectorField > nHatfv(const volScalarField &alpha1, const volScalarField &alpha2) const
Interface normal surface vector.
virtual tmp< volScalarField > nu() const
Kinematic viscosity of mixture [m^2/s].
tmp< volScalarField > mut() const
Return the turbulent dynamic viscosity.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
tmp< volVectorField > nVolHatfv(const volScalarField &alpha1, const volScalarField &alpha2) const
Interface normal volField vector.
Mesh data needed to do the Finite Volume discretisation.
tmp< volScalarField > nuEff() const
Return the effective kinematic viscosity.
tmp< volScalarField > nut() const
Return the turbulent kinematic viscosity.
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
tmp< surfaceScalarField > nHatf(const volScalarField &alpha1, const volScalarField &alpha2) const
Interface normal surface vector.
virtual tmp< volScalarField > Cp() const
Return Cp of the mixture.
tmp< surfaceScalarField > surfaceTensionForce() const
Calculate surface tension of the mixture.
virtual tmp< volScalarField > Cpv() const
Heat capacity at constant pressure/volume [J/kg/K].
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
volScalarField mu_
Dynamic viscocity.
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
List< label > labelList
A List of labels.
A class for managing temporary objects.
const surfaceScalarField & rhoPhi() const
Constant access to the mixture mass flux.
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Defines the attributes of an object for which implicit objectRegistry management is supported...
tmp< volVectorField > U() const
Mixture U.
virtual tmp< scalarField > THE(const scalarField &h, const scalarField &p, const scalarField &T0, const labelList &cells) const
Temperature from enthalpy/internal energy for cell-set.
virtual tmp< volScalarField > CpByCpv() const
Heat capacity ratio [].
void addInterfacePorosity(fvVectorMatrix &UEqn)
Add interface porosity on phasePair.
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
virtual tmp< volScalarField > rho() const
Return the mixture density.
forAllConstIters(mixture.phases(), phase)
dimensionSet clamp(const dimensionSet &a, const dimensionSet &range)
tmp< volScalarField > muEff() const
Return the effective dynamic viscosity.
virtual bool isochoric() const
Return true if the equation of state is isochoric for all phasses.
static constexpr const zero Zero
Global zero (0)
const dimensionSet dimVelocity
const volScalarField & alpha1