FieldActivatedInjection.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-2018 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  \verbatim
32  factor*referenceField[celli] >= thresholdField[celli]
33  \endverbatim
34  where:
35  - \c referenceField is the field used to supply the look-up values
36  - \c thresholdField supplies the values beyond which the injection is
37  permitted.
38 
39  Limited to a user-supplied 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 #include "GlobalIOField.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
76  const volScalarField& referenceField_;
77 
78  //- Threshold field
79  const volScalarField& thresholdField_;
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
88  GlobalIOField<vector> positions_;
89 
90  //- List of cell labels corresponding to injector positions
91  labelList injectorCells_;
92 
93  //- List of tetFace labels corresponding to injector positions
94  labelList injectorTetFaces_;
95 
96  //- List of tetPt labels corresponding to injector positions
97  labelList injectorTetPts_;
98 
99  //- Number of parcels per injector
100  const label nParcelsPerInjector_;
101 
102  //- List of number of parcels injected for each injector
103  labelList nParcelsInjected_;
104 
105 
106  // Parcel properties
107 
108  //- Initial parcel velocity
109  const vector U0_;
110 
111  //- List of parcel diameters
112  scalarList diameters_;
113 
114  //- Parcel size distribution model
116  sizeDistribution_;
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
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 // ************************************************************************* //
scalar timeEnd() const
Return the end-of-injection time.
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
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Templated injection model class.
virtual void updateMesh()
Set injector locations when mesh is updated.
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:104
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
const CloudType & owner() const
Return const access to the owner cloud.
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 bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is.
virtual ~FieldActivatedInjection()
Destructor.
A class for handling words, derived from string.
Definition: word.H:59
IOField with global data (so optionally read from master)
Definition: GlobalIOField.H:50
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:218
Injection at specified positions, with the conditions:
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
FieldActivatedInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
TypeName("fieldActivatedInjection")
Runtime type information.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:69
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
Namespace for OpenFOAM.