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();
104 for (++iter; iter != phaseModels.cend(); ++iter)
117 const phasePairKey&
key = iter.key();
120 if (phasePairs_.found(
key))
124 else if (
key.ordered())
134 phaseModels_[
key.first()],
135 phaseModels_[
key.second()]
150 phaseModels_[
key.first()],
151 phaseModels_[
key.second()]
166 if (phaseIter1()->
name() != phaseIter2()->
name())
170 phaseIter1()->
name(),
171 phaseIter2()->
name(),
175 phasePairKey keyInverse
177 phaseIter2()->
name(),
178 phaseIter1()->
name(),
184 !totalPhasePairs_.found(
key)
185 && !totalPhasePairs_.found(keyInverse)
195 phaseModels_[
key.first()],
196 phaseModels_[
key.second()]
214 basicThermo(
mesh, word::null, phasePropertiesName),
235 IOobject::READ_IF_PRESENT,
252 phaseModels_(generatePhaseModels(phaseNames_)),
267 if (
found(
"surfaceTension"))
275 if (
found(
"interfacePorous"))
338 auto iter = phaseModels_.cbegin();
342 iter()() * iter()->hc()
345 for (++iter; iter != phaseModels_.cend(); ++iter)
347 tAlphaHc.ref() += iter()() * iter()->hc();
382 auto iter = phaseModels_.cbegin();
386 iter()() * iter()->
rho()
389 for (++iter; iter != phaseModels_.cend(); ++iter)
391 tmpRho.ref() += iter()() * iter()->rho();
403 auto iter = phaseModels_.cbegin();
405 tmp<scalarField> tmpRho
407 iter()().boundaryField()[patchI]
408 * iter()->
rho()().boundaryField()[patchI]
411 for (++iter; iter != phaseModels_.cend(); ++iter)
415 iter()().boundaryField()[patchI]
416 * iter()->rho()().boundaryField()[patchI]
426 auto iter = phaseModels_.cbegin();
428 tmp<volScalarField> tmpCp
430 iter()() * iter()->
Cp()
433 for (++iter; iter != phaseModels_.cend(); ++iter)
435 tmpCp.ref() += iter()() * iter()->Cp();
449 auto iter = phaseModels_.cbegin();
451 tmp<scalarField> tmpCp
453 iter()() * iter()->
Cp(
p,
T, patchI)
456 for (++iter; iter != phaseModels_.cend(); ++iter)
458 tmpCp.ref() += iter()() * iter()->Cp(
p,
T, patchI);
467 auto iter = phaseModels_.cbegin();
469 tmp<volScalarField> tmpCv
471 iter()() * iter()->
Cv()
474 for (++iter; iter != phaseModels_.cend(); ++iter)
476 tmpCv.ref() += iter()() * iter()->Cv();
490 auto iter = phaseModels_.cbegin();
492 tmp<scalarField> tmpCv
494 iter()() * iter()->
Cv(
p,
T, patchI)
497 for (++iter; iter != phaseModels_.cend(); ++iter)
499 tmpCv.ref() += iter()() * iter()->Cv(
p,
T, patchI);
520 auto iter = phaseModels_.cbegin();
524 iter()() * iter()->
Cp()
529 iter()() * iter()->
Cv()
532 for (++iter; iter != phaseModels_.cend(); ++iter)
534 tmpCp.ref() += iter()() * iter()->Cp();
535 tmpCv.ref() += iter()() * iter()->Cv();
538 return (tmpCp/tmpCv);
551 gamma()().boundaryField()[patchI]
558 auto iter = phaseModels_.cbegin();
562 iter()() * iter()->Cpv()
565 for (++iter; iter != phaseModels_.cend(); ++iter)
567 tmpCpv.
ref() += iter()() * iter()->Cpv();
581 auto iter = phaseModels_.cbegin();
583 tmp<scalarField> tmpCpv
585 iter()() * iter()->Cpv(
p,
T, patchI)
588 for (++iter; iter != phaseModels_.cend(); ++iter)
590 tmpCpv.ref() += iter()() * iter()->Cpv(
p,
T, patchI);
599 auto iter = phaseModels_.cbegin();
601 tmp<volScalarField> tmpCpByCpv
603 iter()() * iter()->CpByCpv()
606 for (++iter; iter != phaseModels_.cend(); ++iter)
608 tmpCpByCpv.ref() += iter()() * iter()->CpByCpv();
622 auto iter = phaseModels_.cbegin();
624 tmp<scalarField> tmpCpv
626 iter()().boundaryField()[patchI]
627 * iter()->CpByCpv(
p,
T, patchI)
630 for (++iter; iter != phaseModels_.cend(); ++iter)
634 iter()().boundaryField()[patchI]
635 * iter()->CpByCpv(
p,
T, patchI)
652 auto iter = phaseModels_.cbegin();
656 iter()() * iter()->
kappa()
659 for (++iter; iter != phaseModels_.cend(); ++iter)
661 tmpkappa.ref() += iter()() * iter()->kappa();
673 auto iter = phaseModels_.cbegin();
675 tmp<scalarField> tmpKappa
677 iter()().boundaryField()[patchI]
678 * iter()->
kappa(patchI)
681 for (++iter; iter != phaseModels_.cend(); ++iter)
685 iter()().boundaryField()[patchI]
686 * iter()->kappa(patchI)
696 phaseModelTable::const_iterator phaseModelIter = phaseModels_.begin();
698 tmp<volScalarField> talphaEff
700 phaseModelIter()()*phaseModelIter()->alphahe()
703 for (; phaseModelIter != phaseModels_.end(); ++phaseModelIter)
705 talphaEff.ref() += phaseModelIter()()*phaseModelIter()->alphahe();
717 phaseModelTable::const_iterator phaseModelIter = phaseModels_.begin();
719 tmp<scalarField> talphaEff
721 phaseModelIter()().boundaryField()[patchi]
722 *phaseModelIter()->alphahe(patchi)
725 for (; phaseModelIter != phaseModels_.end(); ++phaseModelIter)
728 phaseModelIter()().boundaryField()[patchi]
729 *phaseModelIter()->alphahe(patchi);
753 return kappa(patchI) + kappat;
762 auto iter = phaseModels_.cbegin();
766 iter()() * iter()->
alpha()
769 for (++iter; iter != phaseModels_.cend(); ++iter)
771 tmpAlpha.ref() += iter()() * iter()->alpha();
774 tmpAlpha.ref() += alphat;
786 auto iter = phaseModels_.cbegin();
790 iter()().boundaryField()[patchI]
791 * iter()->
alpha(patchI)
794 for (++iter; iter != phaseModels_.cend(); ++iter)
798 iter()().boundaryField()[patchI]
799 * iter()->alpha(patchI)
803 tmpAlpha.
ref() += alphat;
817 auto iter = phaseModels_.cbegin();
821 iter()() * iter()->
mu()
824 for (++iter; iter != phaseModels_.cend(); ++iter)
826 tmpMu.ref() += iter()() * iter()->mu();
838 auto iter = phaseModels_.cbegin();
840 tmp<scalarField> tmpMu
842 iter()().boundaryField()[patchI]
846 for (++iter; iter != phaseModels_.cend(); ++iter)
850 iter()().boundaryField()[patchI]
861 auto iter = phaseModels_.cbegin();
863 tmp<volScalarField> tmpNu
865 iter()() * iter()->
nu()
868 for (++iter; iter != phaseModels_.cend(); ++iter)
870 tmpNu.ref() += iter()() * iter()->nu();
882 auto iter = phaseModels_.cbegin();
884 tmp<scalarField> tmpNu
886 iter()().boundaryField()[patchI]
890 for (++iter; iter != phaseModels_.cend(); ++iter)
894 iter()().boundaryField()[patchI]
911 return turb_->muEff();
923 return turb_->nuEff();
931 this->
kappa() + this->
Cp()*turb_->mut()/Prt_
942 this->
kappa(patchi) +
Cp*turb_->mut(patchi)/Prt_.value()
951 return this->
alpha() + turb_->mut()/Prt_;
958 return (this->
alpha(patchi) + turb_->mut(patchi))/Prt_.value();
1001 iter()->correctTurbulence();
1009 return phaseModels_;
1016 return phaseModels_;
1023 return totalPhasePairs_;
1030 return totalPhasePairs_;
1038 if (!iter()->
thermo().incompressible())
1050 return phaseModels_[phaseName]->thermo().incompressible();
1058 if (!iter()->
thermo().isochoric())
1079 "surfaceTensionForce",
1085 auto& stf = tstf.ref();
1088 if (surfaceTensionModels_.size())
1096 for (++iter2; iter2 != phaseModels_.cend(); ++iter2)
1105 phasePairKey(iter1()->
name(), iter2()->
name())
1131 auto& stf = tstf.ref();
1135 stf += iter()() * iter()->U();
1145 return surfaceTensionModels_[
key]->sigma();
1154 return 1.0/(phaseModels_[
key]->thermo().rho());
1169 for (++iterk; iterk != phaseModels_.cend(); ++iterk)
1171 if (iteri()().
name() != iterk()().
name())
1183 if (interfacePorousModelTable_.found(keyik))
1186 interfacePorousModelTable_[keyik];
1188 Udiag += Vc*interfacePtr->
S();
1202 tmp<surfaceVectorField> tnHatfv = nHatfv(
alpha1,
alpha2);
1205 return -
fvc::div(tnHatfv.ref() & mesh_.Sf());
1234 auto& nearInt = tnearInt.ref();
1242 for (++iter2; iter2 != phaseModels_.cend(); ++iter2)
1287 return gradAlphaf/(
mag(gradAlphaf) + deltaN);
1321 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.
const scalarField & diag() const
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.
static tmp< GeometricField< scalar, fvsPatchField, surfaceMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, const word &patchFieldType=fvsPatchField< scalar >::calculatedType())
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions and patch type. [Takes current timeN...
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.
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 [].
Do not request registration (bool: false)
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