28 #include "surfaceInterpolate.H"
89 forAll(movingPhaseModels_, movingPhasei)
92 movingPhaseModels_[movingPhasei]
93 *movingPhaseModels_[movingPhasei].U();
96 forAll(movingPhaseModels_, movingPhasei)
98 movingPhaseModels_[movingPhasei].URef() += dUm;
113 forAll(movingPhaseModels_, movingPhasei)
116 alphafs[movingPhaseModels_[movingPhasei].index()]
117 *movingPhaseModels_[movingPhasei].phi();
120 forAll(movingPhaseModels_, movingPhasei)
122 movingPhaseModels_[movingPhasei].phiRef() += dphim;
149 return gradAlphaf/(
mag(gradAlphaf) + deltaN_);
160 return nHatfv(alpha1, alpha2) & mesh_.Sf();
176 phase1.
U()().boundaryField(),
178 tnHatfv.
ref().boundaryFieldRef()
182 return -
fvc::div(tnHatfv & mesh_.Sf());
211 referencePhaseName_(lookupOrDefault(
"referencePhase",
word::null)),
245 found(
"interfaceCompression")
249 subDict(
"interfaceCompression")
260 surfaceTensionCoefficientModels_()
269 generateInterfacialModels<surfaceTensionCoefficientModel>
272 subDict(modelName<surfaceTensionCoefficientModel>())
276 label movingPhasei = 0;
277 label stationaryPhasei = 0;
278 label thermalPhasei = 0;
279 label multicomponentPhasei = 0;
286 multicomponentPhasei += !phase.
pure();
294 stationaryPhasei = 0;
296 multicomponentPhasei = 0;
358 <<
"The phase system type entry - type - in "
368 "saturationTemperature",
369 "interfaceComposition",
370 "diffusiveMassTransfer"
376 modelEntriesString<< modelEntries[i];
377 if (i < modelEntries.size() - 2) modelEntriesString<<
", ";
378 if (i == modelEntries.size() - 2) modelEntriesString<<
" and ";
381 label warnOrError = 0;
384 if (!
found(modelEntries[i]))
continue;
393 if (warnOrError != 0)
395 msg <<
"Phase change model entries - "
396 << modelEntriesString.
str().c_str() <<
" - in "
398 <<
"are now specified as fvModels.";
400 if (warnOrError == 1)
405 if (warnOrError == 2)
435 {
"nCorrectors",
"nAlphaCorr"},
454 nAlphaSubCycles = ceil(nAlphaSubCyclesPtr->value(
CoNum));
464 label movingPhasei=1;
465 movingPhasei<movingPhaseModels_.size();
470 movingPhaseModels_[movingPhasei]
471 *movingPhaseModels_[movingPhasei].rho();
474 if (stationaryPhaseModels_.empty())
480 return rho/sumAlphaMoving();
491 label movingPhasei=1;
492 movingPhasei<movingPhaseModels_.size();
497 movingPhaseModels_[movingPhasei]
498 *movingPhaseModels_[movingPhasei].U();
501 if (stationaryPhaseModels_.empty())
507 return U/sumAlphaMoving();
515 if (surfaceTensionCoefficientModels_.found(key))
517 return surfaceTensionCoefficientModels_[key].sigma();
534 if (surfaceTensionCoefficientModels_.found(key))
536 return surfaceTensionCoefficientModels_[key].sigma(
patchi);
566 pos0(phases()[phasei] - 0.01)*
pos0(0.99 - phases()[phasei])
593 if (&phase2 != &phase1)
597 if (cAlphas_.found(interface))
599 tSurfaceTension.
ref() +=
609 return tSurfaceTension;
615 forAll(phaseModels_, phasei)
617 if (!phaseModels_[phasei].incompressible())
629 forAll(phaseModels_, phasei)
631 phaseModels_[phasei].correct();
641 forAll(movingPhaseModels_, movingPhasei)
643 phaseModel& phase = movingPhaseModels_[movingPhasei];
674 bool updateDpdt =
false;
676 forAll(phaseModels_, phasei)
678 phaseModels_[phasei].correctKinematics();
681 if (!updateDpdt && phaseModels_[phasei].
thermo().dpdt())
692 forAll(phaseModels_, phasei)
694 phaseModels_[phasei].correctThermo();
701 forAll(phaseModels_, phasei)
703 phaseModels_[phasei].correctReactions();
710 forAll(phaseModels_, phasei)
712 phaseModels_[phasei].correctSpecies();
719 forAll(phaseModels_, phasei)
721 phaseModels_[phasei].predictMomentumTransport();
728 forAll(phaseModels_, phasei)
730 phaseModels_[phasei].predictThermophysicalTransport();
737 forAll(phaseModels_, phasei)
739 phaseModels_[phasei].correctMomentumTransport();
746 forAll(phaseModels_, phasei)
748 phaseModels_[phasei].correctThermophysicalTransport();
755 if (mesh_.changing())
767 forAll(movingPhaseModels_, movingPhasei)
769 phaseModel& phase = movingPhaseModels_[movingPhasei];
776 MRF_.relative(mesh_.Sf().boundaryField() & UBf)
785 isA<fixedValueFvsPatchScalarField>(phiBf[
patchi])
786 && !isA<movingWallVelocityFvPatchVectorField>(UBf[
patchi])
787 && !isA<movingWallSlipVelocityFvPatchVectorField>(UBf[
patchi])
806 forAll(movingPhaseModels_, movingPhasei)
808 phaseModel& phase = movingPhaseModels_[movingPhasei];
810 MRF_.makeRelative(phase.
phiRef());
814 forAll(movingPhaseModels_, movingPhasei)
816 phaseModel& phase = movingPhaseModels_[movingPhasei];
823 if (Ubf[
patchi].fixesValue())
825 Ubf[
patchi].initEvaluate();
831 if (Ubf[
patchi].fixesValue())
840 correctBoundaryFlux();
844 forAll(movingPhaseModels_, movingPhasei)
846 phaseModel& phase = movingPhaseModels_[movingPhasei];
854 phi_ += alphafs[phasei]*(mesh_.Sf() & phase.
UfRef());
857 if (incompressible())
862 movingPhaseModels_[0].
U(),
902 MRF_.makeRelative(phi_);
905 setMixturePhi(alphafs, phi_);
915 forAll(phaseModels_, phasei)
917 readOK &= phaseModels_[phasei].read();
921 found(
"interfaceCompression")
922 ? generateInterfacialValues<scalar>
925 subDict(
"interfaceCompression")
929 surfaceTensionCoefficientModels_ =
930 generateInterfacialModels<surfaceTensionCoefficientModel>
933 subDict(modelName<surfaceTensionCoefficientModel>())
953 return vf/vf.
mesh().time().deltaT();
966 return sf/
sf.
mesh().time().deltaT();
#define forAll(list, i)
Loop across all elements in list.
const GeoMesh & mesh() const
Return mesh.
static autoPtr< Function1< Type > > New(const word &name, const Function1s::unitSets &units, const dictionary &dict)
Select from dictionary.
Generic GeometricBoundaryField class.
void evaluate()
Evaluate boundary conditions.
Generic GeometricField class.
Internal & internalFieldRef()
Return a reference to the dimensioned internal field.
Boundary & boundaryFieldRef()
Return a reference to the boundary field.
static tmp< GeometricField< Type, GeoMesh, PrimitiveField > > New(const word &name, const Internal &, const PtrList< Patch > &, const HashPtrTable< Source > &=HashPtrTable< Source >())
Return a temporary field constructed from name,.
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...
fileName relativeObjectPath() const
Return complete relativePath + object name.
writeOption & writeOpt() const
const word & name() const
Return name.
static word groupName(Name name, const word &group)
MRF zones DemandDrivenMeshObject read from MRFProperties dictionary.
Output to memory buffer stream.
string str() const
Return the string.
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.
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
bool set(const label) const
Is element set.
label size() const
Return the number of elements in the UPtrList.
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 keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
T lookupOrDefault(const word &, const T &) const
Find and return a T, if not found return the given default.
T lookupOrDefaultBackwardsCompatible(const wordList &, const T &) const
Find and return a T, trying a list of keywords in sequence,.
bool isDict(const word &) const
Check if entry is a sub-dictionary.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Dimension set for the base types.
Base-class for fluid thermodynamic properties.
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.
tmp< fvMatrix< Type > > source(const VolField< Type > &field) const
Return source for an equation.
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.
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 bool stationary() const =0
Return whether the phase is stationary.
virtual const rhoFluidThermo & fluidThermo() const =0
Return the thermophysical model.
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.
phaseModelPartialList stationaryPhaseModels_
Stationary phase models.
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 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.
void correctSpecies()
Correct the species mass fractions.
tmp< surfaceScalarField > surfaceTension(const phaseModel &) const
Return the surface tension force.
void correctThermo()
Correct the thermodynamics.
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.
void correctContinuityError(const PtrList< volScalarField::Internal > &dmdts)
Correct the continuity errors.
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.
void correctMomentumTransport()
Correct the momentumTransport.
void correctBoundaryFlux()
Correct fixed-flux BCs to be consistent with the velocity BCs.
const phaseModelList & phases() const
Return the phase models.
void correctThermophysicalTransport()
Correct the energy transport e.g. alphat.
phaseModelPartialList thermalPhaseModels_
Thermal phase models.
void meshUpdate()
Update the fluid properties for mesh changes.
surfaceScalarField phi_
Total volumetric flux.
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.
surfaceTensionCoefficientModelTable surfaceTensionCoefficientModels_
Surface tension models.
virtual ~phaseSystem()
Destructor.
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.
void predictMomentumTransport()
Predict the momentumTransport.
virtual bool read()
Read base phaseProperties dictionary.
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.
Enables the printing of a dictionary and subsequently looked-up defaulted entries.
virtual bool read()
Read object.
static const dimensionSet dimSigma
Coefficient dimensions.
A class for managing temporary objects.
T & ref() const
Return non-const reference or generate a fatal error.
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
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)
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
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))
#define WarningInFunction
Report a warning using Foam::Warning.
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)
const unitSet & lookup(const word &unitName)
Lookup and return the named unit from the table.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const dimensionSet & dimless
dimensionedScalar pos0(const dimensionedScalar &ds)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
String typeName(const std::type_info &info)
Return the un-mangled name given the standard type info.
dimensioned< Type > average(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
SurfaceField< scalar > surfaceScalarField
tmp< volScalarField > byDt(const volScalarField &vf)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
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.
Foam::HashTable< ValueType, Foam::phaseInterfaceKey, Foam::phaseInterfaceKey::hash > generateInterfacialValues(const phaseSystem &fluid, const dictionary &dict, const wordHashSet &ignoreKeys=wordHashSet())
const dimensionSet & dimTime
const dimensionSet & dimDensity
const dimensionSet & dimPressure
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
tmp< DimensionedField< typename powProduct< Type, r >::type, GeoMesh, Field > > pow(const DimensionedField< Type, GeoMesh, PrimitiveField > &df, typename powProduct< Type, r >::type)
Ostream & indentOrNl(Ostream &os)
Indent stream or add newline if indent level == 0.
tmp< DimensionedField< scalar, GeoMesh, Field > > mag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
defineTypeNameAndDebug(atmosphericBoundaryLayer, 0)
tmp< DimensionedField< TypeR, GeoMesh, Field > > New(const tmp< DimensionedField< TypeR, GeoMesh, Field >> &tdf1, const word &name, const dimensionSet &dimensions)
dimensioned< Type > max(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const dimensionSet & dimVolumetricFlux
fluidMulticomponentThermo & thermo
void correct(const scalar CoNum)
Correct nAlphaSubCycles for the current Courant number.
void read(const dictionary &dict)
Read the alpha and MULES controls from dict.