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-2020 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 dictionary& dict,
35  const sizeGroup& group
36 )
37 :
38  ModelType(dict, group),
39  regIOobject
40  (
41  IOobject
42  (
43  IOobject::groupName(typeid(ModelType).name(), group.name()),
44  group.time().constant(),
45  group.mesh()
46  )
47  ),
48  sizeGroup_(group),
49  SecondaryPropertyModelTable_()
50 {}
51 
52 
53 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
54 
55 template<class ModelType>
58 {}
59 
60 
61 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
62 
63 template<class ModelType>
67 {
68  if (SecondaryPropertyModelTable_.empty())
69  {
70  SecondaryPropertyModelTable_ =
71  sizeGroup_.mesh().template lookupClass
72  <
73  SecondaryPropertyModel<ModelType>
74  >();
75  }
76 
77  return SecondaryPropertyModelTable_;
78 }
79 
80 
81 template<class ModelType>
84 (
85  const sizeGroup& fi
86 ) const
87 {
88  return word(IOobject::groupName(typeid(ModelType).name(), fi.name()));
89 }
90 
91 
92 template<class ModelType>
94 (
95  const volScalarField& Su,
96  const sizeGroup& fj,
97  const sizeGroup& fk
98 )
99 {
100  const volScalarField& propj =
101  SecondaryPropertyModelTable()[SecondaryPropertyName(fj)]->fld();
102 
103  const volScalarField& propk =
104  SecondaryPropertyModelTable()[SecondaryPropertyName(fk)]->fld();
105 
106  src() += (propj*fj.x() + propk*fk.x())/(fj.x() + fk.x())*Su;
107 }
108 
109 
110 template<class ModelType>
112 (
113  const volScalarField& Su,
114  const sizeGroup& fj
115 )
116 {
117  const volScalarField& propj =
118  SecondaryPropertyModelTable()[SecondaryPropertyName(fj)]->fld();
119 
120  src() += propj*Su;
121 }
122 
123 
124 template<class ModelType>
126 (
127  const volScalarField& Su,
128  const sizeGroup& fu,
129  const driftModel& model
130 )
131 {
132  const volScalarField& propu =
133  SecondaryPropertyModelTable()[SecondaryPropertyName(fu)]->fld();
134 
135  src() += propu*Su;
136 }
137 
138 
139 template<class ModelType>
141 (
142  const volScalarField& Su,
143  const sizeGroup& fi,
144  const nucleationModel& model
145 )
146 {
147  const volScalarField& prop =
148  SecondaryPropertyModelTable()[SecondaryPropertyName(fi)]->fld();
149 
150  src() += prop*Su;
151 }
152 
153 
154 template<class ModelType>
156 {
157  src() = Zero;
158 }
159 
160 
161 template<class ModelType>
163 writeData(Ostream& os) const
164 {
165  return os.good();
166 }
167 
168 
169 // ************************************************************************* //
const char *const group
Group name for atomic constants.
dictionary dict
virtual void reset()
Reset secondary property source.
zeroField Su
Definition: alphaSuSp.H:1
SecondaryPropertyModel(const dictionary &dict, const sizeGroup &group)
Construct from dictionary and sizeGroup.
const SpTable & SecondaryPropertyModelTable()
Return table with pointers to all secondary properties of.
virtual void addDrift(const volScalarField &Su, const sizeGroup &fu, const driftModel &model)
Add drift contribution to secondary property source.
virtual void addCoalescence(const volScalarField &Su, const sizeGroup &fj, const sizeGroup &fk)
Add coalescence contribution to secondary property source.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
dynamicFvMesh & mesh
A class for handling words, derived from string.
Definition: word.H:59
static word groupName(Name name, const word &group)
static const zero Zero
Definition: zero.H:97
An STL-conforming hash table.
Definition: HashTable.H:61
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.
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
bool writeData(Ostream &) const
Dummy write for regIOobject.
virtual void addBreakup(const volScalarField &Su, const sizeGroup &fj)
Add breakup contribution to secondary property source.