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-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 "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;
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  forAll(*this, i)
142  {
143  this->operator[](i).topoChange();
144  }
145 }
146 
147 
148 template<class CloudType>
149 template<class TrackCloudType>
151 (
152  TrackCloudType& cloud,
153  typename CloudType::parcelType::trackingData& td
154 )
155 {
156  forAll(*this, i)
157  {
158  this->operator[](i).inject(cloud, td);
159  }
160 }
161 
162 
163 template<class CloudType>
164 template<class TrackCloudType>
166 (
167  TrackCloudType& cloud,
168  typename CloudType::parcelType::trackingData& td
169 )
170 {
171  forAll(*this, i)
172  {
173  this->operator[](i).injectSteadyState(cloud, td);
174  }
175 }
176 
177 
178 template<class CloudType>
180 {
181  forAll(*this, i)
182  {
183  this->operator[](i).info(os);
184  }
185 }
186 
187 
188 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Definition: UList.H:477
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:80
Template class for intrusive linked lists.
Definition: ILList.H:67
List of injection models.
InjectionModelList(CloudType &owner)
Construct null from owner.
void topoChange()
Set injector locations when mesh is updated.
void inject(TrackCloudType &cloud, typename CloudType::parcelType::trackingData &td)
Main injection loop.
virtual ~InjectionModelList()
Destructor.
virtual void info(Ostream &os)
Write injection info to stream.
scalar timeStart() const
Return the minimum start-of-injection time.
void injectSteadyState(TrackCloudType &cloud, typename CloudType::parcelType::trackingData &td)
Main injection loop - steady-state.
scalar timeEnd() const
Return the maximum end-of-injection time.
Templated injection model class.
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:164
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: PtrList.H:75
bool set(const label) const
Is element set.
Definition: PtrListI.H:62
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
Definition: PtrList.C:131
A cloud is a collection of lagrangian particles.
Definition: cloud.H:55
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:710
A class for handling words, derived from string.
Definition: word.H:62
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
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:257
messageStream Info
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
dictionary dict