Loading...
Searching...
No Matches
InjectionModelList.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2012-2017 OpenFOAM Foundation
9 Copyright (C) 2022 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
28
29#include "InjectionModel.H"
30
31// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32
33template<class CloudType>
35:
37{}
38
39
40template<class CloudType>
42(
43 const dictionary& dict,
44 CloudType& owner
45)
46:
48{
49 Info<< "Constructing particle injection models" << endl;
50
51 label count = dict.size();
52 if (count)
53 {
54 this->resize(count);
55 }
56
57 count = 0;
58 for (const entry& dEntry : dict)
59 {
60 const word& model = dEntry.keyword();
61 const dictionary& props = dEntry.dict();
62
63 Info<< "Creating injector: " << model << endl;
64
65 this->set
66 (
67 count,
69 (
70 props,
71 model,
72 props.get<word>("type"),
73 owner
74 )
75 );
76
77 ++count;
78 }
79
80 if (!count)
81 {
82 this->resize(1);
83
84 this->set
85 (
86 0,
88 (
89 dict,
90 "none",
91 "none",
92 owner
93 )
94 );
95 }
96}
98
99template<class CloudType>
101(
103)
104:
106{}
108
109// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
110
111template<class CloudType>
113{
114 scalar minTime = GREAT;
115 for (const auto& model : *this)
116 {
117 minTime = min(minTime, model.timeStart());
119
120 return minTime;
121}
122
123
124template<class CloudType>
126{
127 scalar maxTime = -GREAT;
128 for (const auto& model : *this)
130 maxTime = max(maxTime, model.timeEnd());
132
133 return maxTime;
134}
135
136
137template<class CloudType>
140 const scalar time0,
141 const scalar time1
142)
143{
144 scalar vol = 0.0;
145 for (auto& model : *this)
146 {
147 vol += model.volumeToInject(time0, time1);
149
150 return vol;
151}
153
154template<class CloudType>
156{
157 scalar mass = 0.0;
158 scalar massTotal = 0.0;
159 for (auto& model : *this)
160 {
161 scalar mt = model.massTotal();
162 mass += mt*model.averageParcelMass();
163 massTotal += mt;
165
166 return mass/stabilise(massTotal, SMALL);
167}
168
169
170template<class CloudType>
172{
173 for (auto& model : *this)
174 {
175 model.updateMesh();
176 }
177}
178
179
180template<class CloudType>
181template<class TrackCloudType>
183(
184 TrackCloudType& cloud,
185 typename CloudType::parcelType::trackingData& td
186)
187{
188 for (auto& model : *this)
189 {
190 model.inject(cloud, td);
191 }
192}
193
194
195template<class CloudType>
196template<class TrackCloudType>
198(
199 TrackCloudType& cloud,
200 typename CloudType::parcelType::trackingData& td,
201 const scalar trackTime
202)
203{
204 for (auto& model : *this)
206 model.injectSteadyState(cloud, td, trackTime);
207 }
208}
209
210
211template<class CloudType>
213{
214 for (auto& model : *this)
215 {
216 model.info();
217 }
218}
219
220
221// ************************************************************************* //
InjectionModelList(CloudType &owner)
Construct null from owner.
void inject(TrackCloudType &cloud, typename CloudType::parcelType::trackingData &td)
Main injection loop.
scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
scalar timeStart() const
Return the minimum start-of-injection time.
scalar averageParcelMass()
Return the average parcel mass.
void injectSteadyState(TrackCloudType &cloud, typename CloudType::parcelType::trackingData &td, const scalar trackTime)
Main injection loop - steady-state.
virtual void info()
Write injection info.
void updateMesh()
Set injector locations when mesh is updated.
scalar timeEnd() const
Return the maximum end-of-injection time.
Templated injection model class.
static autoPtr< InjectionModel< CloudType > > New(const dictionary &dict, CloudType &owner)
Selector with lookup from dictionary.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition PtrList.H:67
const InjectionModel< CloudType > * set(const label i) const
Definition PtrList.H:171
A cloud is a registry collection of lagrangian particles.
Definition cloud.H:56
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
A keyword and a list of tokens is an 'entry'.
Definition entry.H:66
A class for handling words, derived from Foam::string.
Definition word.H:66
wallPoints::trackData td(isBlockedFace, regionToBlockSize)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition hashSets.C:40
DSMCCloud< dsmcParcel > CloudType
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition hashSets.C:26
dimensionedScalar stabilise(const dimensionedScalar &x, const dimensionedScalar &y)
dictionary dict