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-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 
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 populationBalanceModel& popBal = this->popBal();
65  const label i = this->i();
66  const volScalarField& fi = popBal.f(i);
67 
68  return fi.sources()[model.name()].internalCoeff(model, source)*fi;
69 }
70 
71 
74 (
75  const fvSource& model
76 ) const
77 {
78  const populationBalanceModel& popBal = this->popBal();
79  const label i = this->i();
80  const volScalarField& fi = popBal.f(i);
81 
83  refCast<const growthFvScalarFieldSource>
84  (
85  fi.sources()[model.name()]
86  ).sourceCoeffs(model);
87 
89 
90  if (i != 0)
91  {
92  tsourceCoeffs.first() = fiSourceCoeffs.first()*value(i - 1, model);
93  }
94 
95  if (i != popBal.nGroups() - 1)
96  {
97  tsourceCoeffs.second() = fiSourceCoeffs.second()*value(i + 1, model);
98  }
99 
100  return tsourceCoeffs;
101 }
102 
103 
106 (
107  const fvSource& model,
109 ) const
110 {
111  const populationBalanceModel& popBal = this->popBal();
112  const label i = this->i();
113 
115  sourceCoeffs(model);
116 
117  return
118  i == popBal.diameters()[i].iFirst()
119  ? neg(source)*tsourceCoeffs.second()
120  : i == popBal.diameters()[i].iLast()
121  ? pos(source)*tsourceCoeffs.first()
122  : pos(source)*tsourceCoeffs.first()
123  + neg(source)*tsourceCoeffs.second();
124 }
125 
126 
127 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic GeometricField class.
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:67
const Type & second() const
Return second.
Definition: PairI.H:121
const Type & first() const
Return first.
Definition: PairI.H:107
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:53
Base class for source conditions of properties of the groups in a population balance model.
Base class for source conditions which create a growth source terms in the group fraction equations o...
Base class for source conditions which create a growth source terms for secondary properties of the g...
growthSecondaryPropertyFvScalarFieldSource(const DimensionedField< scalar, fvMesh > &, const dictionary &dict)
Construct from internal field and dictionary.
virtual tmp< DimensionedField< scalar, fvMesh > > internalCoeff(const fvSource &model, const DimensionedField< scalar, fvMesh > &source) const
Return the internal coefficient.
virtual tmp< DimensionedField< scalar, fvMesh > > sourceCoeff(const fvSource &model, const DimensionedField< scalar, fvMesh > &source) const
Return the combined source coefficient.
virtual Pair< tmp< DimensionedField< scalar, fvMesh > > > sourceCoeffs(const fvSource &model) const
Return the source coefficients for exchange with the groups below.
Model for tracking the evolution of a dispersed phase size distribution due to coalescence (synonymou...
const volScalarField & f(const label i) const
Access a group fraction.
const UPtrList< const diameterModels::populationBalance > & diameters() const
Access the list of diameter models associated with each group.
label nGroups() const
Return the number of groups in the population balance.
A class for managing temporary objects.
Definition: tmp.H:55
dimensionedScalar pos(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
dimensionedScalar neg(const dimensionedScalar &ds)
dictionary dict