43 void Foam::fv::phaseChange::readCoeffs(
const dictionary&
dict)
45 energySemiImplicit_ =
dict.lookup<
bool>(
"energySemiImplicit");
57 const bool haveSpecie =
dict.found(
"specie");
59 if (required && !haveSpecie)
79 const bool haveSpecie =
dict.found(
"specie");
80 const bool haveSpecies =
dict.found(
"species");
82 if (haveSpecie && haveSpecies)
85 <<
"Both keywords specie and species "
86 <<
" are defined in dictionary " <<
dict.name()
90 if (required && !haveSpecie && !haveSpecies)
93 <<
"Neither keywords specie nor species "
94 <<
" are defined in dictionary " <<
dict.name()
109 if (species() != readSpecie(
dict,
false))
112 <<
"Cannot change the specie of a " <<
type() <<
" model "
120 if (species() != readSpecies(
dict,
false))
123 <<
"Cannot change the species of a " <<
type() <<
" model "
132 const word& modelType,
146 if (mcThermos.
valid()[i])
150 specieis_[mDoti][i] = mcThermos[i].species()[species[mDoti]];
159 if (mcThermos.
either() && species_.empty())
162 <<
"Mixture transfer specified by model " <<
name <<
" of type "
163 << modelType <<
" for two phases " << phaseNames().first()
164 <<
" and " << phaseNames().second() <<
" but ";
168 <<
"both phases have"
170 <<
"phase " << phaseNames()[mcThermos.
valid().
second()] <<
" has";
178 if (!mcThermos.
either() && species_.size())
181 <<
"Specie transfer specified by model " <<
name
182 <<
" of type " << modelType <<
" for two pure phases "
183 << phaseNames().first() <<
" and " << phaseNames().second()
188 if (!mcThermos.
both() && species_.size() > 1)
191 <<
"Multi-specie transfer specified by model " <<
name
192 <<
" of type " << modelType <<
" for phases "
193 << phaseNames().first() <<
" and " << phaseNames().second()
194 <<
" but phase " << phaseNames()[mcThermos.
valid().
first()]
202 setSpecies(
name(),
type(), species);
208 if (this->species() != species)
211 <<
"Cannot change the species of a " <<
type() <<
" model "
219 for (
label i = 0; i < 2; ++ i)
221 if (isA<fluidThermo>(thermos()[i]))
223 return refCast<const fluidThermo>(thermos()[i]).p();
245 tvf->internalFieldRef() = tvif();
246 tvf->correctBoundaryConditions();
272 const word& modelType,
279 thermos_(
mesh, phaseNames()),
283 energySemiImplicit_(false)
296 const bool firstRequired,
297 const bool secondRequired
303 {firstRequired, secondRequired},
313 const bool firstRequired,
314 const bool secondRequired
320 {firstRequired, secondRequired},
330 const bool firstRequired,
331 const bool secondRequired
337 {firstRequired, secondRequired},
339 "fluid-multicomponent"
346 static const labelPair noSpecieis(-1, -1);
350 if (species().empty())
354 else if (species().size() == 1)
361 <<
"Requested mixture/single-specie indices from multi-specie "
366 return specieis_[mDoti];
392 : mDot[i] < 0 ? T2[i]
406 return kappa2/(kappa1 + kappa2);
415 return L(this->Tchange(), mDoti);
428 const labelPair specieis = this->specieis(mDoti);
434 for (
label j = 0; j < 2; ++ j)
438 ? thermos()[j].ha(
p, Tchange)
439 : mcThermos[j].hai(specieis[j],
p, Tchange);
457 const labelPair specieis = this->specieis(mDoti);
463 for (
label j = 0; j < 2; ++ j)
467 ? thermos()[j].ha(Tchange,
patchi)
468 : mcThermos[j].hai(specieis[j],
p, Tchange);
478 if (species().empty())
481 <<
"Mixture phase change rate not defined by model of type "
495 tmDot.
ref() += mDot(mDoti);
512 if (mDoti == 0 && species().size() == 1)
517 if (species().size() > 1)
520 <<
"Specie phase change rate not defined by model of type "
536 const label i = index(phaseNames(),
alpha.group());
543 if (index(heNames(), heOrYi.
name()) != -1)
550 label mDoti = species().empty() ? -1 : 0;
551 mDoti < species().size();
555 const labelPair specieis = this->specieis(mDoti);
564 ? thermos()[i].hs(
p, tTchange())
565 : mcThermos[i].hsi(specieis[i],
p, tTchange())
569 if (energySemiImplicit_)
571 eqn += -
fvm::SuSp(-
s*tmDot(), heOrYi) -
s*tmDot()*heOrYi;
576 (i == 0 ? 1 - Lfraction() : Lfraction())
578 *L(tTchange(), mDoti);
586 if (mcThermos.
valid()[i] && mcThermos[i].containsSpecie(specieName))
589 if (!species().found(specieName))
return;
592 eqn +=
s*mDot(species()[specieName]);
606 readCoeffs(coeffs(
dict));
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
static tmp< DimensionedField< Type, GeoMesh, PrimitiveField > > New(const word &name, const GeoMesh &mesh, const dimensionSet &, const PrimitiveField< Type > &)
Return a temporary field constructed from name, mesh,.
tmp< DimensionedField< Type, GeoMesh, Field > > T() const
Return the field transpose (only defined for second rank tensors)
Generic GeometricField class.
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,.
static word member(const word &name)
Return member (name without the extension)
const word & name() const
Return name.
void size(const label)
Override size to be inconsistent with allocated storage.
const Type & second() const
Return second.
const Type & first() const
Return first.
Class containing a pair of thermo references. Handles down-casting to more specific thermo types by c...
const Pair< bool > & valid() const
Access the validity flags.
bool either() const
Return if either validity flag is set.
ThermoRefPair< OtherThermoType > thermos() const
Cast to a different thermo type, with error checking.
bool both() const
Return if both validity flags are set.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Base-class for multi-component fluid thermodynamic properties.
Base-class for fluid thermodynamic properties.
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Mesh data needed to do the Finite Volume discretisation.
static const dictionary & coeffs(const word &modelType, const dictionary &)
Return the coefficients sub-dictionary for a given model type.
const word & name() const
Return const access to the source name.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Base class for mass transfers between phases.
virtual bool read(const dictionary &dict)
Read source dictionary.
virtual void addSup(fvMatrix< scalar > &eqn) const
Add a source term to a field-less proxy equation.
Base class for phase change models.
void reReadSpecies(const dictionary &dict) const
Re-read the names of the transferring species.
const labelPair & specieis(const label mDoti=-1) const
Return the indices of the transferring specie in the two.
wordList readSpecie(const dictionary &dict, const bool required) const
Read the names of the transferring specie.
const ThermoRefPair< multicomponentThermo > multicomponentThermos(const bool, const bool) const
Return the multicomponent thermo references.
virtual tmp< DimensionedField< scalar, fvMesh > > Lfraction() const
Return the fraction of the latent heat that is transferred into.
const ThermoRefPair< fluidThermo > fluidThermos(const bool, const bool) const
Return the fluid thermo references.
void reReadSpecie(const dictionary &dict) const
Re-read the names of the transferring specie.
wordList readSpecies(const dictionary &dict, const bool required) const
Read the names of the transferring species.
static tmp< DimensionedField< scalar, fvMesh > > vfToVif(const tmp< volScalarField > &tvf)
Remove the boundary field from the given geometric field.
static tmp< volScalarField > vifToVf(const tmp< DimensionedField< scalar, fvMesh >> &tvif)
Add a boundary field to the given internal field.
virtual tmp< DimensionedField< scalar, fvMesh > > mDot() const
Return the total phase change rate.
virtual bool read(const dictionary &dict)
Read source dictionary.
void addSup(const volScalarField &alpha, const volScalarField &rho, const volScalarField &heOrYi, fvMatrix< scalar > &eqn) const
Override the energy equation to add the phase change heat, or.
void setSpecies(const word &name, const word &modelType, const wordList &species)
Set the names of the transferring species.
const ThermoRefPair< fluidMulticomponentThermo > fluidMulticomponentThermos(const bool, const bool) const
Return the fluid multicomponent thermo references.
void reSetSpecies(const wordList &species)
Re-set the names of the transferring species.
tmp< DimensionedField< scalar, fvMesh > > L(const label mDoti=-1) const
Return the latent heat.
const hashedWordList & species() const
Return the names of the transferring species. Empty if neither.
const volScalarField & p() const
Access the pressure field.
virtual tmp< DimensionedField< scalar, fvMesh > > Tchange() const
Return the temperature at which the phases are considered to be.
phaseChange(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict, const wordList &species)
Construct from explicit source name and mesh.
Base-class for multi-component thermodynamic properties.
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type and name.
A class for managing temporary objects.
T * ptr() const
Return tmp pointer for reuse.
void clear() const
If object pointer points to valid object:
T & ref() const
Return non-const reference or generate a fatal error.
A class for handling words, derived from string.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), lagrangian::cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
defineTypeNameAndDebug(bound, 0)
tmp< fvMatrix< Type > > SuSp(const volScalarField::Internal &, const VolField< Type > &)
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< word > wordList
A List of words.
dimensionedScalar sign(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.
labelList second(const UList< labelPair > &p)
labelList first(const UList< labelPair > &p)
bool notNull(const T &t)
Return true if t is not a reference to the nullObject of type T.
const dimensionSet & dimTime
const dimensionSet & dimDensity
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
const dimensionSet & dimTemperature
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.