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 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::InflationInjection
28 
29 Group
30  grpLagrangianIntermediateInjectionSubModels
31 
32 Description
33  Inflation injection - creates new particles by splitting existing
34  particles within in a set of generation cells, then inflating them
35  to a target diameter within the generation cells and an additional
36  set of inflation cells.
37 
38 SourceFiles
39  InflationInjection.C
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef InflationInjection_H
44 #define InflationInjection_H
45 
46 #include "InjectionModel.H"
47 #include "distributionModel.H"
48 #include "Switch.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 // Structure to hold:
56 // + position = vectorPairScalarPair::first().first()
57 // + velocity = vectorPairScalarPair::first().second()
58 // + diameter = vectorPairScalarPair::second().first()
59 // + target diameter = vectorPairScalarPair::second().second()
60 // One structure to allow single operation parallel comms
62 
63 
64 /*---------------------------------------------------------------------------*\
65  Class InflationInjection Declaration
66 \*---------------------------------------------------------------------------*/
67 
68 template<class CloudType>
70 :
71  public InjectionModel<CloudType>
72 {
73  // Private data
74 
75  //- Name of cellSet for generating new particles
76  word generationSetName_;
77 
78  //- Name of cellSet for inflating new particles
79  word inflationSetName_;
80 
81  //- Set of cells to generate particles in
82  labelList generationCells_;
83 
84  //- Set of cells to inflate particles in, includes all
85  // generation cells
86  labelList inflationCells_;
87 
88  //- Injection duration [s]
89  scalar duration_;
90 
91  //- Flow rate profile relative to SOI [m3/s]
92  TimeFunction1<scalar> flowRateProfile_;
93 
94  //- Growth rate of particle diameters towards target [m/s]
95  TimeFunction1<scalar> growthRate_;
96 
97  //- Positions, velocities, diameters and target diameters of
98  // new particles after splitting
100 
101  //- Accumulation variable to carry over volume from one injection
102  // to the next
103  scalar volumeAccumulator_;
104 
105  //- Fraction of injection controlled by this processor
106  scalar fraction_;
107 
108  //- Switch to control whether or not the injector is allowed
109  // to create new particles in empty cells
110  Switch selfSeed_;
111 
112  //- Diameter with which to create new seed particles
113  scalar dSeed_;
114 
115  //- Parcel size distribution model
116  const autoPtr<distributionModel> sizeDistribution_;
117 
118 
119 public:
120 
121  //- Runtime type information
122  TypeName("inflationInjection");
123 
124 
125  // Constructors
126 
127  //- Construct from dictionary
129  (
130  const dictionary& dict,
131  CloudType& owner,
132  const word& modelName
133  );
134 
135  //- Construct copy
137 
138  //- Construct and return a clone
140  {
142  (
144  );
145  }
146 
147 
148  //- Destructor
149  virtual ~InflationInjection();
150 
151 
152  // Member Functions
153 
154  //- Set injector locations when mesh is updated
155  virtual void updateMesh();
156 
157  //- Return the end-of-injection time
158  scalar timeEnd() const;
159 
160  //- Number of parcels to introduce relative to SOI
161  virtual label parcelsToInject(const scalar time0, const scalar time1);
162 
163  //- Volume of parcels to introduce relative to SOI
164  virtual scalar volumeToInject(const scalar time0, const scalar time1);
165 
166 
167  // Injection geometry
168 
169  //- Set the injection position and owner cell, tetFace and tetPt
170  virtual void setPositionAndCell
171  (
172  const label parcelI,
173  const label nParcels,
174  const scalar time,
175  vector& position,
176  label& cellOwner,
177  label& tetFacei,
178  label& tetPti
179  );
180 
181  //- Set the parcel properties
182  virtual void setProperties
183  (
184  const label parcelI,
185  const label nParcels,
186  const scalar time,
187  typename CloudType::parcelType& parcel
188  );
189 
190  //- Flag to identify whether model fully describes the parcel
191  virtual bool fullyDescribed() const;
192 
193  //- Return flag to identify whether or not injection of parcelI is
194  // permitted
195  virtual bool validInjection(const label parcelI);
196 };
197 
198 
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 
201 } // End namespace Foam
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 #ifdef NoRepository
206  #include "InflationInjection.C"
207 #endif
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 #endif
212 
213 // ************************************************************************* //
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:62
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:173
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::TimeFunction1< scalar >
Foam::InflationInjection::clone
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
Definition: InflationInjection.H:138
Foam::InflationInjection::fullyDescribed
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
Definition: InflationInjection.C:482
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:68
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:489
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:153
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
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:425
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:466
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:441
Foam::InflationInjection::timeEnd
scalar timeEnd() const
Return the end-of-injection time.
Definition: InflationInjection.C:165
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: Tuple2.H:57
distributionModel.H
Foam::vectorPairScalarPair
Tuple2< Pair< vector >, Pair< scalar > > vectorPairScalarPair
Definition: InflationInjection.H:60
Foam::InflationInjection::updateMesh
virtual void updateMesh()
Set injector locations when mesh is updated.
Definition: InflationInjection.C:160