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-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::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 "distribution.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 coordinates corresponding to injector positions
91  List<barycentric> injectorCoordinates_;
92 
93  //- List of cell labels corresponding to injector positions
94  labelList injectorCells_;
95 
96  //- List of tetFace labels corresponding to injector positions
97  labelList injectorTetFaces_;
98 
99  //- List of tetPt labels corresponding to injector positions
100  labelList injectorTetPts_;
101 
102  //- Mass to inject
103  const scalar massTotal_;
104 
105  //- Number of parcels per injector
106  const label nParcelsPerInjector_;
107 
108  //- List of number of parcels injected for each injector
109  labelList nParcelsInjected_;
110 
111 
112  // Parcel properties
113 
114  //- Initial parcel velocity
115  const vector U0_;
116 
117  //- List of parcel diameters
118  scalarList diameters_;
119 
120  //- Parcel size distribution model
121  const autoPtr<distribution> sizeDistribution_;
122 
123 
124 public:
125 
126  //- Runtime type information
127  TypeName("fieldActivatedInjection");
128 
129 
130  // Constructors
131 
132  //- Construct from dictionary
134  (
135  const dictionary& dict,
136  CloudType& owner,
137  const word& modelName
138  );
139 
140  //- Construct copy
142 
143  //- Construct and return a clone
145  {
147  (
149  );
150  }
151 
152 
153  //- Destructor
154  virtual ~FieldActivatedInjection();
155 
156 
157  // Member Functions
158 
159  //- Set injector locations when mesh is updated
160  virtual void topoChange();
161 
162  //- Return the end-of-injection time
163  scalar timeEnd() const;
164 
165  //- Number of parcels to introduce relative to SOI
166  virtual label nParcelsToInject(const scalar time0, const scalar time1);
167 
168  //- Parcel mass to introduce relative to SOI
169  virtual scalar massToInject(const scalar time0, const scalar time1);
170 
171 
172  // Injection geometry
173 
174  //- Set the injection position and owner cell, tetFace and tetPt
175  virtual void setPositionAndCell
176  (
177  const label parceli,
178  const label nParcels,
179  const scalar time,
180  barycentric& coordinates,
181  label& celli,
182  label& tetFacei,
183  label& tetPti,
184  label& facei
185  );
186 
187  //- Set the parcel properties
188  virtual void setProperties
189  (
190  const label parceli,
191  const label nParcels,
192  const scalar time,
193  typename CloudType::parcelType& parcel
194  );
195 
196  //- Flag to identify whether model fully describes the parcel
197  virtual bool fullyDescribed() const;
198 };
199 
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 } // End namespace Foam
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 
207 #ifdef NoRepository
208  #include "FieldActivatedInjection.C"
209 #endif
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 #endif
214 
215 // ************************************************************************* //
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
Injection at specified positions, with the conditions:
virtual void topoChange()
Set injector locations when mesh is updated.
virtual void setProperties(const label parceli, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
virtual ~FieldActivatedInjection()
Destructor.
TypeName("fieldActivatedInjection")
Runtime type information.
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.
FieldActivatedInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
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.
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
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.
Generic GeometricField class.
A primitive field of type <Type> with automated input and output.
Definition: GlobalIOField.H:50
Templated injection model class.
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
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