FieldActivatedInjection.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-2012 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::FieldActivatedInjection
26 
27 Description
28  Conditional injection at specified positions.
29 
30  For injection to be allowed, the equality must be satisfied:
31 
32  factor*referenceField[cellI] >= thresholdField[cellI]
33 
34  Where:
35  - referenceField is the field used to supply the look-up values
36  - thresholdField supplies the values beyond which the injection is
37  permitted
38 
39  Note:
40  - Limited to a user-supplied number of injections per injector location
41 
42 SourceFiles
43  FieldActivatedInjection.C
44 
45 \*---------------------------------------------------------------------------*/
46 
47 #ifndef FieldActivatedInjection_H
48 #define FieldActivatedInjection_H
49 
50 #include "InjectionModel.H"
51 #include "distributionModel.H"
52 #include "volFieldsFwd.H"
53 
54 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 
56 namespace Foam
57 {
58 
59 /*---------------------------------------------------------------------------*\
60  Class FieldActivatedInjection Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 template<class CloudType>
65 :
66  public InjectionModel<CloudType>
67 {
68  // Private data
69 
70  // Model parameters
71 
72  //- Factor to apply to reference field
73  const scalar factor_;
74 
75  //- Reference field
77 
78  //- Threshold field
80 
81 
82  // Injector properties
83 
84  //- Name of file containing positions data
85  const word positionsFile_;
86 
87  //- Field of injector (x,y,z) positions
89 
90  //- List of cell labels corresponding to injector positions
92 
93  //- List of tetFace labels corresponding to injector positions
95 
96  //- List of tetPt labels corresponding to injector positions
98 
99  //- Number of parcels per injector
101 
102  //- List of number of parcels injected for each injector
104 
105 
106  // Parcel properties
107 
108  //- Initial parcel velocity
109  const vector U0_;
110 
111  //- List of parcel diameters
113 
114  //- Parcel size distribution model
117 
118 
119 public:
120 
121  //- Runtime type information
122  TypeName("fieldActivatedInjection");
123 
124 
125  // Constructors
126 
127  //- Construct from dictionary
129  (
130  const dictionary& dict,
131  CloudType& owner,
132  const word& modelName
133  );
134 
135  //- Construct copy
137 
138  //- Construct and return a clone
139  virtual autoPtr<InjectionModel<CloudType> > clone() const
140  {
142  (
144  );
145  }
146 
147 
148  //- Destructor
149  virtual ~FieldActivatedInjection();
150 
151 
152  // Member Functions
153 
154  //- Set injector locations when mesh is updated
155  virtual void updateMesh();
156 
157  //- Return the end-of-injection time
158  scalar timeEnd() const;
159 
160  //- Number of parcels to introduce relative to SOI
161  virtual label parcelsToInject(const scalar time0, const scalar time1);
162 
163  //- Volume of parcels to introduce relative to SOI
164  virtual scalar volumeToInject(const scalar time0, const scalar time1);
165 
166 
167  // Injection geometry
168 
169  //- Set the injection position and owner cell, tetFace and tetPt
170  virtual void setPositionAndCell
171  (
172  const label parcelI,
173  const label nParcels,
174  const scalar time,
175  vector& position,
176  label& cellOwner,
177  label& tetFaceI,
178  label& tetPtI
179  );
180 
181  //- Set the parcel properties
182  virtual void setProperties
183  (
184  const label parcelI,
185  const label nParcels,
186  const scalar time,
187  typename CloudType::parcelType& parcel
188  );
189 
190  //- Flag to identify whether model fully describes the parcel
191  virtual bool fullyDescribed() const;
192 
193  //- Return flag to identify whether or not injection of parcelI is
194  // permitted
195  virtual bool validInjection(const label parcelI);
196 };
197 
198 
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 
201 } // End namespace Foam
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 #ifdef NoRepository
206 # include "FieldActivatedInjection.C"
207 #endif
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 #endif
212 
213 // ************************************************************************* //
Foam::FieldActivatedInjection::sizeDistribution_
const autoPtr< distributionModels::distributionModel > sizeDistribution_
Parcel size distribution model.
Definition: FieldActivatedInjection.H:115
volFieldsFwd.H
Foam::FieldActivatedInjection::referenceField_
const volScalarField & referenceField_
Reference field.
Definition: FieldActivatedInjection.H:75
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::IOField< vector >
Foam::FieldActivatedInjection::positionsFile_
const word positionsFile_
Name of file containing positions data.
Definition: FieldActivatedInjection.H:84
Foam::FieldActivatedInjection::U0_
const vector U0_
Initial parcel velocity.
Definition: FieldActivatedInjection.H:108
Foam::FieldActivatedInjection::injectorTetPts_
labelList injectorTetPts_
List of tetPt labels corresponding to injector positions.
Definition: FieldActivatedInjection.H:96
Foam::FieldActivatedInjection::TypeName
TypeName("fieldActivatedInjection")
Runtime type information.
Foam::FieldActivatedInjection::~FieldActivatedInjection
virtual ~FieldActivatedInjection()
Destructor.
Definition: FieldActivatedInjection.C:129
Foam::FieldActivatedInjection::thresholdField_
const volScalarField & thresholdField_
Threshold field.
Definition: FieldActivatedInjection.H:78
Foam::FieldActivatedInjection::FieldActivatedInjection
FieldActivatedInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
Definition: FieldActivatedInjection.C:36
Foam::InjectionModel
Templated injection model class.
Definition: InjectionModel.H:67
Foam::CloudSubModelBase::owner
const CloudType & owner() const
Return const access to the owner cloud.
Definition: CloudSubModelBase.C:103
Foam::FieldActivatedInjection::fullyDescribed
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
Definition: FieldActivatedInjection.C:232
Foam::subModelBase::modelName
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:104
InjectionModel.H
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
FieldActivatedInjection.C
Foam::FieldActivatedInjection::injectorTetFaces_
labelList injectorTetFaces_
List of tetFace labels corresponding to injector positions.
Definition: FieldActivatedInjection.H:93
Foam::FieldActivatedInjection::updateMesh
virtual void updateMesh()
Set injector locations when mesh is updated.
Definition: FieldActivatedInjection.C:136
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:68
Foam::FieldActivatedInjection::factor_
const scalar factor_
Factor to apply to reference field.
Definition: FieldActivatedInjection.H:72
Foam::FieldActivatedInjection::clone
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
Definition: FieldActivatedInjection.H:138
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::FieldActivatedInjection::parcelsToInject
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
Definition: FieldActivatedInjection.C:161
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::FieldActivatedInjection::volumeToInject
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
Definition: FieldActivatedInjection.C:179
Foam::FieldActivatedInjection::timeEnd
scalar timeEnd() const
Return the end-of-injection time.
Definition: FieldActivatedInjection.C:153
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::FieldActivatedInjection
Conditional injection at specified positions.
Definition: FieldActivatedInjection.H:63
Foam::FieldActivatedInjection::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: FieldActivatedInjection.C:197
Foam::FieldActivatedInjection::positions_
vectorIOField positions_
Field of injector (x,y,z) positions.
Definition: FieldActivatedInjection.H:87
Foam::FieldActivatedInjection::diameters_
scalarList diameters_
List of parcel diameters.
Definition: FieldActivatedInjection.H:111
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::FieldActivatedInjection::setProperties
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
Definition: FieldActivatedInjection.C:216
Foam::FieldActivatedInjection::injectorCells_
labelList injectorCells_
List of cell labels corresponding to injector positions.
Definition: FieldActivatedInjection.H:90
Foam::FieldActivatedInjection::validInjection
virtual bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is.
Definition: FieldActivatedInjection.C:240
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:217
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Foam::FieldActivatedInjection::nParcelsInjected_
labelList nParcelsInjected_
List of number of parcels injected for each injector.
Definition: FieldActivatedInjection.H:102
distributionModel.H
Foam::FieldActivatedInjection::nParcelsPerInjector_
const label nParcelsPerInjector_
Number of parcels per injector.
Definition: FieldActivatedInjection.H:99