InflationInjection.H
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) 2011-2022 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 Class
25  Foam::InflationInjection
26 
27 Description
28  Inflation injection - creates new particles by splitting existing
29  particles within in a set of generation cells, then inflating them
30  to a target diameter within the generation cells and an additional
31  set of inflation cells.
32 
33 SourceFiles
34  InflationInjection.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef InflationInjection_H
39 #define InflationInjection_H
40 
41 #include "InjectionModel.H"
42 #include "distributionModel.H"
43 #include "Switch.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 // Structure to hold:
51 // + position = vectorPairScalarPair::first().first()
52 // + velocity = vectorPairScalarPair::first().second()
53 // + diameter = vectorPairScalarPair::second().first()
54 // + target diameter = vectorPairScalarPair::second().second()
55 // One structure to allow single operation parallel comms
57 
58 
59 /*---------------------------------------------------------------------------*\
60  Class InflationInjection Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 template<class CloudType>
65 :
66  public InjectionModel<CloudType>
67 {
68  // Private Data
69 
70  //- Name of cellSet for generating new particles
71  word generationSetName_;
72 
73  //- Name of cellSet for inflating new particles
74  word inflationSetName_;
75 
76  //- Set of cells to generate particles in
77  labelList generationCells_;
78 
79  //- Set of cells to inflate particles in, includes all
80  // generation cells
81  labelList inflationCells_;
82 
83  //- Injection duration [s]
84  scalar duration_;
85 
86  //- Flow rate profile relative to SOI [m^3/s]
87  TimeFunction1<scalar> flowRateProfile_;
88 
89  //- Growth rate of particle diameters towards target [m/s]
90  TimeFunction1<scalar> growthRate_;
91 
92  //- Positions, velocities, diameters and target diameters of
93  // new particles after splitting
95 
96  //- Accumulation variable to carry over volume from one injection
97  // to the next
98  scalar volumeAccumulator_;
99 
100  //- Fraction of injection controlled by this processor
101  scalar fraction_;
102 
103  //- Switch to control whether or not the injector is allowed
104  // to create new particles in empty cells
105  Switch selfSeed_;
106 
107  //- Diameter with which to create new seed particles
108  scalar dSeed_;
109 
110  //- Parcel size distribution model
111  const autoPtr<distributionModel> sizeDistribution_;
112 
113 
114 public:
115 
116  //- Runtime type information
117  TypeName("inflationInjection");
118 
119 
120  // Constructors
121 
122  //- Construct from dictionary
124  (
125  const dictionary& dict,
126  CloudType& owner,
127  const word& modelName
128  );
129 
130  //- Construct copy
132 
133  //- Construct and return a clone
135  {
137  (
139  );
140  }
141 
142 
143  //- Destructor
144  virtual ~InflationInjection();
145 
146 
147  // Member Functions
148 
149  //- Set injector locations when mesh is updated
150  virtual void topoChange();
151 
152  //- Return the end-of-injection time
153  scalar timeEnd() const;
154 
155  //- Number of parcels to introduce relative to SOI
156  virtual label parcelsToInject(const scalar time0, const scalar time1);
157 
158  //- Volume of parcels to introduce relative to SOI
159  virtual scalar volumeToInject(const scalar time0, const scalar time1);
160 
161 
162  // Injection geometry
163 
164  //- Set the injection position and owner cell, tetFace and tetPt
165  virtual void setPositionAndCell
166  (
167  const label parcelI,
168  const label nParcels,
169  const scalar time,
170  vector& position,
171  label& cellOwner,
172  label& tetFacei,
173  label& tetPti
174  );
175 
176  //- Set the parcel properties
177  virtual void setProperties
178  (
179  const label parcelI,
180  const label nParcels,
181  const scalar time,
182  typename CloudType::parcelType& parcel
183  );
184 
185  //- Flag to identify whether model fully describes the parcel
186  virtual bool fullyDescribed() const;
187 
188  //- Return flag to identify whether or not injection of parcelI is
189  // permitted
190  virtual bool validInjection(const label parcelI);
191 };
192 
193 
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 
196 } // End namespace Foam
197 
198 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199 
200 #ifdef NoRepository
201  #include "InflationInjection.C"
202 #endif
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 #endif
207 
208 // ************************************************************************* //
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
virtual ~InflationInjection()
Destructor.
virtual void setPositionAndCell(const label parcelI, const label nParcels, const scalar time, vector &position, label &cellOwner, label &tetFacei, label &tetPti)
Set the injection position and owner cell, tetFace and tetPt.
TypeName("inflationInjection")
Runtime type information.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
A 2-tuple for storing two objects of different types.
Definition: HashTable.H:65
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
Templated injection model class.
virtual void topoChange()
Set injector locations when mesh is updated.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none/any.
Definition: Switch.H:60
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:104
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
Tuple2< Pair< vector >, Pair< scalar > > vectorPairScalarPair
const CloudType & owner() const
Return const access to the owner cloud.
InflationInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Definition: DynamicList.H:56
A class for handling words, derived from string.
Definition: word.H:59
virtual bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:221
Inflation injection - creates new particles by splitting existing particles within in a set of genera...
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
scalar timeEnd() const
Return the end-of-injection time.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:75
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
Namespace for OpenFOAM.