ManualInjection.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2020 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 #include "GlobalIOField.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 
57 /*---------------------------------------------------------------------------*\
58  Class ManualInjection Declaration
59 \*---------------------------------------------------------------------------*/
60 
61 template<class CloudType>
62 class ManualInjection
63 :
64  public InjectionModel<CloudType>
65 {
66  // Private Data
67 
68  //- Name of file containing positions data
69  const word positionsFile_;
70 
71  //- Field of parcel positions
72  GlobalIOField<vector> positions_;
73 
74  //- Field of parcel diameters
75  scalarList diameters_;
76 
77  //- List of cell labels corresponding to injector positions
78  labelList injectorCells_;
79 
80  //- List of tetFace labels corresponding to injector positions
81  labelList injectorTetFaces_;
82 
83  //- List of tetPt labels corresponding to injector positions
84  labelList injectorTetPts_;
85 
86  //- Initial parcel velocity
87  const vector U0_;
88 
89  //- Parcel size distribution model
90  const autoPtr<distributionModel> sizeDistribution_;
91 
92  //- Flag to suppress errors if particle injection site is out-of-bounds
93  Switch ignoreOutOfBounds_;
94 
95 
96 public:
97 
98  //- Runtime type information
99  TypeName("manualInjection");
100 
101 
102  // Constructors
103 
104  //- Construct from dictionary
106  (
107  const dictionary& dict,
108  CloudType& owner,
109  const word& modelName
110  );
111 
112  //- Construct copy
114 
115  //- Construct and return a clone
117  {
119  (
120  new ManualInjection<CloudType>(*this)
121  );
122  }
123 
124 
125  //- Destructor
126  virtual ~ManualInjection();
127 
128 
129  // Member Functions
130 
131  //- Set injector locations when mesh is updated
132  virtual void updateMesh();
133 
134  //- Return the end-of-injection time
135  scalar timeEnd() const;
136 
137  //- Number of parcels to introduce relative to SOI
138  virtual label parcelsToInject(const scalar time0, const scalar time1);
139 
140  //- Volume of parcels to introduce relative to SOI
141  virtual scalar volumeToInject(const scalar time0, const scalar time1);
142 
143 
144  // Injection geometry
145 
146  //- Set the injection position and owner cell, tetFace and tetPt
147  virtual void setPositionAndCell
148  (
149  const label parcelI,
150  const label nParcels,
151  const scalar time,
152  vector& position,
153  label& cellOwner,
154  label& tetFacei,
155  label& tetPti
156  );
157 
158  //- Set the parcel properties
159  virtual void setProperties
160  (
161  const label parcelI,
162  const label nParcels,
163  const scalar time,
164  typename CloudType::parcelType& parcel
165  );
166 
167  //- Flag to identify whether model fully describes the parcel
168  virtual bool fullyDescribed() const;
169 
170  //- Return flag to identify whether or not injection of parcelI is
171  // permitted
172  virtual bool validInjection(const label parcelI);
173 };
174 
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 } // End namespace Foam
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 #ifdef NoRepository
183  #include "ManualInjection.C"
184 #endif
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 #endif
189 
190 // ************************************************************************* //
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
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
Templated injection model class.
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/any.
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 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:104
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
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 string.
Definition: word.H:59
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
IOField with global data (so optionally read from master)
Definition: GlobalIOField.H:50
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:221
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.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
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:75
TypeName("manualInjection")
Runtime type information.
Namespace for OpenFOAM.
scalar timeEnd() const
Return the end-of-injection time.