28 #include "surfaceInterpolate.H"
68 for (
label phasei=1; phasei<phaseModels.size(); phasei++)
85 movingPhaseModels_[0],
86 calculatedFvPatchScalarField::typeName
93 movingPhasei<movingPhaseModels_.size();
97 sumAlphaMoving.
ref() += movingPhaseModels_[movingPhasei];
100 return sumAlphaMoving;
110 forAll(movingPhaseModels_, movingPhasei)
113 movingPhaseModels_[movingPhasei]
114 *movingPhaseModels_[movingPhasei].U();
117 forAll(movingPhaseModels_, movingPhasei)
119 movingPhaseModels_[movingPhasei].URef() += dUm;
134 forAll(movingPhaseModels_, movingPhasei)
137 alphafs[movingPhaseModels_[movingPhasei].index()]
138 *movingPhaseModels_[movingPhasei].phi();
141 forAll(movingPhaseModels_, movingPhasei)
143 movingPhaseModels_[movingPhasei].phiRef() += dphim;
170 return gradAlphaf/(
mag(gradAlphaf) + deltaN_);
181 return nHatfv(alpha1, alpha2) & mesh_.Sf();
197 phase1.
U()().boundaryField(),
199 tnHatfv.
ref().boundaryFieldRef()
203 return -
fvc::div(tnHatfv & mesh_.Sf());
219 mesh.time().constant(),
232 referencePhaseName_(lookupOrDefault(
"referencePhase",
word::null)),
240 phi_(
"phi", calcPhi(phaseModels_)),
261 label movingPhasei = 0;
262 label stationaryPhasei = 0;
263 label anisothermalPhasei = 0;
264 label multicomponentPhasei = 0;
271 multicomponentPhasei += !phase.
pure();
279 stationaryPhasei = 0;
280 anisothermalPhasei = 0;
281 multicomponentPhasei = 0;
307 if (this->
found(
"interfaceCompression"))
357 label movingPhasei=1;
358 movingPhasei<movingPhaseModels_.size();
363 movingPhaseModels_[movingPhasei]
364 *movingPhaseModels_[movingPhasei].rho();
367 if (stationaryPhaseModels_.empty())
373 return rho/sumAlphaMoving();
384 label movingPhasei=1;
385 movingPhasei<movingPhaseModels_.size();
390 movingPhaseModels_[movingPhasei]
391 *movingPhaseModels_[movingPhasei].U();
394 if (stationaryPhaseModels_.empty())
400 return U/sumAlphaMoving();
408 if (interfaceSurfaceTensionModels_.found(key))
410 return interfaceSurfaceTensionModels_[key]->sigma();
416 interfaceSurfaceTensionModel::typeName +
":sigma",
427 if (interfaceSurfaceTensionModels_.found(key))
429 return interfaceSurfaceTensionModels_[key]->sigma(
patchi);
459 pos0(phases()[phasei] - 0.01)*
pos0(0.99 - phases()[phasei])
495 forAll(phaseModels_, phasei)
497 if (!phaseModels_[phasei].incompressible())
538 if (&phase2 != &phase1)
542 if (cAlphas_.found(interface))
544 tSurfaceTension.
ref() +=
554 return tSurfaceTension;
560 forAll(phaseModels_, phasei)
562 phaseModels_[phasei].correct();
571 forAll(movingPhaseModels_, movingPhasei)
573 phaseModel& phase = movingPhaseModels_[movingPhasei];
594 source += dmdts[phase.
index()];
604 bool updateDpdt =
false;
606 forAll(phaseModels_, phasei)
608 phaseModels_[phasei].correctKinematics();
610 updateDpdt = updateDpdt || phaseModels_[phasei].thermo().dpdt();
616 dpdt_ =
fvc::ddt(phaseModels_.begin()().thermo().p());
623 forAll(phaseModels_, phasei)
625 phaseModels_[phasei].correctThermo();
632 forAll(phaseModels_, phasei)
634 phaseModels_[phasei].correctReactions();
641 forAll(phaseModels_, phasei)
643 phaseModels_[phasei].correctSpecies();
650 forAll(phaseModels_, phasei)
652 phaseModels_[phasei].predictMomentumTransport();
659 forAll(phaseModels_, phasei)
661 phaseModels_[phasei].predictThermophysicalTransport();
668 forAll(phaseModels_, phasei)
670 phaseModels_[phasei].correctMomentumTransport();
677 forAll(phaseModels_, phasei)
679 phaseModels_[phasei].correctThermophysicalTransport();
686 if (mesh_.changing())
700 forAll(movingPhases(), movingPhasei)
702 phaseModel& phase = movingPhases()[movingPhasei];
709 MRF_.relative(mesh_.Sf().boundaryField() & UBf)
718 isA<fixedValueFvsPatchScalarField>(phiBf[
patchi])
719 && !isA<movingWallVelocityFvPatchVectorField>(UBf[
patchi])
737 forAll(movingPhases(), movingPhasei)
739 phaseModel& phase = movingPhases()[movingPhasei];
746 if (Ubf[
patchi].fixesValue())
748 Ubf[
patchi].initEvaluate();
754 if (Ubf[
patchi].fixesValue())
763 correctBoundaryFlux();
767 forAll(movingPhases(), movingPhasei)
769 phaseModel& phase = movingPhases()[movingPhasei];
777 phi_ += alphafs[phasei]*(mesh_.Sf() & phase.
UfRef());
780 if (incompressible())
785 movingPhases()[0].
U(),
827 setMixturePhi(alphafs, phi_);
837 forAll(phaseModels_, phasei)
839 readOK &= phaseModels_[phasei].read();
861 return vf/vf.
mesh().time().deltaT();
874 return sf/
sf.
mesh().time().deltaT();
#define forAll(list, i)
Loop across all elements in list.
const Mesh & mesh() const
Return mesh.
Generic GeometricBoundaryField class.
void evaluate()
Evaluate boundary conditions.
Generic GeometricField class.
static tmp< GeometricField< Type, PatchField, GeoMesh > > New(const word &name, const Internal &, const PtrList< PatchField< Type >> &)
Return a temporary field constructed from name,.
Boundary & boundaryFieldRef()
Return a reference to the boundary field.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
writeOption writeOpt() const
const word & name() const
Return name.
static word groupName(Name name, const word &group)
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
bool set(const label) const
Is element set.
bool set(const label) const
Is element set.
void resize(const label)
Reset size of UPtrList. This can only be used to set the size.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
A list of keyword definitions, which are a keyword followed by any number of values (e....
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Dimension set for the base types.
virtual const volScalarField & psi() const =0
Compressibility [s^2/m^2].
Mesh data needed to do the Finite Volume discretisation.
const fvSchemes & schemes() const
Return the fvSchemes.
void setFluxRequired(const word &name) const
static const surfaceScalarField & localRDeltaTf(const fvMesh &mesh)
Return the reciprocal of the local face time-step.
static const volScalarField & localRDeltaT(const fvMesh &mesh)
Return the reciprocal of the local time-step.
static bool enabled(const fvMesh &mesh)
Return true if LTS is enabled.
static const dimensionSet dimSigma
Coefficient dimensions.
Non-orthogonal solution control class. Provides non-orthogonal-loop control methods.
Word-pair based class used for keying interface models in hash tables.
Class to represent an interface between phases. Derivations can further specify the configuration of ...
virtual bool pure() const =0
Return whether the phase is pure (i.e., not multi-component)
virtual surfaceScalarField & phiRef()=0
Access the volumetric flux.
virtual const rhoThermo & thermo() const =0
Return the thermophysical model.
virtual bool stationary() const =0
Return whether the phase is stationary.
label index() const
Return the index of the phase.
virtual tmp< volVectorField > U() const =0
Return the velocity.
virtual bool isothermal() const =0
Return whether the phase is isothermal.
virtual volVectorField & URef()=0
Access the velocity.
const word & name() const
Return the name of this phase.
virtual const volScalarField & rho() const =0
Return the density field.
virtual void correctContinuityError(const volScalarField &source)
Correct the continuity error.
virtual surfaceVectorField & UfRef()=0
Access the face velocity.
Class to represent a system of phases and model interfacial transfers between them.
phaseModelPartialList stationaryPhaseModels_
Stationary phase models.
virtual void correctKinematics()
Correct the kinematics.
tmp< volScalarField > nearInterface() const
Indicator of the proximity of the interface.
void correctPhi(const volScalarField &p_rgh, const autoPtr< volScalarField > &divU, const pressureReference &pressureReference, nonOrthogonalSolutionControl &pimple)
static const word propertiesName
Default name of the phase properties dictionary.
void generateInterfacialModels(const dictionary &dict, const phaseInterface &interface, PtrList< phaseInterface > &interfaces, PtrList< ModelType > &models) const
Generate interfacial-model lists.
virtual void correctReactions()
Correct the reactions.
const fvMesh & mesh_
Reference to the mesh.
phaseModelPartialList multicomponentPhaseModels_
Multi-component phase models.
phaseModelList phaseModels_
Phase models.
phaseModelPartialList movingPhaseModels_
Moving phase models.
void setMixtureU(const volVectorField &Um)
Re-normalise the velocity of the phases.
virtual void correctSpecies()
Correct the species mass fractions.
const surfaceScalarField & phi() const
Return the mixture flux.
virtual void correctThermo()
Correct the thermodynamics.
virtual void correct()
Correct the fluid properties other than those listed below.
tmp< volScalarField > sigma(const phaseInterfaceKey &key) const
Return the surface tension coefficient for an interface.
phaseModelPartialList anisothermalPhaseModels_
Anisothermal phase models.
virtual void predictThermophysicalTransport()
Predict the energy transport e.g. alphat.
tmp< volScalarField > K(const phaseModel &alpha1, const phaseModel &alpha2) const
Curvature of interface between two phases.
tmp< volVectorField > U() const
Return the mixture velocity.
virtual void correctMomentumTransport()
Correct the momentumTransport.
void correctBoundaryFlux()
Correct fixed-flux BCs to be consistent with the velocity BCs.
tmp< surfaceScalarField > calcPhi(const phaseModelList &phaseModels) const
Calculate and return the mixture flux.
const phaseModelList & phases() const
Return the phase models.
virtual tmp< volScalarField > dmdtf(const phaseInterfaceKey &key) const
Return the mass transfer rate for an interface.
interfaceSurfaceTensionModelTable interfaceSurfaceTensionModels_
Surface tension models.
virtual void correctThermophysicalTransport()
Correct the energy transport e.g. alphat.
virtual PtrList< volScalarField > dmdts() const
Return the mass transfer rates for each phase.
virtual void meshUpdate()
Update the fluid properties for mesh changes.
cAlphaTable cAlphas_
Interface compression coefficients.
surfaceScalarField phi_
Total volumetric flux.
virtual bool implicitPhasePressure() const
Returns true if the phase pressure is treated implicitly.
tmp< surfaceScalarField > surfaceTension(const phaseModel &phase) const
Return the surface tension force.
tmp< volScalarField > sumAlphaMoving() const
Return the sum of the phase fractions of the moving phases.
phaseSystem(const fvMesh &mesh)
Construct from fvMesh.
void setMixturePhi(const PtrList< surfaceScalarField > &alphafs, const surfaceScalarField &phim)
Re-normalise the flux of the phases.
virtual ~phaseSystem()
Destructor.
void generateInterfacialValues(const dictionary &dict, HashTable< ValueType, phaseInterfaceKey, phaseInterfaceKey::hash > &values) const
Generate interfacial-model tables.
tmp< surfaceScalarField > nHatf(const volScalarField &alpha1, const volScalarField &alpha2) const
Normal to interface between two phases dotted with face areas.
tmp< volScalarField > rho() const
Return the mixture density.
word referencePhaseName_
Name of optional reference phase which is not solved for.
tmp< surfaceVectorField > nHatfv(const volScalarField &alpha1, const volScalarField &alpha2) const
Normal to interface between two phases.
virtual void predictMomentumTransport()
Predict the momentumTransport.
virtual PtrList< volScalarField > d2mdtdps() const
Return the mass transfer pressure implicit coefficients.
virtual bool read()
Read base phaseProperties dictionary.
virtual void correctContinuityError()
Correct the continuity errors.
bool incompressible() const
Return incompressibility.
Pimple no-loop control class. Implements various option flags, but leaves loop controls to the deriva...
Provides controls for the pressure reference in closed-volume simulations.
virtual bool read()
Read object.
A class for managing temporary objects.
T & ref() const
Return non-const reference or generate a fatal error.
A class for handling words, derived from string.
static const word null
An empty word.
Foam::fvModels & fvModels(Foam::fvModels::New(mesh))
pimpleControl pimple(mesh)
Flux correction functions to ensure continuity.
Calculate the first temporal derivative.
Calculate the divergence of the given field.
Calculate the gradient of the given field.
Calculate the mesh motion flux and convert fluxes from absolute to relative and back.
Calculate the snGrad of the given volField.
volScalarField sf(fieldObject, mesh)
const volScalarField & psi
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
const dimensionedScalar sigma
Stefan-Boltzmann constant: default SI units: [W/m^2/K^4].
void correctPhi(surfaceScalarField &phi, const volVectorField &U, const volScalarField &p, const autoPtr< volScalarField > &rAU, const autoPtr< volScalarField > &divU, const pressureReference &pressureReference, nonOrthogonalSolutionControl &pcorrControl)
static tmp< SurfaceField< Type > > interpolate(const VolField< Type > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
tmp< VolField< Type > > ddt(const dimensioned< Type > dt, const fvMesh &mesh)
tmp< VolField< typename outerProduct< vector, Type >::type > > grad(const SurfaceField< Type > &ssf)
tmp< VolField< Type > > div(const SurfaceField< Type > &ssf)
void makeRelative(surfaceScalarField &phi, const volVectorField &U)
Make the given flux relative.
tmp< SurfaceField< Type > > snGrad(const VolField< Type > &vf, const word &name)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
dimensionedScalar pos0(const dimensionedScalar &ds)
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const dimensionSet dimPressure
const dimensionSet dimless
SurfaceField< scalar > surfaceScalarField
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
tmp< volScalarField > byDt(const volScalarField &vf)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
const dimensionSet dimTime
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 dimensionSet dimDensity
dimensioned< scalar > mag(const dimensioned< Type > &)
defineTypeNameAndDebug(combustionModel, 0)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
word name(const complex &)
Return a string representation of a complex.