28 #include "surfaceInterpolate.H"
65 calculatedFvPatchScalarField::typeName
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());
198 mesh.time().constant(),
211 referencePhaseName_(lookupOrDefault(
"referencePhase",
word::null)),
245 found(
"interfaceCompression")
249 subDict(
"interfaceCompression")
260 surfaceTensionCoefficientModels_
270 label movingPhasei = 0;
271 label stationaryPhasei = 0;
272 label thermalPhasei = 0;
273 label multicomponentPhasei = 0;
280 multicomponentPhasei += !phase.
pure();
288 stationaryPhasei = 0;
290 multicomponentPhasei = 0;
352 <<
"The phase system type entry - type - in "
362 "saturationTemperature",
363 "interfaceComposition",
364 "diffusiveMassTransfer"
370 modelEntriesString<< modelEntries[i];
371 if (i < modelEntries.size() - 2) modelEntriesString<<
", ";
372 if (i == modelEntries.size() - 2) modelEntriesString<<
" and ";
375 label warnOrError = 0;
378 if (!
found(modelEntries[i]))
continue;
387 if (warnOrError != 0)
389 msg <<
"Phase change model entries - "
390 << modelEntriesString.
str().c_str() <<
" - in "
392 <<
"are now specified as fvModels.";
394 if (warnOrError == 1)
399 if (warnOrError == 2)
429 {
"nCorrectors",
"nAlphaCorr"},
448 nAlphaSubCycles = ceil(nAlphaSubCyclesPtr->value(
CoNum));
458 label movingPhasei=1;
459 movingPhasei<movingPhaseModels_.size();
464 movingPhaseModels_[movingPhasei]
465 *movingPhaseModels_[movingPhasei].rho();
468 if (stationaryPhaseModels_.empty())
474 return rho/sumAlphaMoving();
485 label movingPhasei=1;
486 movingPhasei<movingPhaseModels_.size();
491 movingPhaseModels_[movingPhasei]
492 *movingPhaseModels_[movingPhasei].U();
495 if (stationaryPhaseModels_.empty())
501 return U/sumAlphaMoving();
509 if (surfaceTensionCoefficientModels_.found(key))
511 return surfaceTensionCoefficientModels_[key]->sigma();
517 surfaceTensionCoefficientModel::typeName +
":sigma",
528 if (surfaceTensionCoefficientModels_.found(key))
530 return surfaceTensionCoefficientModels_[key]->sigma(
patchi);
560 pos0(phases()[phasei] - 0.01)*
pos0(0.99 - phases()[phasei])
587 if (&phase2 != &phase1)
591 if (cAlphas_.found(interface))
593 tSurfaceTension.
ref() +=
603 return tSurfaceTension;
609 forAll(phaseModels_, phasei)
611 if (!phaseModels_[phasei].incompressible())
623 forAll(phaseModels_, phasei)
625 phaseModels_[phasei].correct();
635 forAll(movingPhaseModels_, movingPhasei)
637 phaseModel& phase = movingPhaseModels_[movingPhasei];
668 bool updateDpdt =
false;
670 forAll(phaseModels_, phasei)
672 phaseModels_[phasei].correctKinematics();
675 if (!updateDpdt && phaseModels_[phasei].
thermo().dpdt())
686 forAll(phaseModels_, phasei)
688 phaseModels_[phasei].correctThermo();
695 forAll(phaseModels_, phasei)
697 phaseModels_[phasei].correctReactions();
704 forAll(phaseModels_, phasei)
706 phaseModels_[phasei].correctSpecies();
713 forAll(phaseModels_, phasei)
715 phaseModels_[phasei].predictMomentumTransport();
722 forAll(phaseModels_, phasei)
724 phaseModels_[phasei].predictThermophysicalTransport();
731 forAll(phaseModels_, phasei)
733 phaseModels_[phasei].correctMomentumTransport();
740 forAll(phaseModels_, phasei)
742 phaseModels_[phasei].correctThermophysicalTransport();
749 if (mesh_.changing())
763 forAll(movingPhaseModels_, movingPhasei)
765 phaseModel& phase = movingPhaseModels_[movingPhasei];
772 MRF_.relative(mesh_.Sf().boundaryField() & UBf)
781 isA<fixedValueFvsPatchScalarField>(phiBf[
patchi])
782 && !isA<movingWallVelocityFvPatchVectorField>(UBf[
patchi])
783 && !isA<movingWallSlipVelocityFvPatchVectorField>(UBf[
patchi])
802 forAll(movingPhaseModels_, movingPhasei)
804 phaseModel& phase = movingPhaseModels_[movingPhasei];
806 MRF_.makeRelative(phase.
phiRef());
810 forAll(movingPhaseModels_, movingPhasei)
812 phaseModel& phase = movingPhaseModels_[movingPhasei];
819 if (Ubf[
patchi].fixesValue())
821 Ubf[
patchi].initEvaluate();
827 if (Ubf[
patchi].fixesValue())
836 correctBoundaryFlux();
840 forAll(movingPhaseModels_, movingPhasei)
842 phaseModel& phase = movingPhaseModels_[movingPhasei];
850 phi_ += alphafs[phasei]*(mesh_.Sf() & phase.
UfRef());
853 if (incompressible())
858 movingPhaseModels_[0].
U(),
898 MRF_.makeRelative(phi_);
901 setMixturePhi(alphafs, phi_);
911 forAll(phaseModels_, phasei)
913 readOK &= phaseModels_[phasei].read();
935 return vf/vf.
mesh().time().deltaT();
948 return sf/
sf.
mesh().time().deltaT();
#define forAll(list, i)
Loop across all elements in list.
const Mesh & mesh() const
Return mesh.
static autoPtr< Function1< Type > > New(const word &name, const Function1s::unitConversions &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,.
An STL-conforming hash table.
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
fileName relativeObjectPath() const
Return complete relativePath + object name.
const word & name() const
Return name.
static word groupName(Name name, const word &group)
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 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.
T lookupOrDefault(const word &, const T &, const bool writeDefault=writeOptionalEntries > 0) const
Find and return a T, if not found return the given default.
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.
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.
virtual bool read()
Read object.
Abstract base-class for interface surface-tension models which can be used when interface compression...
static const dimensionSet dimSigma
Coefficient dimensions.
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)
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)
void generateInterfacialModels(PtrList< phaseInterface > &interfaces, PtrList< ModelType > &models, const phaseSystem &fluid, const dictionary &dict, const wordHashSet &ignoreKeys, const phaseInterface &interface, const Args &... args)
errorManipArg< error, int > exit(error &err, const int errNo=1)
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.
const dimensionSet dimPressure
Ostream & endl(Ostream &os)
Add newline and flush stream.
const dimensionSet dimVolumetricFlux
const dimensionSet dimless
dimensioned< Type > average(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
SurfaceField< scalar > surfaceScalarField
tmp< volScalarField > byDt(const volScalarField &vf)
void mag(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
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.
void pow(LagrangianPatchField< typename powProduct< Type, r >::type > &f, const LagrangianPatchField< Type > &f1)
Foam::HashTable< ValueType, Foam::phaseInterfaceKey, Foam::phaseInterfaceKey::hash > generateInterfacialValues(const phaseSystem &fluid, const dictionary &dict, const wordHashSet &ignoreKeys=wordHashSet())
const dimensionSet dimDensity
defineTypeNameAndDebug(combustionModel, 0)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
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.