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(),
177 phaseIter2()->
name(),
178 phaseIter1()->
name(),
184 !totalPhasePairs_.found(
key)
185 && !totalPhasePairs_.found(keyInverse)
195 phaseModels_[
key.first()],
196 phaseModels_[
key.second()]
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();
1001 iter()->correctTurbulence();
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();
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();
1234 auto& nearInt = tnearInt.ref();
1242 for (++iter2; iter2 != phaseModels_.cend(); ++iter2)
1287 return gradAlphaf/(
mag(gradAlphaf) + deltaN);
1321 return gradAlphaf/(
mag(gradAlphaf) + deltaN);
CGAL::Exact_predicates_exact_constructions_kernel K
const volScalarField & alpha1
const volScalarField & alpha2
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())
const_iterator cbegin() const
const_iterator set to the beginning of the HashTable
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
constexpr const_iterator cend() const noexcept
const_iterator to signal the end (for any HashTable)
@ NO_REGISTER
Do not request registration (bool: false).
@ READ_IF_PRESENT
Reading is optional [identical to LAZY_READ].
@ AUTO_WRITE
Automatically write from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const Time & time() const noexcept
Return Time associated with the objectRegistry.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Abstract base-class for fluid and solid thermodynamic properties.
virtual const volScalarField & T() const
Temperature [K].
virtual volScalarField & p()
Pressure [Pa].
basicThermo(const basicThermo &)=delete
No copy construct.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
Mesh data needed to do the Finite Volume discretisation.
void generatePairsTable()
Generate pair table.
tmp< surfaceScalarField > surfaceTensionForce() const
Calculate surface tension of the mixture.
tmp< volScalarField > nearInterface() const
Near Interface of alpha'n.
virtual ~multiphaseInterSystem()
Destructor.
compressibleTurbulenceModel * turb_
Turbulence model.
virtual tmp< volScalarField > W() const
Molecular weight [kg/kmol] of the mixture.
dimensionedScalar Prt_
Turbulent Prandt number.
static const word phasePropertiesName
Default name of the phase properties dictionary.
const dimensionedScalar & Prt() const
Return Prandt number.
virtual tmp< volScalarField > Cp() const
Return Cp of the mixture.
void generatePairs(const dictTable &modelDicts)
Generate pairs.
tmp< volScalarField > muEff() const
Return the effective dynamic viscosity.
const fvMesh & mesh_
Reference to the mesh.
virtual tmp< volScalarField > surfaceTensionCoeff(const phasePairKey &key) const
Return the surface tension coefficient.
const surfaceScalarField & phi() const
Constant access to the total flux.
virtual void correct()
Correct the mixture thermos.
tmp< volScalarField > K(const volScalarField &alpha1, const volScalarField &alpha2) const
Interface curvature.
wordList phaseNames_
Phase names.
tmp< volVectorField > U() const
Mixture U.
const phaseModelTable & phases() const
Constant access the phases.
virtual tmp< volScalarField > alphahe() const
Thermal diffusivity for energy of mixture [kg/m/s].
virtual tmp< volScalarField > mu() const
Dynamic viscosity of mixture [kg/m/s].
tmp< volScalarField > mut() const
Return the turbulent dynamic viscosity.
interfacePorousModelTable interfacePorousModelTable_
Interface porous models.
virtual tmp< volScalarField > nu() const
Kinematic viscosity of mixture [m^2/s].
HashTable< autoPtr< phasePair >, phasePairKey, phasePairKey::hash > phasePairTable
const surfaceScalarField & rhoPhi() const
Constant access to the mixture mass flux.
surfaceTensionModelTable surfaceTensionModels_
Surface tension models.
const phasePairTable & totalPhasePairs() const
Constant access the total phase pairs.
virtual tmp< volScalarField > CpByCpv() const
Heat capacity ratio [].
virtual void correctTurbulence()
Correct the turbulence.
virtual tmp< volScalarField > coeffs(const word &key) const
Return coefficients (1/rho).
tmp< volScalarField > alphaEff() const
Effective thermal turbulent diffusivity of mixture [kg/m/s].
void generatePairsAndSubModels(const word &modelName, HashTable< autoPtr< modelType >, phasePairKey, phasePairKey::hash > &models)
Generate pairs and sub-model tables.
HashTable< autoPtr< multiphaseInter::phaseModel > > generatePhaseModels(const wordList &names) const
Generate the phases.
phasePairTable phasePairs_
Phase pairs.
surfaceScalarField phi_
Mixture total volumetric flux.
HashTable< autoPtr< multiphaseInter::phaseModel > > phaseModelTable
virtual tmp< volScalarField > hc() const
Chemical enthalpy of the mixture [J/kg].
tmp< volScalarField > nuEff() const
Return the effective kinematic viscosity.
void calcMu()
Calculate and return the laminar viscosity.
multiphaseInterSystem(const fvMesh &mesh)
Construct from fvMesh.
virtual tmp< volScalarField > gamma() const
Gamma = Cp/Cv [].
virtual volScalarField & he()
Return access to the internal energy field [J/Kg].
virtual tmp< volScalarField > kappa() const
Thermal diffusivity for temperature of mixture [J/m/s/K].
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.
volScalarField mu_
Dynamic viscocity.
void addInterfacePorosity(fvVectorMatrix &UEqn)
Add interface porosity on phasePair.
const fvMesh & mesh() const
Return mesh.
tmp< surfaceScalarField > nHatf(const volScalarField &alpha1, const volScalarField &alpha2) const
Interface normal surface vector.
virtual tmp< volScalarField > rho() const
Return the mixture density.
tmp< volScalarField > nut() const
Return the turbulent kinematic viscosity.
surfaceScalarField rhoPhi_
Mixture total mass flux.
tmp< surfaceVectorField > nHatfv(const volScalarField &alpha1, const volScalarField &alpha2) const
Interface normal surface vector.
virtual tmp< scalarField > rhoEoS(const scalarField &p, const scalarField &T, const labelList &cells) const
Density from pressure and temperature.
tmp< volScalarField > kappaEff() const
Effective thermal turbulent diffusivity for temperature.
virtual tmp< volScalarField > Cv() const
Return Cv of the mixture.
tmp< volVectorField > nVolHatfv(const volScalarField &alpha1, const volScalarField &alpha2) const
Interface normal volField vector.
virtual tmp< volScalarField > kappaEff(const volScalarField &kappat) const
Effective thermal diffusivity for temperature.
phaseModelTable phaseModels_
Phase models.
HashTable< dictionary, phasePairKey, phasePairKey::hash > dictTable
virtual bool read()
Read base phaseProperties dictionary.
virtual bool isochoric() const
Return true if the equation of state is isochoric for all phasses.
virtual tmp< volScalarField > Cpv() const
Heat capacity at constant pressure/volume [J/kg/K].
virtual bool incompressible() const
Return true if the equation of state is incompressible for all.
tmp< surfaceScalarField > generatePhi(const HashTable< autoPtr< multiphaseInter::phaseModel > > &phaseModels) const
Generate the mixture flux.
phasePairTable totalPhasePairs_
Total ordered phase pairs in the system.
static autoPtr< phaseModel > New(const multiphaseInterSystem &fluid, const word &phaseName)
const word & name() const
The name of this phase.
An ordered or unorder pair of phase names. Typically specified as follows.
Description for mass transfer between a pair of phases. The direction of the mass transfer is from th...
virtual bool read()
Read object.
A class for managing temporary objects.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
A class for handling words, derived from Foam::string.
Represents 0/1 range or concept. Used for tagged dispatch or clamping.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const volScalarField & Cv
const volScalarField & Cp
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Calculate the divergence of the given field.
Calculate the gradient of the given field.
Calculate the snGrad of the given volField.
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
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< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh > > grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
constexpr auto key(const Type &t) noexcept
Helper function to return the enum value.
const dimensionSet dimViscosity
GeometricField< vector, fvsPatchField, surfaceMesh > surfaceVectorField
dimensionedScalar pos(const dimensionedScalar &ds)
List< word > wordList
List of word.
GeometricField< vector, fvPatchField, volMesh > volVectorField
const dimensionSet dimless
Dimensionless.
List< label > labelList
A List of labels.
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
const dimensionSet dimVelocity
dimensionSet clamp(const dimensionSet &a, const dimensionSet &range)
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
fvMatrix< vector > fvVectorMatrix
static constexpr const zero Zero
Global zero (0).
dimensionedScalar cbrt(const dimensionedScalar &ds)
const dimensionSet dimVolume(pow3(dimLength))
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const dimensionSet dimDensity
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &f1, const label comm)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
psiReactionThermo & thermo
#define forAllIters(container, iter)
Iterate across all elements in the container object.
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.