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