57 solidificationMeltingSource,
70 Foam::fv::solidificationMeltingSource::Cp()
const 84 if (CpName_ ==
"CpRef")
86 scalar CpRef =
readScalar(coeffs_.lookup(
"CpRef"));
97 extrapolatedCalculatedFvPatchScalarField::typeName
110 <<
"Unhandled thermo mode: " << thermoModeTypeNames_[mode_]
119 Foam::vector Foam::fv::solidificationMeltingSource::g()
const 125 return value.
value();
129 return coeffs_.lookup(
"g");
134 void Foam::fv::solidificationMeltingSource::update(
const volScalarField& Cp)
136 if (curTimeIndex_ == mesh_.time().timeIndex())
143 Info<<
type() <<
": " << name_ <<
" - updating phase indicator" <<
endl;
153 const label celli = cells_[i];
155 const scalar Tc = T[celli];
156 const scalar Cpc = Cp[celli];
157 const scalar alpha1New =
166 + (Tliq_ - Tsol_)*(alpha1_[celli] - alpha1e_)/(1 - alpha1e_)
170 alpha1_[celli] =
max(0,
min(alpha1New, 1));
177 + (Tliq_ - Tsol_)*(alpha1_[celli] - alpha1e_)/(1 - alpha1e_)
181 alpha1_.correctBoundaryConditions();
183 curTimeIndex_ = mesh_.time().timeIndex();
191 const word& sourceName,
192 const word& modelType,
199 Tliq_(coeffs_.lookupOrDefault(
"Tliq", Tsol_)),
200 alpha1e_(coeffs_.lookupOrDefault(
"alpha1e", 0.0)),
202 relax_(coeffs_.lookupOrDefault(
"relax", 0.9)),
203 mode_(thermoModeTypeNames_.read(coeffs_.lookup(
"thermoMode"))),
204 rhoRef_(
readScalar(coeffs_.lookup(
"rhoRef"))),
205 TName_(coeffs_.lookupOrDefault<
word>(
"T",
"T")),
206 CpName_(coeffs_.lookupOrDefault<
word>(
"Cp",
"Cp")),
207 UName_(coeffs_.lookupOrDefault<
word>(
"U",
"U")),
208 phiName_(coeffs_.lookupOrDefault<
word>(
"phi",
"phi")),
209 Cu_(coeffs_.lookupOrDefault<scalar>(
"Cu", 100000)),
210 q_(coeffs_.lookupOrDefault(
"q", 0.001)),
224 zeroGradientFvPatchScalarField::typeName
227 deltaT_(cells_.size(), 0)
229 fieldNames_.setSize(2);
230 fieldNames_[0] = UName_;
239 fieldNames_[1] = thermo.
he().
name();
244 fieldNames_[1] = TName_;
250 <<
"Unhandled thermo mode: " << thermoModeTypeNames_[mode_]
255 applied_.setSize(fieldNames_.size(),
false);
305 const label celli = cells_[i];
307 const scalar Vc = V[celli];
308 const scalar alpha1c = alpha1_[celli];
310 const scalar S = -Cu_*
sqr(1.0 - alpha1c)/(
pow3(alpha1c) + q_);
311 const 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.
rhoReactionThermo & thermo
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.
solidificationMeltingSource(const word &sourceName, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from explicit source name and mesh.
virtual volScalarField & he()=0
Enthalpy/Internal energy [J/kg].
const word dictName() const
Return the local dictionary name (final part of scoped name)
static tmp< GeometricField< scalar, fvPatchField, volMesh > > New(const word &name, const Mesh &, const dimensionSet &, const word &patchFieldType=fvPatchField< scalar >::calculatedType())
Return a temporary field constructed from name, mesh, dimensionSet.
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 successful.
errorManip< error > abort(error &err)
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 > &)
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.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
scalar Cp(const scalar p, const scalar T) const
A special matrix type and solver, designed for finite volume solutions of scalar equations.
Cell-set options abstract 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.
const dimensionedVector & g
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...