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