29#include "surfaceTensionModel.H"
34#include "surfaceInterpolate.H"
73 for (
const word& phaseName : phaseNames)
95 auto iter = phaseModels.
cbegin();
103 for (++iter; iter != phaseModels.
cend(); ++iter)
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(),
176 phaseIter2()->
name(),
177 phaseIter1()->
name(),
183 !totalPhasePairs_.found(key)
184 && !totalPhasePairs_.found(keyInverse)
194 phaseModels_[key.first()],
195 phaseModels_[key.second()]
225 calculatedFvPatchScalarField::typeName
227 phaseNames_(get<
wordList>(
"phases")),
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();
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();
430 iter()() * iter()->
Cp()
433 for (++iter; iter != phaseModels_.cend(); ++iter)
435 tmpCp.
ref() += iter()() * iter()->Cp();
449 auto iter = phaseModels_.cbegin();
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();
471 iter()() * iter()->
Cv()
474 for (++iter; iter != phaseModels_.cend(); ++iter)
476 tmpCv.
ref() += iter()() * iter()->Cv();
490 auto iter = phaseModels_.cbegin();
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();
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();
603 iter()() * iter()->CpByCpv()
606 for (++iter; iter != phaseModels_.cend(); ++iter)
608 tmpCpByCpv.
ref() += iter()() * iter()->CpByCpv();
622 auto iter = phaseModels_.cbegin();
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();
677 iter()().boundaryField()[patchI]
678 * iter()->kappa(patchI)
681 for (++iter; iter != phaseModels_.cend(); ++iter)
685 iter()().boundaryField()[patchI]
686 * iter()->kappa(patchI)
700 phaseModelIter()()*phaseModelIter()->alphahe()
703 for (; phaseModelIter != phaseModels_.end(); ++phaseModelIter)
705 talphaEff.
ref() += phaseModelIter()()*phaseModelIter()->alphahe();
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();
842 iter()().boundaryField()[patchI]
846 for (++iter; iter != phaseModels_.cend(); ++iter)
850 iter()().boundaryField()[patchI]
861 auto iter = phaseModels_.cbegin();
865 iter()() * iter()->
nu()
868 for (++iter; iter != phaseModels_.cend(); ++iter)
870 tmpNu.
ref() += iter()() * iter()->nu();
882 auto iter = phaseModels_.cbegin();
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_
944 this->kappa(patchi) +
Cp*turb_->mut(patchi)/Prt_.value()
953 return this->
alpha() + turb_->mut()/Prt_;
960 return (this->
alpha(patchi) + turb_->mut(patchi))/Prt_.value();
1003 iter()->correctTurbulence();
1011 return phaseModels_;
1018 return phaseModels_;
1025 return totalPhasePairs_;
1032 return totalPhasePairs_;
1040 if (!iter()->
thermo().incompressible())
1052 return phaseModels_[phaseName]->thermo().incompressible();
1060 if (!iter()->
thermo().isochoric())
1083 "surfaceTensionForce",
1084 mesh_.time().timeName(),
1091 auto& stf = tstf.ref();
1094 if (surfaceTensionModels_.size())
1102 for (++iter2; iter2 != phaseModels_.cend(); ++iter2)
1134 mesh_.time().timeName(),
1141 auto& stf = tstf.ref();
1145 stf += iter()() * iter()->U();
1155 return surfaceTensionModels_[key]->sigma();
1164 return 1.0/(phaseModels_[key]->thermo().rho());
1179 for (++iterk; iterk != phaseModels_.cend(); ++iterk)
1181 if (iteri()().
name() != iterk()().
name())
1193 if (interfacePorousModelTable_.found(keyik))
1196 interfacePorousModelTable_[keyik];
1198 Udiag += Vc*interfacePtr->S();
1241 mesh_.time().timeName(),
1248 auto& nearInt = tnearInt.ref();
1256 for (++iter2; iter2 != phaseModels_.cend(); ++iter2)
1301 return gradAlphaf/(
mag(gradAlphaf) + deltaN);
1335 return gradAlphaf/(
mag(gradAlphaf) + deltaN);
CGAL::Exact_predicates_exact_constructions_kernel K
const volScalarField & alpha1
const volScalarField & alpha2
void setOriented(const bool oriented=true) noexcept
Set the oriented flag.
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)
Defines the attributes of an object for which implicit objectRegistry management is supported,...
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Abstract base-class for fluid and solid thermodynamic properties.
A const_iterator for iterating across on values.
const dictionary & coeffs() const
Return const dictionary of the model.
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Mesh data needed to do the Finite Volume discretisation.
const surfaceScalarField & nHatf() const
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.
virtual tmp< volScalarField > W() const
Molecular weight [kg/kmol] of the mixture.
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< 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].
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.
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.
surfaceScalarField phi_
Mixture total volumetric flux.
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.
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.
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 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.
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.
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
A class for managing temporary objects.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const volScalarField & mu
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.
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)
const dimensionSet dimViscosity
dimensionedScalar pos(const dimensionedScalar &ds)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
const dimensionSet dimless
Dimensionless.
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
const dimensionSet dimVelocity
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
static constexpr const zero Zero
Global zero (0)
dimensionedScalar cbrt(const dimensionedScalar &ds)
const dimensionSet dimVolume(pow3(dimLength))
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
const dimensionSet dimDensity
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
#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.