growthSecondaryPropertyFvScalarFieldSource.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 "populationBalanceModel.H"
28 
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 
33 (
35  const dictionary& dict
36 )
37 :
40 {}
41 
42 
45 (
48 )
49 :
50  growthFvScalarFieldSource(field, iF),
52 {}
53 
54 
55 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
56 
59 (
60  const fvSource& model,
62 ) const
63 {
64  const diameterModels::sizeGroup& fi = this->fi();
65 
66  return fi.sources()[model.name()].internalCoeff(model, source)*fi;
67 }
68 
69 
72 (
73  const fvSource& model
74 ) const
75 {
76  const diameterModels::sizeGroup& fi = this->fi();
77  const UPtrList<diameterModels::sizeGroup>& popBalFis =
78  fi.group().popBal().sizeGroups();
79 
81  refCast<const growthFvScalarFieldSource>
82  (
83  fi.sources()[model.name()]
84  ).sourceCoeffs(model);
85 
87 
88  if (fi.i() != 0)
89  {
90  tsourceCoeffs.first() = fiSourceCoeffs.first()*value(-1, model);
91  }
92 
93  if (fi.i() != popBalFis.size() - 1)
94  {
95  tsourceCoeffs.second() = fiSourceCoeffs.second()*value(+1, model);
96  }
97 
98  return tsourceCoeffs;
99 }
100 
101 
104 (
105  const fvSource& model,
107 ) const
108 {
109  const diameterModels::sizeGroup& fi = this->fi();
110  const UPtrList<diameterModels::sizeGroup>& velGrpFis =
111  fi.group().sizeGroups();
112 
114  sourceCoeffs(model);
115 
116  return
117  fi.i() == velGrpFis.first().i()
118  ? neg(source)*tsourceCoeffs.second()
119  : fi.i() == velGrpFis.last().i()
120  ? pos(source)*tsourceCoeffs.first()
121  : pos(source)*tsourceCoeffs.first()
122  + neg(source)*tsourceCoeffs.second();
123 }
124 
125 
126 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const Sources & sources() const
Return const-reference to the sources.
An ordered pair of two objects of type <Type> with first() and second() elements.
Definition: Pair.H:66
const Type & second() const
Return second.
Definition: PairI.H:121
const Type & first() const
Return first.
Definition: PairI.H:107
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: UPtrList.H:66
T & first()
Return reference to the first element of the list.
Definition: UPtrListI.H:43
label size() const
Return the number of elements in the UPtrList.
Definition: UPtrListI.H:29
T & last()
Return reference to the last element of the list.
Definition: UPtrListI.H:57
const UPtrList< sizeGroup > & sizeGroups() const
Return the size groups belonging to this populationBalance.
Single size class fraction field representing a fixed particle volume as defined by the user through ...
Definition: sizeGroup.H:96
const velocityGroup & group() const
Return const-reference to the velocityGroup.
Definition: sizeGroupI.H:44
label i() const
Return index of the size group within the population balance.
Definition: sizeGroupI.H:30
const populationBalanceModel & popBal() const
Return the populationBalance this velocityGroup belongs to.
const PtrList< sizeGroup > & sizeGroups() const
Return sizeGroups belonging to this velocityGroup.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:57
Base class for finite volume sources.
Definition: fvSource.H:52
Base class for source conditions which create a growth source terms in the size group equations or re...
Base class for source conditions which create a growth source terms for secondary properties of the s...
virtual tmp< DimensionedField< scalar, volMesh > > sourceCoeff(const fvSource &model, const DimensionedField< scalar, volMesh > &source) const
Return the combined source coefficient.
growthSecondaryPropertyFvScalarFieldSource(const DimensionedField< scalar, volMesh > &, const dictionary &dict)
Construct from internal field and dictionary.
virtual tmp< DimensionedField< scalar, volMesh > > internalCoeff(const fvSource &model, const DimensionedField< scalar, volMesh > &source) const
Return the internal coefficient.
virtual Pair< tmp< DimensionedField< scalar, volMesh > > > sourceCoeffs(const fvSource &model) const
Return the source coefficients for exchange with the groups below.
Base class for source conditions of secondary properties of the size-groups of a population balance m...
A class for managing temporary objects.
Definition: tmp.H:55
dimensionedScalar pos(const dimensionedScalar &ds)
dimensionedScalar neg(const dimensionedScalar &ds)
dictionary dict