KochFriedlanderSintering.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2024-2025 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
27 #include "fvmSup.H"
28 #include "fractal.H"
30 #include "volFieldsFwd.H"
31 
32 // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 namespace fv
37 {
40 }
41 }
42 
43 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
44 
45 Foam::dimensionSet Foam::fv::KochFriedlanderSintering::CsDims() const
46 {
47  return pow(dimLength, -n_)*pow(dimTemperature, -m_)*dimTime;
48 }
49 
50 
51 void Foam::fv::KochFriedlanderSintering::readCoeffs(const dictionary& dict)
52 {
53  if (dict.lookup<word>("populationBalance") != popBal_.name())
54  {
56  << "Cannot change the population balance of a " << type()
57  << " model at run time" << exit(FatalIOError);
58  }
59 
60  n_ = dict.lookup<scalar>("n");
61  m_ = dict.lookup<scalar>("m");
62  Cs_.read(dict, CsDims());
63  Ta_.read(dict);
64  dpMin_.readIfPresent(dict);
65 }
66 
67 
68 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
69 
71 (
72  const word& name,
73  const word& modelType,
74  const fvMesh& mesh,
75  const dictionary& dict
76 )
77 :
78  fvModel(name, modelType, mesh, dict),
79  popBal_
80  (
81  mesh().lookupObject<populationBalanceModel>
82  (
83  coeffs(dict).lookup("populationBalance")
84  )
85  ),
86  n_(coeffs(dict).lookup<scalar>("n")),
87  m_(coeffs(dict).lookup<scalar>("m")),
88  Cs_("Cs", CsDims(), coeffs(dict)),
89  Ta_("Ta", dimTemperature, coeffs(dict)),
90  dpMin_("dpMin", dimLength, coeffs(dict), scalar(0))
91 {
92  readCoeffs(coeffs(dict));
93 
94  const populationBalance::shapeModel& shape = popBal_.shape();
95 
96  if (!isA<populationBalance::shapeModels::fractal>(shape)) return;
97 
99  refCast<const populationBalance::shapeModels::fractal>(shape);
100 
101  forAll(popBal_.fs(), i)
102  {
103  kappaNameToGroupIndices_.insert(fractal.fld(i).name(), i);
104  }
105 }
106 
107 
108 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
109 
111 (
112  const word& fieldName
113 ) const
114 {
115  return kappaNameToGroupIndices_.found(fieldName);
116 }
117 
118 
121 (
123 ) const
124 {
125  const label i = kappaNameToGroupIndices_[kappa.name()];
126 
127  const volScalarField::Internal& T = popBal_.phases()[i].thermo().T();
128 
129  const volScalarField::Internal dp(6/max(6/popBal_.dSph(i), kappa));
130 
131  return Cs_*pow(dp, n_)*pow(T, m_)*exp(Ta_/T*(1 - dpMin_/dp));
132 }
133 
134 
136 (
137  const volScalarField& alphaFi,
138  const volScalarField& rho,
139  const volScalarField& kappa,
140  fvMatrix<scalar>& eqn
141 ) const
142 {
143  const label i = kappaNameToGroupIndices_[kappa.name()];
144 
145  const volScalarField::Internal R(alphaFi()*rho()/tau(kappa));
146 
147  eqn += R*6/popBal_.dSph(i) - fvm::Sp(R, kappa);
148 }
149 
150 
152 {
153  return true;
154 }
155 
156 
158 {}
159 
160 
162 {}
163 
164 
166 {}
167 
168 
170 {
171  if (fvModel::read(dict))
172  {
173  readCoeffs(coeffs(dict));
174  return true;
175  }
176  else
177  {
178  return false;
179  }
180 }
181 
182 
183 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:449
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...
Generic GeometricField class.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
Definition: HashTableI.H:80
const word & name() const
Return name.
Definition: IOobject.H:307
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Dimension set for the base types.
Definition: dimensionSet.H:125
const word & name() const
Return const reference to name.
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvMatrix.H:118
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:98
Finite volume model abstract base class.
Definition: fvModel.H:60
static const dictionary & coeffs(const word &modelType, const dictionary &)
Return the coefficients sub-dictionary for a given model type.
Definition: fvModelI.H:31
virtual bool read(const dictionary &dict)
Read source dictionary.
Definition: fvModel.C:196
Sintering model of Koch and Friedlander (1990). The characteristic time for sintering is given by.
virtual bool movePoints()
Update for mesh motion.
virtual tmp< volScalarField::Internal > tau(const volScalarField::Internal &kappa) const
Return the characteristic time for sintering.
void addSup(const volScalarField &alphaFi, const volScalarField &rho, const volScalarField &kappa, fvMatrix< scalar > &eqn) const
Add a source term to the surface-area-volume-ratio equation.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
KochFriedlanderSintering(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from explicit source name and mesh.
virtual bool read(const dictionary &dict)
Read source dictionary.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
virtual bool addsSupToField(const word &fieldName) const
Return true if the fvModel adds a source term to the given.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Model for tracking the evolution of a dispersed phase size distribution due to coalescence (synonymou...
const populationBalance::shapeModel & shape() const
Access the shape model.
const PtrList< volScalarField > & fs() const
Access the group fractions.
Base class for modelling the shape of the particles belonging to a size class through alternative dia...
Definition: shapeModel.H:59
Class for modelling the shape of particle aggregates using the concept of fractal geometry....
Definition: fractal.H:94
virtual const volScalarField & fld(const label i) const
Return a reference to a secondary property field.
Definition: fractal.C:183
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:63
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:346
const vector tau
Calculate the matrix for implicit and explicit sources.
rho
Definition: pEqn.H:1
const dimensionedScalar kappa
Coulomb constant: default SI units: [N.m2/C2].
addToRunTimeSelectionTable(fvConstraint, bound, dictionary)
defineTypeNameAndDebug(bound, 0)
tmp< fvMatrix< Type > > Sp(const volScalarField::Internal &, const VolField< Type > &)
const unitSet & lookup(const word &unitName)
Lookup and return the named unit from the table.
Definition: units.C:346
Namespace for OpenFOAM.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
dimensionedScalar exp(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.
Definition: label.H:59
const dimensionSet & dimLength
Definition: dimensions.C:141
const dimensionSet & dimTime
Definition: dimensions.C:142
IOerror FatalIOError
static scalar R(const scalar a, const scalar x)
Definition: invIncGamma.C:102
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
tmp< DimensionedField< typename powProduct< Type, r >::type, GeoMesh, Field > > pow(const DimensionedField< Type, GeoMesh, PrimitiveField > &df, typename powProduct< Type, r >::type)
void T(GeometricField< Type, GeoMesh, PrimitiveField1 > &gf, const GeometricField< Type, GeoMesh, PrimitiveField2 > &gf1)
const dimensionSet & dimTemperature
Definition: dimensions.C:143
dimensioned< Type > max(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
labelList fv(nPoints)
dictionary dict