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 // ************************************************************************* //
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:77
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::ManualInjection::updateMesh
virtual void updateMesh()
Set injector locations when mesh is updated.
Definition: ManualInjection.C:118
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:220
Foam::ManualInjection::validInjection
virtual bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is.
Definition: ManualInjection.C:243
Foam::ManualInjection::TypeName
TypeName("manualInjection")
Runtime type information.
ManualInjection.C
Foam::InjectionModel
Templated injection model class.
Definition: InjectionModel.H:73
Foam::ManualInjection::parcelsToInject
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
Definition: ManualInjection.C:168
Foam::GlobalIOField< vector >
Foam::subModelBase::modelName
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:107
InjectionModel.H
Foam::ManualInjection
Manual injection.
Definition: ManualInjection.H:66
globalIOFields.H
Foam::ManualInjection::fullyDescribed
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
Definition: ManualInjection.C:236
Foam::subModelBase::dict
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:113
Foam::ManualInjection::volumeToInject
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
Definition: ManualInjection.C:184
Switch.H
Foam::CloudSubModelBase::owner
const CloudType & owner() const
Return const access to the owner cloud.
Definition: CloudSubModelBase.C:106
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:71
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
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:201
Foam::ManualInjection::clone
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
Definition: ManualInjection.H:120
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::Vector< scalar >
Foam::List< scalar >
Foam::ManualInjection::timeEnd
scalar timeEnd() const
Return the end-of-injection time.
Definition: ManualInjection.C:158
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220
Foam::ManualInjection::ManualInjection
ManualInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
Definition: ManualInjection.C:39
Foam::ManualInjection::~ManualInjection
virtual ~ManualInjection()
Destructor.
Definition: ManualInjection.C:111
distributionModel.H