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 | Copyright (C) 2011-2013 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/m3]
43  mDot = mass flow rate [kg/m3]
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  scalar duration_;
79 
80  //- Number of parcels per injector - common to all injection sources
81  const scalar parcelsPerSecond_;
82 
83  //- Flag to indicate to randomise injection positions
84  bool randomise_;
85 
86  //- List of injectors
88 
89  //- List of cell labels corresoponding to injector positions
91 
92  //- List of tetFace labels corresoponding to injector positions
94 
95  //- List of tetPt labels corresoponding to injector positions
97 
98 
99 public:
100 
101  //- Runtime type information
102  TypeName("thermoLookupTableInjection");
103 
104 
105  // Constructors
106 
107  //- Construct from dictionary
109  (
110  const dictionary& dict,
111  CloudType& owner,
112  const word& modelName
113  );
114 
115  //- Construct copy from owner cloud and injection model
117  (
118  CloudType& owner,
120  );
121 
122  //- Construct and return a clone using supplied owner cloud
123  virtual autoPtr<InjectionModel<CloudType> > clone() const
124  {
126  (
128  );
129  }
130 
131 
132  //- Destructor
133  virtual ~ThermoLookupTableInjection();
134 
135 
136  // Member Functions
137 
138  //- Set injector locations when mesh is updated
139  virtual void updateMesh();
140 
141  //- Return the end-of-injection time
142  scalar timeEnd() const;
143 
144  //- Number of parcels to introduce relative to SOI
145  virtual label parcelsToInject(const scalar time0, const scalar time1);
146 
147  //- Volume of parcels to introduce relative to SOI
148  virtual scalar volumeToInject(const scalar time0, const scalar time1);
149 
150 
151 
152  // Injection geometry
153 
154  //- Set the injection position and owner cell, tetFace and tetPt
155  virtual void setPositionAndCell
156  (
157  const label parcelI,
158  const label nParcels,
159  const scalar time,
160  vector& position,
161  label& cellOwner,
162  label& tetFaceI,
163  label& tetPtI
164  );
165 
166  //- Set the parcel properties
167  virtual void setProperties
168  (
169  const label parcelI,
170  const label nParcels,
171  const scalar time,
172  typename CloudType::parcelType& parcel
173  );
174 
175  //- Flag to identify whether model fully describes the parcel
176  virtual bool fullyDescribed() const
177  {
178  return true;
179  }
180 
181  //- Return flag to identify whether or not injection of parcelI is
182  // permitted
183  virtual bool validInjection(const label parcelI);
184 };
185 
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 } // End namespace Foam
190 
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 
193 #ifdef NoRepository
195 #endif
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 #endif
200 
201 // ************************************************************************* //
Foam::ThermoLookupTableInjection::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: ThermoLookupTableInjection.C:172
Foam::ThermoLookupTableInjection::duration_
scalar duration_
Injection duration - common to all injection sources.
Definition: ThermoLookupTableInjection.H:77
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::ThermoLookupTableInjection::validInjection
virtual bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is.
Definition: ThermoLookupTableInjection.C:236
Foam::ThermoLookupTableInjection::volumeToInject
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
Definition: ThermoLookupTableInjection.C:152
Foam::ThermoLookupTableInjection::fullyDescribed
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
Definition: ThermoLookupTableInjection.H:175
Foam::InjectionModel
Templated injection model class.
Definition: InjectionModel.H:67
Foam::ThermoLookupTableInjection::randomise_
bool randomise_
Flag to indicate to randomise injection positions.
Definition: ThermoLookupTableInjection.H:83
Foam::CloudSubModelBase::owner
const CloudType & owner() const
Return const access to the owner cloud.
Definition: CloudSubModelBase.C:103
Foam::subModelBase::modelName
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:104
InjectionModel.H
Foam::ThermoLookupTableInjection::setProperties
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
Definition: ThermoLookupTableInjection.C:202
Foam::ThermoLookupTableInjection::injectorTetFaces_
labelList injectorTetFaces_
List of tetFace labels corresoponding to injector positions.
Definition: ThermoLookupTableInjection.H:92
Foam::ThermoLookupTableInjection::inputFileName_
const word inputFileName_
Name of file containing injector/parcel data.
Definition: ThermoLookupTableInjection.H:74
Foam::label
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
Foam::subModelBase::dict
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
Foam::ThermoLookupTableInjection::timeEnd
scalar timeEnd() const
Return the end-of-injection time.
Definition: ThermoLookupTableInjection.C:126
Foam::ThermoLookupTableInjection::TypeName
TypeName("thermoLookupTableInjection")
Runtime type information.
Foam::ThermoLookupTableInjection::~ThermoLookupTableInjection
virtual ~ThermoLookupTableInjection()
Destructor.
Definition: ThermoLookupTableInjection.C:102
Foam::ThermoLookupTableInjection::parcelsPerSecond_
const scalar parcelsPerSecond_
Number of parcels per injector - common to all injection sources.
Definition: ThermoLookupTableInjection.H:80
Foam::ThermoLookupTableInjection::injectorTetPts_
labelList injectorTetPts_
List of tetPt labels corresoponding to injector positions.
Definition: ThermoLookupTableInjection.H:95
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:68
Foam::ThermoLookupTableInjection::injectorCells_
labelList injectorCells_
List of cell labels corresoponding to injector positions.
Definition: ThermoLookupTableInjection.H:89
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
ThermoLookupTableInjection.C
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::Vector< scalar >
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::IOList< kinematicParcelInjectionData >
Foam::ThermoLookupTableInjection
Particle injection sources read from look-up table. Each row corresponds to an injection site.
Definition: ThermoLookupTableInjection.H:67
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:217
Foam::ThermoLookupTableInjection::ThermoLookupTableInjection
ThermoLookupTableInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
Definition: ThermoLookupTableInjection.C:33
kinematicParcelInjectionDataIOList.H
Foam::ThermoLookupTableInjection::injectors_
kinematicParcelInjectionDataIOList injectors_
List of injectors.
Definition: ThermoLookupTableInjection.H:86
Foam::ThermoLookupTableInjection::updateMesh
virtual void updateMesh()
Set injector locations when mesh is updated.
Definition: ThermoLookupTableInjection.C:109
Foam::ThermoLookupTableInjection::parcelsToInject
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
Definition: ThermoLookupTableInjection.C:134
Foam::ThermoLookupTableInjection::clone
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone using supplied owner cloud.
Definition: ThermoLookupTableInjection.H:122