ThermoLookupTableInjection.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2025 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::ThermoLookupTableInjection
26 
27 Description
28  Particle injection sources read from look-up table. Each row corresponds to
29  an injection site.
30 
31  (
32  (x y z) (u v w) d rho mDot T cp // injector 1
33  (x y z) (u v w) d rho mDot T cp // injector 2
34  ...
35  (x y z) (u v w) d rho mDot T cp // injector N
36  );
37 
38  where:
39  x, y, z = global cartesian co-ordinates [m]
40  u, v, w = global cartesian velocity components [m/s]
41  d = diameter [m]
42  rho = density [kg/m^3]
43  mDot = mass flow rate [kg/s]
44  T = temperature [K]
45  cp = specific heat capacity [J/kg/K]
46 
47 SourceFiles
48  ThermoLookupTableInjection.C
49 
50 \*---------------------------------------------------------------------------*/
51 
52 #ifndef ThermoLookupTableInjection_H
53 #define ThermoLookupTableInjection_H
54 
55 #include "InjectionModel.H"
57 
58 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59 
60 namespace Foam
61 {
62 
63 /*---------------------------------------------------------------------------*\
64  Class ThermoLookupTableInjection Declaration
65 \*---------------------------------------------------------------------------*/
66 
67 template<class CloudType>
69 :
70  public InjectionModel<CloudType>
71 {
72  // Private Data
73 
74  //- Name of file containing injector/parcel data
75  const word inputFileName_;
76 
77  //- Injection duration - common to all injection sources
78  const scalar duration_;
79 
80  //- Number of parcels per injector - common to all injection sources
81  autoPtr<Function1<scalar>> parcelsPerSecond_;
82 
83  //- Flag to indicate to randomise injection positions
84  bool randomise_;
85 
86  //- List of injectors
88 
89  //- List of coordinates corresponding to injector positions
90  List<barycentric> injectorCoordinates_;
91 
92  //- List of cell labels corresponding to injector positions
93  labelList injectorCells_;
94 
95  //- List of tetFace labels corresponding to injector positions
96  labelList injectorTetFaces_;
97 
98  //- List of tetPt labels corresponding to injector positions
99  labelList injectorTetPts_;
100 
101 
102 public:
103 
104  //- Runtime type information
105  TypeName("thermoLookupTableInjection");
106 
107 
108  // Constructors
109 
110  //- Construct from dictionary
112  (
113  const dictionary& dict,
114  CloudType& owner,
115  const word& modelName
116  );
117 
118  //- Construct copy
120  (
122  );
123 
124  //- Construct and return a clone using supplied owner cloud
126  {
128  (
130  );
131  }
132 
133 
134  //- Destructor
135  virtual ~ThermoLookupTableInjection();
136 
137 
138  // Member Functions
139 
140  //- Set injector locations when mesh is updated
141  virtual void topoChange();
142 
143  //- Return the end-of-injection time
144  scalar timeEnd() const;
145 
146  //- Number of parcels to introduce relative to SOI
147  virtual scalar nParcelsToInject(const scalar time0, const scalar time1);
148 
149  //- Parcel mass to introduce relative to SOI
150  virtual scalar massToInject(const scalar time0, const scalar time1);
151 
152 
153  // Injection geometry
154 
155  //- Set the injection position and owner cell, tetFace and tetPt
156  virtual void setPositionAndCell
157  (
158  const meshSearch& searchEngine,
159  const label parcelI,
160  const label nParcels,
161  const scalar time,
163  label& cellOwner,
164  label& tetFacei,
165  label& tetPti,
166  label& facei
167  );
168 
169  //- Set the parcel properties
170  virtual void setProperties
171  (
172  const label parcelI,
173  const label nParcels,
174  const scalar time,
175  typename CloudType::parcelType::trackingData& td,
176  typename CloudType::parcelType& parcel
177  );
178 
179  //- Flag to identify whether model fully describes the parcel
180  virtual bool fullyDescribed() const;
181 };
182 
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 } // End namespace Foam
187 
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 
190 #ifdef NoRepository
192 #endif
193 
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 
196 #endif
197 
198 // ************************************************************************* //
const CloudType & owner() const
Return const access to the owner cloud.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:80
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:225
Templated injection model class.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:91
Particle injection sources read from look-up table. Each row corresponds to an injection site.
virtual scalar nParcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
virtual void topoChange()
Set injector locations when mesh is updated.
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType::trackingData &td, typename CloudType::parcelType &parcel)
Set the parcel properties.
TypeName("thermoLookupTableInjection")
Runtime type information.
ThermoLookupTableInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
virtual void setPositionAndCell(const meshSearch &searchEngine, const label parcelI, const label nParcels, const scalar time, barycentric &coordinates, label &cellOwner, label &tetFacei, label &tetPti, label &facei)
Set the injection position and owner cell, tetFace and tetPt.
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.
scalar timeEnd() const
Return the end-of-injection time.
virtual scalar massToInject(const scalar time0, const scalar time1)
Parcel mass to introduce relative to SOI.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Mesh object that implements searches within the local cells and faces.
Definition: meshSearch.H:59
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:109
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:103
A class for handling words, derived from string.
Definition: word.H:63
const dimensionSet time
barycentric coordinates(const polyMesh &mesh, const point &position, const label celli, const label facei, const label faceTrii, const scalar stepFraction)
Return the coordinates given the position and tet topology.
Definition: tracking.C:1258
Namespace for OpenFOAM.
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