MomentumLookupTableInjection.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-2023 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::MomentumLookupTableInjection
26 
27 Description
28  Particle injection sources read from look-up table. Each row corresponds to
29  an injection site.
30 
31  \verbatim
32  (
33  (x y z) (u v w) d rho mDot // injector 1
34  (x y z) (u v w) d rho mDot // injector 2
35  ...
36  (x y z) (u v w) d rho mDot // injector N
37  );
38  \endverbatim
39 
40  where:
41  \plaintable
42  x, y, z | global cartesian co-ordinates [m]
43  u, v, w | global cartesian velocity components [m/s]
44  d | diameter [m]
45  rho | density [kg/m^3]
46  mDot | mass flow rate [kg/s]
47  \endplaintable
48 
49 SourceFiles
50  MomentumLookupTableInjection.C
51 
52 \*---------------------------------------------------------------------------*/
53 
54 #ifndef MomentumLookupTableInjection_H
55 #define MomentumLookupTableInjection_H
56 
57 #include "InjectionModel.H"
59 
60 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61 
62 namespace Foam
63 {
64 
65 /*---------------------------------------------------------------------------*\
66  Class MomentumLookupTableInjection Declaration
67 \*---------------------------------------------------------------------------*/
68 
69 template<class CloudType>
70 class MomentumLookupTableInjection
71 :
72  public InjectionModel<CloudType>
73 {
74  // Private Data
75 
76  //- Name of file containing injector/parcel data
77  const word inputFileName_;
78 
79  //- Injection duration - common to all injection sources
80  const scalar duration_;
81 
82  //- Number of parcels per injector - common to all injection sources
83  const TimeFunction1<scalar> parcelsPerSecond_;
84 
85  //- Flag to indicate to randomise injection positions
86  bool randomise_;
87 
88  //- List of injectors
90 
91  //- List of coordinates corresponding to injector positions
92  List<barycentric> injectorCoordinates_;
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("momentumLookupTableInjection");
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
122  (
124  );
125 
126  //- Construct and return a clone
128  {
130  (
132  );
133  }
134 
135 
136  //- Destructor
138 
139 
140  // Member Functions
141 
142  //- Set injector locations when mesh is updated
143  virtual void topoChange();
144 
145  //- Return the end-of-injection time
146  virtual scalar timeEnd() const;
147 
148  //- Number of parcels to introduce relative to SOI
149  virtual label nParcelsToInject(const scalar time0, const scalar time1);
150 
151  //- Parcel mass to introduce relative to SOI
152  virtual scalar massToInject(const scalar time0, const scalar time1);
153 
154 
155  // Injection geometry
156 
157  //- Set the injection position and owner cell, tetFace and tetPt
158  virtual void setPositionAndCell
159  (
160  const label parcelI,
161  const label nParcels,
162  const scalar time,
163  barycentric& coordinates,
164  label& celli,
165  label& tetFacei,
166  label& tetPti,
167  label& facei
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 
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:79
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:221
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 void topoChange()
Set injector locations when mesh is updated.
TypeName("momentumLookupTableInjection")
Runtime type information.
virtual void setPositionAndCell(const label parcelI, const label nParcels, const scalar time, barycentric &coordinates, label &celli, label &tetFacei, label &tetPti, label &facei)
Set the injection position and owner cell, tetFace and tetPt.
MomentumLookupTableInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
virtual label nParcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
virtual 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 keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:104
A class for handling words, derived from string.
Definition: word.H:62
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