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