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 | Copyright (C) 2011-2012 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
72 
73  //- Name of cellSet for inflating new particles
75 
76  //- Set of cells to generate particles in
78 
79  //- Set of cells to inflate particles in, includes all
80  // generation cells
82 
83  //- Injection duration [s]
84  scalar duration_;
85 
86  //- Flow rate profile relative to SOI [m3/s]
88 
89  //- Growth rate of particle diameters towards target [m/s]
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
106 
107  //- Diameter with which to create new seed particles
108  scalar dSeed_;
109 
110  //- Parcel size distribution model
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
134  virtual autoPtr<InjectionModel<CloudType> > clone() const
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 updateMesh();
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 // ************************************************************************* //
Foam::InflationInjection::inflationSetName_
word inflationSetName_
Name of cellSet for inflating new particles.
Definition: InflationInjection.H:73
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:60
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::InflationInjection::InflationInjection
InflationInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
Definition: InflationInjection.C:38
Foam::InflationInjection::parcelsToInject
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
Definition: InflationInjection.C:172
Foam::DynamicList
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:56
Foam::InflationInjection::sizeDistribution_
const autoPtr< distributionModels::distributionModel > sizeDistribution_
Parcel size distribution model.
Definition: InflationInjection.H:110
InflationInjection.C
Foam::InjectionModel
Templated injection model class.
Definition: InjectionModel.H:67
Foam::InflationInjection::clone
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
Definition: InflationInjection.H:133
Foam::CloudSubModelBase::owner
const CloudType & owner() const
Return const access to the owner cloud.
Definition: CloudSubModelBase.C:103
Foam::InflationInjection::flowRateProfile_
TimeDataEntry< scalar > flowRateProfile_
Flow rate profile relative to SOI [m3/s].
Definition: InflationInjection.H:86
Foam::InflationInjection::fullyDescribed
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
Definition: InflationInjection.C:483
Foam::subModelBase::modelName
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:104
InjectionModel.H
Foam::InflationInjection
Inflation injection - creates new particles by splitting existing particles within in a set of genera...
Definition: InflationInjection.H:63
Foam::TimeDataEntry< scalar >
Foam::label
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
Foam::InflationInjection::generationCells_
labelList generationCells_
Set of cells to generate particles in.
Definition: InflationInjection.H:76
Foam::subModelBase::dict
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
Foam::InflationInjection::validInjection
virtual bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is.
Definition: InflationInjection.C:490
Switch.H
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:68
Foam::InflationInjection::~InflationInjection
virtual ~InflationInjection()
Destructor.
Definition: InflationInjection.C:150
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::InflationInjection::TypeName
TypeName("inflationInjection")
Runtime type information.
Foam::InflationInjection::duration_
scalar duration_
Injection duration [s].
Definition: InflationInjection.H:83
Foam::InflationInjection::selfSeed_
Switch selfSeed_
Switch to control whether or not the injector is allowed.
Definition: InflationInjection.H:104
Foam::InflationInjection::volumeToInject
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
Definition: InflationInjection.C:424
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:442
Foam::InflationInjection::dSeed_
scalar dSeed_
Diameter with which to create new seed particles.
Definition: InflationInjection.H:107
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::Pair
An ordered pair of two objects of type <T> with first() and second() elements.
Definition: contiguous.H:49
Foam::Vector< scalar >
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::InflationInjection::volumeAccumulator_
scalar volumeAccumulator_
Accumulation variable to carry over volume from one injection.
Definition: InflationInjection.H:97
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:467
Foam::InflationInjection::growthRate_
TimeDataEntry< scalar > growthRate_
Growth rate of particle diameters towards target [m/s].
Definition: InflationInjection.H:89
Foam::InflationInjection::generationSetName_
word generationSetName_
Name of cellSet for generating new particles.
Definition: InflationInjection.H:70
Foam::InflationInjection::timeEnd
scalar timeEnd() const
Return the end-of-injection time.
Definition: InflationInjection.C:164
Foam::InflationInjection::fraction_
scalar fraction_
Fraction of injection controlled by this processor.
Definition: InflationInjection.H:100
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:217
Foam::InflationInjection::newParticles_
DynamicList< vectorPairScalarPair > newParticles_
Positions, velocities, diameters and target diameters of.
Definition: InflationInjection.H:93
Foam::Tuple2
A 2-tuple for storing two objects of different types.
Definition: Tuple2.H:47
Foam::InflationInjection::inflationCells_
labelList inflationCells_
Set of cells to inflate particles in, includes all.
Definition: InflationInjection.H:80
distributionModel.H
Foam::vectorPairScalarPair
Tuple2< Pair< vector >, Pair< scalar > > vectorPairScalarPair
Definition: InflationInjection.H:55
Foam::InflationInjection::updateMesh
virtual void updateMesh()
Set injector locations when mesh is updated.
Definition: InflationInjection.C:157