ThermoLookupTableInjection.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::ThermoLookupTableInjection
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 // injector 1
38  (x y z) (u v w) d rho mDot T cp // injector 2
39  ...
40  (x y z) (u v w) d rho mDot T cp // 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 
52 SourceFiles
53  ThermoLookupTableInjection.C
54 
55 \*---------------------------------------------------------------------------*/
56 
57 #ifndef ThermoLookupTableInjection_H
58 #define ThermoLookupTableInjection_H
59 
60 #include "InjectionModel.H"
62 
63 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
64 
65 namespace Foam
66 {
67 
68 /*---------------------------------------------------------------------------*\
69  Class ThermoLookupTableInjection Declaration
70 \*---------------------------------------------------------------------------*/
71 
72 template<class CloudType>
74 :
75  public InjectionModel<CloudType>
76 {
77  // Private data
78 
79  //- Name of file containing injector/parcel data
80  const word inputFileName_;
81 
82  //- Injection duration - common to all injection sources
83  scalar duration_;
84 
85  //- Number of parcels per injector - common to all injection sources
86  const scalar parcelsPerSecond_;
87 
88  //- Flag to indicate to randomise injection positions
89  bool randomise_;
90 
91  //- List of injectors
93 
94  //- List of cell labels corresponding to injector positions
95  labelList injectorCells_;
96 
97  //- List of tetFace labels corresponding to injector positions
98  labelList injectorTetFaces_;
99 
100  //- List of tetPt labels corresponding to injector positions
101  labelList injectorTetPts_;
102 
103 
104 public:
105 
106  //- Runtime type information
107  TypeName("thermoLookupTableInjection");
108 
109 
110  // Constructors
111 
112  //- Construct from dictionary
114  (
115  const dictionary& dict,
116  CloudType& owner,
117  const word& modelName
118  );
119 
120  //- Construct copy from owner cloud and injection model
122  (
123  CloudType& owner,
125  );
126 
127  //- Construct and return a clone using supplied owner cloud
129  {
131  (
133  );
134  }
135 
136 
137  //- Destructor
138  virtual ~ThermoLookupTableInjection() = 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 
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 true;
184  }
185 
186  //- Return flag to identify whether or not injection of parcelI is
187  //- permitted
188  virtual bool validInjection(const label parcelI);
189 };
190 
191 
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193 
194 } // End namespace Foam
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
198 #ifdef NoRepository
200 #endif
201 
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 
204 #endif
205 
206 // ************************************************************************* //
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 ~ThermoLookupTableInjection()=default
Destructor.
ThermoLookupTableInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
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
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
const CloudType & owner() const
Return const access to the owner cloud.
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.
A class for handling words, derived from Foam::string.
Definition: word.H:63
virtual void updateMesh()
Set injector locations when mesh is updated.
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone using supplied owner cloud.
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
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 void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
virtual bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is permitted.
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
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:67
scalar timeEnd() const
Return the end-of-injection time.
Particle injection sources read from look-up table. Each row corresponds to an injection site...
Namespace for OpenFOAM.
TypeName("thermoLookupTableInjection")
Runtime type information.