57 solidificationMeltingSource,
70 Foam::fv::solidificationMeltingSource::Cp()
const 84 if (CpName_ ==
"CpRef")
86 scalar CpRef =
readScalar(coeffs_.lookup(
"CpRef"));
95 mesh_.time().timeName(),
107 extrapolatedCalculatedFvPatchScalarField::typeName
121 <<
"Unhandled thermo mode: " << thermoModeTypeNames_[mode_]
130 Foam::vector Foam::fv::solidificationMeltingSource::g()
const 136 return value.
value();
140 return coeffs_.lookup(
"g");
145 void Foam::fv::solidificationMeltingSource::update(
const volScalarField& Cp)
147 if (curTimeIndex_ == mesh_.time().timeIndex())
154 Info<<
type() <<
": " << name_ <<
" - updating phase indicator" <<
endl;
164 label celli = cells_[i];
166 scalar Tc = T[celli];
167 scalar Cpc = Cp[celli];
168 scalar alpha1New = alpha1_[celli] + relax_*Cpc*(Tc - Tmelt_)/L_;
170 alpha1_[celli] =
max(0,
min(alpha1New, 1));
171 deltaT_[i] = Tc - Tmelt_;
174 alpha1_.correctBoundaryConditions();
176 curTimeIndex_ = mesh_.time().timeIndex();
182 Foam::fv::solidificationMeltingSource::solidificationMeltingSource
184 const word& sourceName,
185 const word& modelType,
193 relax_(coeffs_.lookupOrDefault(
"relax", 0.9)),
194 mode_(thermoModeTypeNames_.read(coeffs_.lookup(
"thermoMode"))),
195 rhoRef_(
readScalar(coeffs_.lookup(
"rhoRef"))),
196 TName_(coeffs_.lookupOrDefault<
word>(
"T",
"T")),
197 CpName_(coeffs_.lookupOrDefault<
word>(
"Cp",
"Cp")),
198 UName_(coeffs_.lookupOrDefault<
word>(
"U",
"U")),
199 phiName_(coeffs_.lookupOrDefault<
word>(
"phi",
"phi")),
200 Cu_(coeffs_.lookupOrDefault<scalar>(
"Cu", 100000)),
201 q_(coeffs_.lookupOrDefault(
"q", 0.001)),
215 zeroGradientFvPatchScalarField::typeName
218 deltaT_(cells_.size(), 0)
220 fieldNames_.setSize(2);
221 fieldNames_[0] = UName_;
230 fieldNames_[1] = thermo.
he().
name();
235 fieldNames_[1] = TName_;
241 <<
"Unhandled thermo mode: " << thermoModeTypeNames_[mode_]
246 applied_.setSize(fieldNames_.size(),
false);
296 label celli = cells_[i];
298 scalar Vc = V[celli];
299 scalar alpha1c = alpha1_[celli];
301 scalar S = -Cu_*
sqr(1.0 - alpha1c)/(
pow3(alpha1c) + q_);
302 vector Sb = rhoRef_*g*beta_*deltaT_[i];
defineTypeNameAndDebug(option, 0)
#define forAll(list, i)
Loop across all elements in list.
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 word & name() const
Return name.
Abstract base-class for fluid and solid thermodynamic properties.
A list of keyword definitions, which are a keyword followed by any number of values (e...
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
static const NamedEnum< thermoMode, 2 > thermoModeTypeNames_
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const GeometricField< Type, fvPatchField, volMesh > & psi() const
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Ostream & endl(Ostream &os)
Add newline and flush stream.
addToRunTimeSelectionTable(option, fixedTemperatureConstraint, dictionary)
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
const Time & time() const
Return the top-level database.
Initialise the NamedEnum HashTable from the static list of names.
Macros for easy insertion into run-time selection tables.
virtual volScalarField & he()=0
Enthalpy/Internal energy [J/kg].
const word dictName() const
Return the local dictionary name (final part of scoped name)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
A class representing the concept of a GeometricField of 1 used to avoid unnecessary manipulations for...
A class for handling words, derived from string.
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
const Type & value() const
Return const reference to value.
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
errorManip< error > abort(error &err)
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
const dimensionedVector & g
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
virtual tmp< volScalarField > Cp() const =0
Heat capacity at constant pressure [J/kg/K].
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
fileName::Type type(const fileName &, const bool followLink=true)
Return the file type: DIRECTORY or FILE.
const dimensionSet dimEnergy
virtual void addSup(fvMatrix< scalar > &eqn, const label fieldi)
Add explicit contribution to enthalpy equation.
dimensionedScalar pow3(const dimensionedScalar &ds)
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Mesh data needed to do the Finite Volume discretisation.
A special matrix type and solver, designed for finite volume solutions of scalar equations.
Cell-set options abtract base class. Provides a base set of controls, e.g.:
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
A class for managing temporary objects.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...