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-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::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  Additional
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
72 
73  //- Field of parcel diameters
75 
76  //- List of cell labels corresponding to injector positions
78 
79  //- List of tetFace labels corresponding to injector positions
81 
82  //- List of tetPt labels corresponding to injector positions
84 
85  //- Initial parcel velocity
86  const vector U0_;
87 
88  //- Parcel size distribution model
90 
91  //- Flag to suppress errors if particle injection site is out-of-bounds
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
115  virtual autoPtr<InjectionModel<CloudType> > clone() const
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 // ************************************************************************* //
Foam::ManualInjection::diameters_
scalarList diameters_
Field of parcel diameters.
Definition: ManualInjection.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::IOField< vector >
Foam::ManualInjection::updateMesh
virtual void updateMesh()
Set injector locations when mesh is updated.
Definition: ManualInjection.C:115
Foam::ManualInjection::setProperties
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
Definition: ManualInjection.C:221
Foam::ManualInjection::validInjection
virtual bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is.
Definition: ManualInjection.C:244
Foam::ManualInjection::ignoreOutOfBounds_
Switch ignoreOutOfBounds_
Flag to suppress errors if particle injection site is out-of-bounds.
Definition: ManualInjection.H:91
Foam::ManualInjection::TypeName
TypeName("manualInjection")
Runtime type information.
ManualInjection.C
Foam::InjectionModel
Templated injection model class.
Definition: InjectionModel.H:67
Foam::ManualInjection::parcelsToInject
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
Definition: ManualInjection.C:165
Foam::CloudSubModelBase::owner
const CloudType & owner() const
Return const access to the owner cloud.
Definition: CloudSubModelBase.C:103
Foam::subModelBase::modelName
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:104
InjectionModel.H
Foam::ManualInjection::positionsFile_
const word positionsFile_
Name of file containing positions data.
Definition: ManualInjection.H:67
Foam::ManualInjection
Manual injection.
Definition: ManualInjection.H:60
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::ManualInjection::fullyDescribed
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
Definition: ManualInjection.C:237
Foam::subModelBase::dict
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
Foam::ManualInjection::volumeToInject
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
Definition: ManualInjection.C:183
Switch.H
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:68
Foam::ManualInjection::injectorCells_
labelList injectorCells_
List of cell labels corresponding to injector positions.
Definition: ManualInjection.H:76
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::ManualInjection::injectorTetFaces_
labelList injectorTetFaces_
List of tetFace labels corresponding to injector positions.
Definition: ManualInjection.H:79
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::ManualInjection::positions_
vectorIOField positions_
Field of parcel positions.
Definition: ManualInjection.H:70
Foam::ManualInjection::clone
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
Definition: ManualInjection.H:114
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::ManualInjection::injectorTetPts_
labelList injectorTetPts_
List of tetPt labels corresponding to injector positions.
Definition: ManualInjection.H:82
Foam::ManualInjection::U0_
const vector U0_
Initial parcel velocity.
Definition: ManualInjection.H:85
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::ManualInjection::timeEnd
scalar timeEnd() const
Return the end-of-injection time.
Definition: ManualInjection.C:155
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:217
Foam::ManualInjection::ManualInjection
ManualInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
Definition: ManualInjection.C:36
Foam::ManualInjection::~ManualInjection
virtual ~ManualInjection()
Destructor.
Definition: ManualInjection.C:108
Foam::ManualInjection::sizeDistribution_
const autoPtr< distributionModels::distributionModel > sizeDistribution_
Parcel size distribution model.
Definition: ManualInjection.H:88
distributionModel.H
Foam::ManualInjection::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: ManualInjection.C:202