InjectionModelList.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) 2012-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 "InjectionModel.H"
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 template<class CloudType>
32 :
34 {}
35 
36 
37 template<class CloudType>
39 (
40  const dictionary& dict,
41  CloudType& owner
42 )
43 :
45 {
46  wordList modelNames(dict.toc());
47 
48  Info<< "Constructing particle injection models" << endl;
49 
50  if (modelNames.size() > 0)
51  {
52  this->setSize(modelNames.size());
53 
54  label i = 0;
55  forAllConstIter(IDLList<entry>, dict, iter)
56  {
57  const word& model = iter().keyword();
58  Info<< "Creating injector: " << model << endl;
59  const dictionary& props = iter().dict();
60 
61  this->set
62  (
63  i++,
65  (
66  props,
67  model,
68  props.lookup("type"),
69  owner
70  )
71  );
72  }
73  }
74  else
75  {
76  this->setSize(1);
77 
78  this->set
79  (
80  0,
82  (
83  dict,
84  "none",
85  "none",
86  owner
87  )
88  );
89  }
90 }
91 
92 
93 template<class CloudType>
95 (
97 )
98 :
100 {}
101 
102 
103 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
104 
105 template<class CloudType>
107 {}
108 
109 
110 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
111 
112 template<class CloudType>
114 {
115  scalar minTime = great;
116  forAll(*this, i)
117  {
118  minTime = min(minTime, this->operator[](i).timeStart());
119  }
120 
121  return minTime;
122 }
123 
124 
125 template<class CloudType>
127 {
128  scalar maxTime = -great;
129  forAll(*this, i)
130  {
131  maxTime = max(maxTime, this->operator[](i).timeEnd());
132  }
133 
134  return maxTime;
135 }
136 
137 
138 template<class CloudType>
140 (
141  const scalar time0,
142  const scalar time1
143 )
144 {
145  scalar vol = 0.0;
146  forAll(*this, i)
147  {
148  vol += this->operator[](i).volumeToInject(time0, time1);
149  }
150 
151  return vol;
152 }
153 
154 
155 template<class CloudType>
157 {
158  scalar mass = 0.0;
159  scalar massTotal = 0.0;
160  forAll(*this, i)
161  {
162  scalar mt = this->operator[](i).massTotal();
163  mass += mt*this->operator[](i).averageParcelMass();
164  massTotal += mt;
165  }
166 
167  return mass/massTotal;
168 }
169 
170 
171 template<class CloudType>
173 {
174  forAll(*this, i)
175  {
176  this->operator[](i).updateMesh();
177  }
178 }
179 
180 
181 template<class CloudType>
182 template<class TrackCloudType>
184 (
185  TrackCloudType& cloud,
186  typename CloudType::parcelType::trackingData& td
187 )
188 {
189  forAll(*this, i)
190  {
191  this->operator[](i).inject(cloud, td);
192  }
193 }
194 
195 
196 template<class CloudType>
197 template<class TrackCloudType>
199 (
200  TrackCloudType& cloud,
201  typename CloudType::parcelType::trackingData& td,
202  const scalar trackTime
203 )
204 {
205  forAll(*this, i)
206  {
207  this->operator[](i).injectSteadyState(cloud, td, trackTime);
208  }
209 }
210 
211 
212 template<class CloudType>
214 {
215  forAll(*this, i)
216  {
217  this->operator[](i).info(os);
218  }
219 }
220 
221 
222 // ************************************************************************* //
Template class for intrusive linked lists.
Definition: ILList.H:50
virtual ~InjectionModelList()
Destructor.
void inject(TrackCloudType &cloud, typename CloudType::parcelType::trackingData &td)
Main injection loop.
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
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
InjectionModelList(CloudType &owner)
Construct null from owner.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
void updateMesh()
Set injector locations when mesh is updated.
void injectSteadyState(TrackCloudType &cloud, typename CloudType::parcelType::trackingData &td, const scalar trackTime)
Main injection loop - steady-state.
Templated injection model class.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
wordList toc() const
Return the table of contents.
Definition: dictionary.C:1095
points setSize(newPointi)
scalar timeStart() const
Return the minimum start-of-injection time.
scalar averageParcelMass()
Return the average parcel mass.
autoPtr< BasicCompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const typename BasicCompressibleMomentumTransportModel::transportModel &transport)
A class for handling words, derived from string.
Definition: word.H:59
List of injection models.
Definition: MomentumCloud.H:77
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Definition: pEqn.H:29
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
virtual void info(Ostream &os)
Write injection info to stream.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:70
messageStream Info
scalar timeEnd() const
Return the maximum end-of-injection time.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:75
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:844