57 solidificationMeltingSource,
69 void Foam::fv::solidificationMeltingSource::readCoeffs()
71 Tsol_ = coeffs().lookup<scalar>(
"Tsol");
72 Tliq_ = coeffs().lookupOrDefault<scalar>(
"Tliq", Tsol_);
73 alpha1e_ = coeffs().lookupOrDefault<scalar>(
"alpha1e", 0.0);
74 L_ = coeffs().lookup<scalar>(
"L");
76 relax_ = coeffs().lookupOrDefault(
"relax", 0.9);
78 mode_ = thermoModeTypeNames_.read(coeffs().
lookup(
"thermoMode"));
80 rhoRef_ = coeffs().lookup<scalar>(
"rhoRef");
81 TName_ = coeffs().lookupOrDefault<
word>(
"T",
"T");
82 CpName_ = coeffs().lookupOrDefault<
word>(
"Cp",
"Cp");
83 UName_ = coeffs().lookupOrDefault<
word>(
"U",
"U");
84 phiName_ = coeffs().lookupOrDefault<
word>(
"phi",
"phi");
86 Cu_ = coeffs().lookupOrDefault<scalar>(
"Cu", 100000);
87 q_ = coeffs().lookupOrDefault(
"q", 0.001);
89 beta_ = coeffs().lookup<scalar>(
"beta");
94 Foam::fv::solidificationMeltingSource::Cp()
const 108 if (CpName_ ==
"CpRef")
110 scalar CpRef = coeffs().lookup<scalar>(
"CpRef");
121 extrapolatedCalculatedFvPatchScalarField::typeName
134 <<
"Unhandled thermo mode: " << thermoModeTypeNames_[mode_]
143 Foam::vector Foam::fv::solidificationMeltingSource::g()
const 145 if (
mesh().foundObject<uniformDimensionedVectorField>(
"g"))
149 return value.
value();
153 return coeffs().lookup(
"g");
158 void Foam::fv::solidificationMeltingSource::update
171 <<
" - updating phase indicator" <<
endl;
183 const label celli = cells[i];
185 const scalar Tc = T[celli];
186 const scalar Cpc = Cp[celli];
187 const scalar alpha1New =
196 + (Tliq_ - Tsol_)*(alpha1_[celli] - alpha1e_)/(1 - alpha1e_)
200 alpha1_[celli] =
max(0,
min(alpha1New, 1));
207 + (Tliq_ - Tsol_)*(alpha1_[celli] - alpha1e_)/(1 - alpha1e_)
211 alpha1_.correctBoundaryConditions();
213 curTimeIndex_ =
mesh().time().timeIndex();
222 const word& modelType,
227 fvModel(name, modelType, dict, mesh),
228 set_(coeffs(), mesh),
247 this->
name() +
":alpha1",
255 zeroGradientFvPatchScalarField::typeName
258 deltaT_(set_.cells().size(), 0)
290 const word& fieldName
301 const word& fieldName
311 const word& fieldName
333 const label celli = cells[i];
335 const scalar Vc = V[celli];
336 const scalar alpha1c = alpha1_[celli];
338 const scalar
S = -Cu_*
sqr(1.0 - alpha1c)/(
pow3(alpha1c) + q_);
339 const vector Sb = rhoRef_*g*beta_*deltaT_[i];
351 const word& fieldName
355 addSup(eqn, fieldName);
371 set_.topoChange(map);
386 set_.distribute(map);
defineTypeNameAndDebug(fixedTemperatureConstraint, 0)
#define forAll(list, i)
Loop across all elements in list.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
const word & name() const
Return name.
fluidReactionThermo & thermo
Base-class for fluid and solid thermodynamic properties.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
A list of keyword definitions, which are a keyword followed by any number of values (e...
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)
virtual bool read(const dictionary &dict)
Read source dictionary.
static tmp< GeometricField< scalar, fvPatchField, volMesh > > New(const word &name, const Internal &, const PtrList< fvPatchField< scalar >> &)
Return a temporary field constructed from name,.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Finite volume model abstract base class.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
const dimensionSet dimless
solidificationMeltingSource(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from explicit source name and mesh.
static const List< T > & null()
Return a null List.
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].
virtual const volScalarField & Cp() const =0
Heat capacity at constant pressure [J/kg/K].
stressControl lookup("compactNormalStress") >> compactNormalStress
A class representing the concept of a GeometricField of 1 used to avoid unnecessary manipulations for...
static word timeName(const scalar, const int precision=curPrecision_)
Return time name of given scalar time.
A class for handling words, derived from string.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
tmp< fvMatrix< Type > > S(const Pair< tmp< volScalarField::Internal >> &, const GeometricField< Type, fvPatchField, volMesh > &)
const Type & value() const
Return const reference to value.
static const word null
An empty word.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
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.
errorManip< error > abort(error &err)
virtual bool movePoints()
Update for mesh motion.
virtual bool read(const dictionary &dict)
Read source dictionary.
const dimensionSet dimEnergy
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
const dimensionSet dimMass
word name(const complex &)
Return a string representation of a complex.
const tmp< volScalarField::Internal > & Sp
addToRunTimeSelectionTable(fvConstraint, fixedTemperatureConstraint, dictionary)
List< word > wordList
A List of words.
dimensionedScalar pow3(const dimensionedScalar &ds)
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.
virtual void addSup(fvMatrix< scalar > &eqn, const word &fieldName) const
Add explicit contribution to enthalpy equation.
const tmp< volScalarField::Internal > & Su
A class for managing temporary objects.
const dimensionedVector & g
Class containing mesh-to-mesh mapping information.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
const dimensionSet dimTemperature
virtual wordList addSupFields() const
Return the list of fields for which the fvModel adds source term.