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-2023 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  - Parcel positions in file \c positionsFile
32  - Initial parcel velocity
33 
34  Properties:
35  - Parcel diameters obtained by distribution model
36  - All parcels introduced at SOI
37 
38 SourceFiles
39  ManualInjection.C
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef ManualInjection_H
44 #define ManualInjection_H
45 
46 #include "InjectionModel.H"
47 #include "distribution.H"
48 #include "Switch.H"
49 #include "GlobalIOField.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  GlobalIOField<vector> positions_;
72 
73  //- Field of parcel diameters
74  scalarList diameters_;
75 
76  //- List of coordinates of injector positions
77  List<barycentric> injectorCoordinates_;
78 
79  //- List of cell labels corresponding to injector positions
80  labelList injectorCells_;
81 
82  //- List of tetFace labels corresponding to injector positions
83  labelList injectorTetFaces_;
84 
85  //- List of tetPt labels corresponding to injector positions
86  labelList injectorTetPts_;
87 
88  //- Mass to inject
89  const scalar massTotal_;
90 
91  //- Initial parcel velocity
92  const vector U0_;
93 
94  //- Parcel size distribution model
95  const autoPtr<distribution> 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 topoChange();
138 
139  //- Return the end-of-injection time
140  virtual scalar timeEnd() const;
141 
142  //- Number of parcels to introduce relative to SOI
143  virtual label nParcelsToInject(const scalar time0, const scalar time1);
144 
145  //- Parcel mass to introduce relative to SOI
146  virtual scalar massToInject(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  barycentric& coordinates,
158  label& celli,
159  label& tetFacei,
160  label& tetPti,
161  label& facei
162  );
163 
164  //- Set the parcel properties
165  virtual void setProperties
166  (
167  const label parcelI,
168  const label nParcels,
169  const scalar time,
170  typename CloudType::parcelType& parcel
171  );
172 
173  //- Flag to identify whether model fully describes the parcel
174  virtual bool fullyDescribed() const;
175 };
176 
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 } // End namespace Foam
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 #ifdef NoRepository
185  #include "ManualInjection.C"
186 #endif
187 
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 
190 #endif
191 
192 // ************************************************************************* //
const CloudType & owner() const
Return const access to the owner cloud.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:79
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:221
A primitive field of type <Type> with automated input and output.
Definition: GlobalIOField.H:50
Templated injection model class.
Manual injection.
virtual void topoChange()
Set injector locations when mesh is updated.
TypeName("manualInjection")
Runtime type information.
virtual ~ManualInjection()
Destructor.
ManualInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
virtual void setPositionAndCell(const label parcelI, const label nParcels, const scalar time, barycentric &coordinates, label &celli, label &tetFacei, label &tetPti, label &facei)
Set the injection position and owner cell, tetFace and tetPt.
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
virtual label nParcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
virtual scalar timeEnd() const
Return the end-of-injection time.
virtual scalar massToInject(const scalar time0, const scalar time1)
Parcel mass to introduce relative to SOI.
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:61
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:104
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
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