KinematicLookupTableInjection.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::KinematicLookupTableInjection
28 
29 Group
30  grpLagrangianIntermediateInjectionSubModels
31 
32 Description
33  Particle injection sources read from look-up table. Each row corresponds to
34  an injection site.
35 
36  \verbatim
37  (
38  (x y z) (u v w) d rho mDot // injector 1
39  (x y z) (u v w) d rho mDot // injector 2
40  ...
41  (x y z) (u v w) d rho mDot // injector N
42  );
43  \endverbatim
44 
45  where:
46  \plaintable
47  x, y, z | global cartesian coordinates [m]
48  u, v, w | global cartesian velocity components [m/s]
49  d | diameter [m]
50  rho | density [kg/m3]
51  mDot | mass flow rate [kg/s]
52  \endplaintable
53 
54 SourceFiles
55  KinematicLookupTableInjection.C
56 
57 \*---------------------------------------------------------------------------*/
58 
59 #ifndef KinematicLookupTableInjection_H
60 #define KinematicLookupTableInjection_H
61 
62 #include "InjectionModel.H"
64 
65 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
66 
67 namespace Foam
68 {
69 
70 /*---------------------------------------------------------------------------*\
71  Class KinematicLookupTableInjection Declaration
72 \*---------------------------------------------------------------------------*/
73 
74 template<class CloudType>
75 class KinematicLookupTableInjection
76 :
77  public InjectionModel<CloudType>
78 {
79  // Private data
80 
81  //- Name of file containing injector/parcel data
82  const word inputFileName_;
83 
84  //- Injection duration - common to all injection sources
85  scalar duration_;
86 
87  //- Number of parcels per injector - common to all injection sources
88  const scalar parcelsPerSecond_;
89 
90  //- Flag to indicate to randomise injection positions
91  bool randomise_;
92 
93  //- List of injectors
95 
96  //- List of cell labels corresponding to injector positions
97  labelList injectorCells_;
98 
99  //- List of tetFace labels corresponding to injector positions
100  labelList injectorTetFaces_;
101 
102  //- List of tetPt labels corresponding to injector positions
103  labelList injectorTetPts_;
104 
105 
106 public:
107 
108  //- Runtime type information
109  TypeName("kinematicLookupTableInjection");
110 
111 
112  // Constructors
113 
114  //- Construct from dictionary
116  (
117  const dictionary& dict,
118  CloudType& owner,
119  const word& modelName
120  );
121 
122  //- Construct copy
124  (
126  );
127 
128  //- Construct and return a clone
130  {
132  (
134  );
135  }
136 
137 
138  //- Destructor
139  virtual ~KinematicLookupTableInjection() = default;
140 
141 
142  // Member Functions
143 
144  //- Set injector locations when mesh is updated
145  virtual void updateMesh();
146 
147  //- Return the end-of-injection time
148  scalar timeEnd() const;
149 
150  //- Number of parcels to introduce relative to SOI
151  virtual label parcelsToInject(const scalar time0, const scalar time1);
152 
153  //- Volume of parcels to introduce relative to SOI
154  virtual scalar volumeToInject(const scalar time0, const scalar time1);
155 
156 
157  // Injection geometry
158 
159  //- Set the injection position and owner cell, tetFace and tetPt
160  virtual void setPositionAndCell
161  (
162  const label parcelI,
163  const label nParcels,
164  const scalar time,
165  vector& position,
166  label& cellOwner,
167  label& tetFacei,
168  label& tetPti
169  );
170 
171  //- Set the parcel properties
172  virtual void setProperties
173  (
174  const label parcelI,
175  const label nParcels,
176  const scalar time,
177  typename CloudType::parcelType& parcel
178  );
179 
180  //- Flag to identify whether model fully describes the parcel
181  virtual bool fullyDescribed() const;
182 
183  //- Return flag to identify whether or not injection of parcelI is
184  //- permitted
185  virtual bool validInjection(const label parcelI);
186 };
187 
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 } // End namespace Foam
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 #ifdef NoRepository
197 #endif
198 
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 
201 #endif
202 
203 // ************************************************************************* //
Foam::KinematicLookupTableInjection::fullyDescribed
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
Definition: KinematicLookupTableInjection.C:233
Foam::KinematicLookupTableInjection::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: KinematicLookupTableInjection.C:182
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::KinematicLookupTableInjection::KinematicLookupTableInjection
KinematicLookupTableInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
Definition: KinematicLookupTableInjection.C:36
KinematicLookupTableInjection.C
Foam::KinematicLookupTableInjection::clone
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
Definition: KinematicLookupTableInjection.H:148
Foam::InjectionModel
Templated injection model class.
Definition: InjectionModel.H:73
Foam::subModelBase::modelName
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:107
InjectionModel.H
Foam::KinematicLookupTableInjection::validInjection
virtual bool validInjection(const label parcelI)
Definition: KinematicLookupTableInjection.C:241
Foam::KinematicLookupTableInjection::setProperties
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
Definition: KinematicLookupTableInjection.C:212
Foam::subModelBase::dict
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:113
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::KinematicLookupTableInjection::parcelsToInject
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
Definition: KinematicLookupTableInjection.C:146
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::KinematicLookupTableInjection
Particle injection sources read from look-up table. Each row corresponds to an injection site.
Definition: KinematicLookupTableInjection.H:94
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::KinematicLookupTableInjection::~KinematicLookupTableInjection
virtual ~KinematicLookupTableInjection()=default
Destructor.
Foam::KinematicLookupTableInjection::updateMesh
virtual void updateMesh()
Set injector locations when mesh is updated.
Definition: KinematicLookupTableInjection.C:97
Foam::KinematicLookupTableInjection::timeEnd
scalar timeEnd() const
Return the end-of-injection time.
Definition: KinematicLookupTableInjection.C:138
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::KinematicLookupTableInjection::volumeToInject
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
Definition: KinematicLookupTableInjection.C:162
Foam::Vector< scalar >
Foam::List< label >
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220
Foam::GlobalIOList< kinematicParcelInjectionData >
Foam::KinematicLookupTableInjection::TypeName
TypeName("kinematicLookupTableInjection")
Runtime type information.
kinematicParcelInjectionDataIOList.H