56 solidificationMeltingSource,
69 Foam::fv::solidificationMeltingSource::Cp()
const 83 if (CpName_ ==
"CpRef")
85 scalar CpRef =
readScalar(coeffs_.lookup(
"CpRef"));
94 mesh_.time().timeName(),
106 zeroGradientFvPatchScalarField::typeName
121 "Foam::tmp<Foam::volScalarField> " 122 "Foam::fv::solidificationMeltingSource::Cp() const" 124 <<
"Unhandled thermo mode: " << thermoModeTypeNames_[mode_]
133 Foam::vector Foam::fv::solidificationMeltingSource::g()
const 139 return value.
value();
143 return coeffs_.lookup(
"g");
148 void Foam::fv::solidificationMeltingSource::update(
const volScalarField& Cp)
150 if (curTimeIndex_ == mesh_.time().timeIndex())
157 Info<<
type() <<
": " << name_ <<
" - updating phase indicator" <<
endl;
167 label cellI = cells_[i];
169 scalar Tc = T[cellI];
170 scalar Cpc = Cp[cellI];
171 scalar alpha1New = alpha1_[cellI] + relax_*Cpc*(Tc - Tmelt_)/L_;
173 alpha1_[cellI] =
max(0,
min(alpha1New, 1));
174 deltaT_[i] = Tc - Tmelt_;
177 alpha1_.correctBoundaryConditions();
179 curTimeIndex_ = mesh_.time().timeIndex();
185 Foam::fv::solidificationMeltingSource::solidificationMeltingSource
187 const word& sourceName,
188 const word& modelType,
196 relax_(coeffs_.lookupOrDefault(
"relax", 0.9)),
197 mode_(thermoModeTypeNames_.read(coeffs_.lookup(
"thermoMode"))),
198 rhoRef_(
readScalar(coeffs_.lookup(
"rhoRef"))),
199 TName_(coeffs_.lookupOrDefault<
word>(
"TName",
"T")),
200 CpName_(coeffs_.lookupOrDefault<
word>(
"CpName",
"Cp")),
201 UName_(coeffs_.lookupOrDefault<
word>(
"UName",
"U")),
202 phiName_(coeffs_.lookupOrDefault<
word>(
"phiName",
"phi")),
203 Cu_(coeffs_.lookupOrDefault<scalar>(
"Cu", 100000)),
204 q_(coeffs_.lookupOrDefault(
"q", 0.001)),
218 zeroGradientFvPatchScalarField::typeName
221 deltaT_(cells_.size(), 0)
223 fieldNames_.setSize(2);
224 fieldNames_[0] = UName_;
233 fieldNames_[1] = thermo.
he().
name();
238 fieldNames_[1] = TName_;
245 "fv::solidificationMeltingSource::solidificationMeltingSource" 246 ) <<
"Unhandled thermo mode: " << thermoModeTypeNames_[mode_]
251 applied_.setSize(2,
false);
301 label cellI = cells_[i];
303 scalar Vc = V[cellI];
304 scalar alpha1c = alpha1_[cellI];
306 scalar S = -Cu_*
sqr(1.0 - alpha1c)/(
pow3(alpha1c) + q_);
307 vector Sb = rhoRef_*g*beta_*deltaT_[i];
defineTypeNameAndDebug(cellSetOption, 0)
Cell-set options abtract base class. Provides a base set of controls, e.g.
dimensionedScalar pow3(const dimensionedScalar &ds)
Mesh data needed to do the Finite Volume discretisation.
A class representing the concept of a GeometricField of 1 used to avoid unnecessary manipulations for...
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Abstract base-class for fluid and solid thermodynamic properties.
A class for handling words, derived from string.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
tmp< GeometricField< Type, fvPatchField, volMesh > > Sp(const volScalarField &sp, const GeometricField< Type, fvPatchField, volMesh > &vf)
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
const dimensionSet dimEnergy
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.
A list of keyword definitions, which are a keyword followed by any number of values (e...
virtual tmp< volScalarField > Cp() const =0
Heat capacity at constant pressure [J/kg/K].
tmp< GeometricField< Type, fvPatchField, volMesh > > Su(const GeometricField< Type, fvPatchField, volMesh > &su, const GeometricField< Type, fvPatchField, volMesh > &vf)
const Time & time() const
Return the top-level database.
const GeometricField< Type, fvPatchField, volMesh > & psi() const
Ostream & endl(Ostream &os)
Add newline and flush stream.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
GeometricField< scalar, fvPatchField, volMesh > volScalarField
addToRunTimeSelectionTable(option, fixedTemperatureConstraint, dictionary)
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
Macros for easy insertion into run-time selection tables.
errorManip< error > abort(error &err)
const word & name() const
Return name.
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Initialise the NamedEnum HashTable from the static list of names.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Dimensioned<Type> registered with the database as a registered IOobject which has the functionality o...
const dimensionedVector & g
static const NamedEnum< thermoMode, 2 > thermoModeTypeNames_
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
const word dictName() const
Return the local dictionary name (final part of scoped name)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
virtual void addSup(fvMatrix< scalar > &eqn, const label fieldI)
Add explicit contribution to enthalpy equation.
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
A class for managing temporary objects.
const Type & value() const
Return const reference to value.
A special matrix type and solver, designed for finite volume solutions of scalar equations.
virtual volScalarField & he()=0
Enthalpy/Internal energy [J/kg].