SecondaryPropertyModel.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-2023 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 "SecondaryPropertyModel.H"
27 #include "shapeModel.H"
28 
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 
31 template<class ModelType>
33 (
34  const sizeGroup& group
35 )
36 :
37  ModelType(group),
39  (
40  IOobject
41  (
42  IOobject::groupName(typeid(ModelType).name(), group.name()),
43  group.time().constant(),
44  group.mesh()
45  )
46  ),
47  group_(group),
48  SecondaryPropertyModelTable_()
49 {}
50 
51 
52 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
53 
54 template<class ModelType>
57 {}
58 
59 
60 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
61 
62 template<class ModelType>
65 {
66  return group_;
67 }
68 
69 
70 template<class ModelType>
74 {
75  if (SecondaryPropertyModelTable_.empty())
76  {
77  SecondaryPropertyModelTable_ =
78  group_.mesh().template lookupClass
79  <
81  >();
82  }
83 
84  return SecondaryPropertyModelTable_;
85 }
86 
87 
88 template<class ModelType>
91 (
92  const sizeGroup& fi
93 ) const
94 {
95  return word(IOobject::groupName(typeid(ModelType).name(), fi.name()));
96 }
97 
98 
99 template<class ModelType>
101 (
102  const volScalarField& Su,
103  const sizeGroup& fj,
104  const sizeGroup& fk
105 )
106 {
107  const volScalarField& propj =
108  SecondaryPropertyModelTable()[SecondaryPropertyName(fj)]->fld();
109 
110  const volScalarField& propk =
111  SecondaryPropertyModelTable()[SecondaryPropertyName(fk)]->fld();
112 
113  src() += (propj*fj.x() + propk*fk.x())/(fj.x() + fk.x())*Su;
114 }
115 
116 
117 template<class ModelType>
119 (
120  const volScalarField& Su,
121  const sizeGroup& fj
122 )
123 {
124  const volScalarField& propj =
125  SecondaryPropertyModelTable()[SecondaryPropertyName(fj)]->fld();
126 
127  src() += propj*Su;
128 }
129 
130 
131 template<class ModelType>
133 (
135  const sizeGroup& fu,
136  const driftModel& model
137 )
138 {
139  const volScalarField& propu =
140  SecondaryPropertyModelTable()[SecondaryPropertyName(fu)]->fld();
141 
142  src() += propu*Su;
143 }
144 
145 
146 template<class ModelType>
148 (
150  const sizeGroup& fi,
151  const nucleationModel& model
152 )
153 {
154  const volScalarField& prop =
155  SecondaryPropertyModelTable()[SecondaryPropertyName(fi)]->fld();
156 
157  src() += prop*Su;
158 }
159 
160 
161 template<class ModelType>
163 {
164  src() = Zero;
165 }
166 
167 
168 template<class ModelType>
170 writeData(Ostream& os) const
171 {
172  return os.good();
173 }
174 
175 
176 // ************************************************************************* //
Generic GeometricField class.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
const word & name() const
Return name.
Definition: IOobject.H:310
static word groupName(Name name, const word &group)
bool good() const
Return true if next operation might succeed.
Definition: IOstream.H:330
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
Base class for modeling evolution of secondary representative properties of a size class....
bool writeData(Ostream &) const
Dummy write for regIOobject.
const SpTable & SecondaryPropertyModelTable()
Return table with pointers to all secondary properties of.
const sizeGroup & group() const
Access the sizeGroup.
virtual void addCoalescence(const volScalarField &Su, const sizeGroup &fj, const sizeGroup &fk)
Add coalescence contribution to secondary property source.
const word SecondaryPropertyName(const sizeGroup &fi) const
Return name of the secondary property of another class for.
virtual void addNucleation(const volScalarField &Su, const sizeGroup &fi, const nucleationModel &model)
Add drift contribution to secondary property source.
virtual void addBreakup(const volScalarField &Su, const sizeGroup &fj)
Add breakup contribution to secondary property source.
virtual void addDrift(const volScalarField &Su, const sizeGroup &fu, const driftModel &model)
Add drift contribution to secondary property source.
SecondaryPropertyModel(const sizeGroup &group)
Construct from sizeGroup.
virtual void reset()
Reset secondary property source.
Constant dispersed-phase particle diameter model.
Base class for drift models.
Definition: driftModel.H:54
Base class for nucleation models.
Single size class fraction field representing a fixed particle volume as defined by the user through ...
Definition: sizeGroup.H:102
const dimensionedScalar & x() const
Return representative volume of the sizeGroup.
Definition: sizeGroupI.H:58
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:55
A class for handling words, derived from string.
Definition: word.H:62
const char *const group
Group name for atomic constants.
tmp< VolField< Type > > Su(const VolField< Type > &su, const VolField< Type > &vf)
Definition: fvcSup.C:44
static const zero Zero
Definition: zero.H:97
word name(const bool)
Return a word representation of a bool.
Definition: boolIO.C:39