fractal.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) 2019-2026 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 
26 #include "fractal.H"
27 #include "populationBalanceModel.H"
29 #include "fvmDdt.H"
30 #include "fvmDiv.H"
31 #include "fvmSup.H"
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 namespace populationBalance
38 {
39 namespace shapeModels
40 {
43 }
44 }
45 }
46 
47 
48 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
49 
51 Foam::populationBalance::shapeModels::fractal::dColl(const label i) const
52 {
54 
55  tmp<volScalarField> tDColl
56  (
58  (
59  "dColl",
60  popBal_.mesh(),
62  )
63  );
64 
65  volScalarField& dColl = tDColl.ref();
66 
67  dColl =
68  6/kappas_[i]
69  *pow(popBal_.v(i)*pow3(kappas_[i])/(36*pi*alphaC(i)), 1/Df(i));
70 
71  return tDColl;
72 }
73 
74 
75 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
76 
78 (
79  const dictionary& dict,
80  const populationBalanceModel& popBal
81 )
82 :
84  Df_(Function1<scalar>::New("Df", {dimLength, dimless}, dict)),
85  alphaC_(Function1<scalar>::New("alphaC", {dimLength, dimless}, dict)),
86  kappas_(popBal.nGroups()),
87  dColls_(popBal.nGroups()),
88  Sus_(popBal.nGroups())
89 {
90  forAll(popBal_.fs(), i)
91  {
92  kappas_.set
93  (
94  i,
95  new volScalarField
96  (
98  (
99  "kappa",
100  i,
101  popBal_.phases()[i],
104  ),
106  (
107  "kappa",
108  i,
109  popBal_.phases()[i]
110  )
111  )
112  );
113 
114  dColls_.set
115  (
116  i,
117  new volScalarField
118  (
120  (
121  "dColl",
122  i,
123  popBal_.phases()[i]
124  ),
125  this->dColl(i)
126  )
127  );
128 
129  Sus_.set
130  (
131  i,
133  (
135  (
136  "kappa:Su",
137  i,
138  popBal_.phases()[i]
139  ),
140  popBal_.mesh(),
141  dimensionedScalar(kappas_[i].dimensions()/dimTime, Zero)
142  )
143  );
144  }
145 }
146 
147 
148 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
149 
151 {}
152 
153 
154 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
155 
158 {
159  return
161  (
162  "Df" + Foam::name(i),
163  dimless,
164  Df_->value(popBal_.dSph(i).value())
165  );
166 }
167 
168 
171 {
172  return
174  (
175  "alphaC" + Foam::name(i),
176  dimless,
177  alphaC_->value(popBal_.dSph(i).value())
178  );
179 }
180 
181 
184 {
185  return kappas_[i];
186 }
187 
188 
191 {
192  return Sus_[i];
193 }
194 
195 
197 {
198  forAll(popBal_.fs(), i)
199  {
200  const phaseModel& phase = popBal_.phases()[i];
201  const volScalarField& alpha = phase;
202  const volScalarField& rho = popBal_.phases()[i].rho();
203  const volScalarField& fi = popBal_.fs()[i];
204 
205  const volScalarField alphaFi
206  (
208  (
209  alpha.member() + fi.member().capitalise(),
210  alpha.group()
211  ),
212  alpha*fi
213  );
214 
215  const surfaceScalarField alphaFiPhi
216  (
218  (
219  alpha.member() + fi.member().capitalise() + "Phi",
220  alpha.group()
221  ),
222  max(fvc::interpolate(fi, "fi"), small)*phase.alphaPhi()
223  );
224 
225  fvScalarMatrix kappaiEqn
226  (
227  fvm::ddt(alpha, fi, kappas_[i])
228  + fvm::div(alphaFiPhi, kappas_[i])
229  ==
230  Sus_[i] + fvm::Sp(popBal_.Sp(i)*fi, kappas_[i])
231  + popBal_.expansionSu(i, kappas_)
232  + fvm::Sp(popBal_.expansionSp(i)*fi, kappas_[i])
233  + popBal_.modelSourceSu(i, kappas_)
234  + popBal_.fluid().fvModels().source(alphaFi, rho, kappas_[i])/rho
235  - correction
236  (
237  fvm::Sp
238  (
239  max(phase.residualAlpha() - alpha*fi, scalar(0))
240  /kappas_[i].mesh().time().deltaT(),
241  kappas_[i]
242  )
243  )
244  );
245 
246  kappaiEqn.relax();
247 
248  popBal_.fluid().fvConstraints().constrain(kappaiEqn);
249 
250  kappaiEqn.solve();
251 
252  popBal_.fluid().fvConstraints().constrain(kappas_[i]);
253 
254  // Bound kappa so that the surface-area-volume ratio is greater than
255  // that of spherical particles of this group, but less than that of the
256  // particles represented by the first group
257  kappas_[i] = min(max(kappas_[i], 6/popBal_.dSph(i)), 6/popBal_.dSph(0));
258 
259  kappas_[i].correctBoundaryConditions();
260  }
261 }
262 
263 
265 {
266  forAll(popBal_.fs(), i)
267  {
268  // Update the collisional diameter
269  dColls_[i] = dColl(i);
270  }
271 }
272 
273 
276 {
277  return kappas_[i]*popBal_.v(i);
278 }
279 
280 
283 {
284  return dColls_[i];
285 }
286 
287 
288 // ************************************************************************* //
#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...
Run-time selectable general function of one variable.
Definition: Function1.H:62
Generic GeometricField class.
static tmp< GeometricField< Type, GeoMesh, PrimitiveField > > New(const word &name, const Internal &, const PtrList< Patch > &, const HashPtrTable< Source > &=HashPtrTable< Source >())
Return a temporary field constructed from name,.
static word member(const word &name)
Return member (name without the extension)
Definition: IOobject.C:146
static word groupName(Name name, const word &group)
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvMatrix.H:118
void relax(const scalar alpha)
Relax matrix (for steady-state solution).
Definition: fvMatrix.C:602
SolverPerformance< Type > solve(const dictionary &)
Solve segregated or coupled returning the solution statistics.
Definition: fvMatrixSolve.C:58
const dimensionedScalar & residualAlpha() const
Return the residual phase-fraction for given phase.
Definition: phaseModel.C:116
virtual tmp< surfaceScalarField > alphaPhi() const =0
Return the volumetric flux of the phase.
Model for tracking the evolution of a dispersed phase size distribution due to coalescence (synonymou...
const dimensionedScalar & v(const label i) const
Access the representative volumes diameters of a group.
static tmp< volScalarField > groupField(const word &name, const label i, const phaseModel &phase)
Read and return a group-associated field.
static IOobject groupFieldIo(const word &name, const label i, const phaseModel &phase, const IOobject::readOption r=IOobject::NO_READ, const IOobject::writeOption w=IOobject::NO_WRITE, const bool registerObject=true)
Return IO for a group-associated field.
const fvMesh & mesh() const
Return reference to the mesh.
Base class for modelling evolution of secondary representative properties of a size class....
Base class for modelling the shape of the particles belonging to a size class through alternative dia...
Definition: shapeModel.H:59
const populationBalanceModel & popBal_
Reference to the population balance model.
Definition: shapeModel.H:65
Class for modelling the shape of particle aggregates using the concept of fractal geometry....
Definition: fractal.H:94
virtual volScalarField::Internal & src(const label i)
Access a secondary property source.
Definition: fractal.C:190
virtual void correct()
Correct the shape.
Definition: fractal.C:264
dimensionedScalar alphaC(const label i) const
Return the scaling prefactor for a group.
Definition: fractal.C:170
fractal(const dictionary &dict, const populationBalanceModel &popBal)
Construct from a dictionary.
Definition: fractal.C:78
dimensionedScalar Df(const label i) const
Return the fractal dimension for a group.
Definition: fractal.C:157
virtual const volScalarField & fld(const label i) const
Return a reference to a secondary property field.
Definition: fractal.C:183
virtual tmp< volScalarField > d(const label i) const
Return the representative diameter of a group.
Definition: fractal.C:282
virtual tmp< volScalarField > a(const label i) const
Return the representative surface area of a group.
Definition: fractal.C:275
virtual void solve()
Solve equations.
Definition: fractal.C:196
A class for managing temporary objects.
Definition: tmp.H:55
word capitalise() const
Return the word with the first letter capitalised.
Definition: wordI.H:131
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
Calculate the matrix for the first temporal derivative.
Calculate the matrix for the divergence of the given field and flux.
Calculate the matrix for implicit and explicit sources.
rho
Definition: pEqn.H:1
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
const dimensionSet time
static tmp< SurfaceField< Type > > interpolate(const VolField< Type > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
tmp< fvMatrix< Type > > div(const surfaceScalarField &flux, const VolField< Type > &vf, const word &name)
Definition: fvmDiv.C:48
tmp< fvMatrix< Type > > Sp(const volScalarField::Internal &, const VolField< Type > &)
tmp< fvMatrix< Type > > ddt(const VolField< Type > &vf)
Definition: fvmDdt.C:46
addToRunTimeSelectionTable(shapeModel, fractal, dictionary)
Namespace for OpenFOAM.
static const zero Zero
Definition: zero.H:97
const dimensionSet & dimless
Definition: dimensions.C:138
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
VolField< scalar > volScalarField
Definition: volFieldsFwd.H:62
dimensioned< Type > min(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix.
void pow3(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
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)
tmp< DimensionedField< TypeR, GeoMesh, Field > > New(const tmp< DimensionedField< TypeR, GeoMesh, Field >> &tdf1, const word &name, const dimensionSet &dimensions)
dimensioned< Type > max(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
dictionary dict