ManualInjection.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-2016 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::ManualInjection
26 
27 Description
28  Manual injection.
29 
30  User specifies:
31  - Total mass to inject
32  - Parcel positions in file \c positionsFile
33  - Initial parcel velocity
34 
35  Properties:
36  - Parcel diameters obtained by distribution model
37  - All parcels introduced at SOI
38 
39 SourceFiles
40  ManualInjection.C
41 
42 \*---------------------------------------------------------------------------*/
43 
44 #ifndef ManualInjection_H
45 #define ManualInjection_H
46 
47 #include "InjectionModel.H"
48 #include "distributionModel.H"
49 #include "Switch.H"
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 
56 /*---------------------------------------------------------------------------*\
57  Class ManualInjection Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 template<class CloudType>
61 class ManualInjection
62 :
63  public InjectionModel<CloudType>
64 {
65  // Private data
66 
67  //- Name of file containing positions data
68  const word positionsFile_;
69 
70  //- Field of parcel positions
71  vectorIOField positions_;
72 
73  //- Field of parcel diameters
74  scalarList diameters_;
75 
76  //- List of cell labels corresponding to injector positions
77  labelList injectorCells_;
78 
79  //- List of tetFace labels corresponding to injector positions
80  labelList injectorTetFaces_;
81 
82  //- List of tetPt labels corresponding to injector positions
83  labelList injectorTetPts_;
84 
85  //- Initial parcel velocity
86  const vector U0_;
87 
88  //- Parcel size distribution model
89  const autoPtr<distributionModels::distributionModel> sizeDistribution_;
90 
91  //- Flag to suppress errors if particle injection site is out-of-bounds
92  Switch ignoreOutOfBounds_;
93 
94 
95 public:
96 
97  //- Runtime type information
98  TypeName("manualInjection");
99 
100 
101  // Constructors
102 
103  //- Construct from dictionary
105  (
106  const dictionary& dict,
107  CloudType& owner,
108  const word& modelName
109  );
110 
111  //- Construct copy
113 
114  //- Construct and return a clone
116  {
118  (
119  new ManualInjection<CloudType>(*this)
120  );
121  }
122 
123 
124  //- Destructor
125  virtual ~ManualInjection();
126 
127 
128  // Member Functions
129 
130  //- Set injector locations when mesh is updated
131  virtual void updateMesh();
132 
133  //- Return the end-of-injection time
134  scalar timeEnd() const;
135 
136  //- Number of parcels to introduce relative to SOI
137  virtual label parcelsToInject(const scalar time0, const scalar time1);
138 
139  //- Volume of parcels to introduce relative to SOI
140  virtual scalar volumeToInject(const scalar time0, const scalar time1);
141 
142 
143  // Injection geometry
144 
145  //- Set the injection position and owner cell, tetFace and tetPt
146  virtual void setPositionAndCell
147  (
148  const label parcelI,
149  const label nParcels,
150  const scalar time,
151  vector& position,
152  label& cellOwner,
153  label& tetFacei,
154  label& tetPtI
155  );
156 
157  //- Set the parcel properties
158  virtual void setProperties
159  (
160  const label parcelI,
161  const label nParcels,
162  const scalar time,
163  typename CloudType::parcelType& parcel
164  );
165 
166  //- Flag to identify whether model fully describes the parcel
167  virtual bool fullyDescribed() const;
168 
169  //- Return flag to identify whether or not injection of parcelI is
170  // permitted
171  virtual bool validInjection(const label parcelI);
172 };
173 
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 } // End namespace Foam
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 #ifdef NoRepository
182  #include "ManualInjection.C"
183 #endif
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 #endif
188 
189 // ************************************************************************* //
Manual injection.
ManualInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
virtual ~ManualInjection()
Destructor.
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
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
Templated injection model class.
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:104
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.
Definition: Switch.H:60
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
virtual void updateMesh()
Set injector locations when mesh is updated.
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
A class for handling words, derived from string.
Definition: word.H:59
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
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.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:217
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
const CloudType & owner() const
Return const access to the owner cloud.
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:53
virtual bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:68
TypeName("manualInjection")
Runtime type information.
Namespace for OpenFOAM.