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