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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::FieldActivatedInjection
28 
29 Group
30  grpLagrangianIntermediateInjectionSubModels
31 
32 Description
33  Conditional injection at specified positions.
34 
35  For injection to be allowed
36  \verbatim
37  factor*referenceField[celli] >= thresholdField[celli]
38  \endverbatim
39  where:
40  - \c referenceField is the field used to supply the look-up values
41  - \c thresholdField supplies the values beyond which the injection is
42  permitted.
43 
44  Limited to a user-supplied number of injections per injector location
45 
46 SourceFiles
47  FieldActivatedInjection.C
48 
49 \*---------------------------------------------------------------------------*/
50 
51 #ifndef FieldActivatedInjection_H
52 #define FieldActivatedInjection_H
53 
54 #include "InjectionModel.H"
55 #include "distributionModel.H"
56 #include "volFieldsFwd.H"
57 #include "globalIOFields.H"
58 
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 
61 namespace Foam
62 {
63 
64 /*---------------------------------------------------------------------------*\
65  Class FieldActivatedInjection Declaration
66 \*---------------------------------------------------------------------------*/
67 
68 template<class CloudType>
70 :
71  public InjectionModel<CloudType>
72 {
73  // Private data
74 
75  // Model parameters
76 
77  //- Factor to apply to reference field
78  const scalar factor_;
79 
80  //- Reference field
81  const volScalarField& referenceField_;
82 
83  //- Threshold field
84  const volScalarField& thresholdField_;
85 
86 
87  // Injector properties
88 
89  //- Name of file containing positions data
90  const word positionsFile_;
91 
92  //- Field of injector (x,y,z) positions
93  vectorGlobalIOField positions_;
94 
95  //- List of cell labels corresponding to injector positions
96  labelList injectorCells_;
97 
98  //- List of tetFace labels corresponding to injector positions
99  labelList injectorTetFaces_;
100 
101  //- List of tetPt labels corresponding to injector positions
102  labelList injectorTetPts_;
103 
104  //- Number of parcels per injector
105  const label nParcelsPerInjector_;
106 
107  //- List of number of parcels injected for each injector
108  labelList nParcelsInjected_;
109 
110 
111  // Parcel properties
112 
113  //- Initial parcel velocity
114  const vector U0_;
115 
116  //- List of parcel diameters
117  scalarList diameters_;
118 
119  //- Parcel size distribution model
121  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() = default;
155 
156 
157  // Member Functions
158 
159  //- Set injector locations when mesh is updated
160  virtual void updateMesh();
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 parcelsToInject(const scalar time0, const scalar time1);
167 
168  //- Volume of parcels to introduce relative to SOI
169  virtual scalar volumeToInject(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  vector& position,
181  label& cellOwner,
182  label& tetFacei,
183  label& tetPti
184  );
185 
186  //- Set the parcel properties
187  virtual void setProperties
188  (
189  const label parcelI,
190  const label nParcels,
191  const scalar time,
192  typename CloudType::parcelType& parcel
193  );
194 
195  //- Flag to identify whether model fully describes the parcel
196  virtual bool fullyDescribed() const;
197 
198  //- Return flag to identify whether or not injection of parcelI is
199  // permitted
200  virtual bool validInjection(const label parcelI);
201 };
202 
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 } // End namespace Foam
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 #ifdef NoRepository
211  #include "FieldActivatedInjection.C"
212 #endif
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 #endif
217 
218 // ************************************************************************* //
volFieldsFwd.H
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::FieldActivatedInjection::TypeName
TypeName("fieldActivatedInjection")
Runtime type information.
Foam::FieldActivatedInjection::FieldActivatedInjection
FieldActivatedInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
Definition: FieldActivatedInjection.C:39
Foam::InjectionModel
Templated injection model class.
Definition: InjectionModel.H:73
Foam::GlobalIOField< vector >
Foam::FieldActivatedInjection::fullyDescribed
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
Definition: FieldActivatedInjection.C:254
Foam::subModelBase::modelName
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:107
InjectionModel.H
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:219
globalIOFields.H
Foam::subModelBase::dict
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:113
FieldActivatedInjection.C
Foam::CloudSubModelBase::owner
const CloudType & owner() const
Return const access to the owner cloud.
Definition: CloudSubModelBase.C:106
Foam::FieldActivatedInjection::updateMesh
virtual void updateMesh()
Set injector locations when mesh is updated.
Definition: FieldActivatedInjection.C:138
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:71
Foam::FieldActivatedInjection::clone
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
Definition: FieldActivatedInjection.H:143
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::FieldActivatedInjection::parcelsToInject
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
Definition: FieldActivatedInjection.C:187
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::FieldActivatedInjection::volumeToInject
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
Definition: FieldActivatedInjection.C:203
Foam::FieldActivatedInjection::timeEnd
scalar timeEnd() const
Return the end-of-injection time.
Definition: FieldActivatedInjection.C:179
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::FieldActivatedInjection
Conditional injection at specified positions.
Definition: FieldActivatedInjection.H:68
Foam::FieldActivatedInjection::~FieldActivatedInjection
virtual ~FieldActivatedInjection()=default
Destructor.
Foam::Vector< scalar >
Foam::List< label >
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:238
Foam::FieldActivatedInjection::validInjection
virtual bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is.
Definition: FieldActivatedInjection.C:262
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220
Foam::GeometricField< scalar, fvPatchField, volMesh >
distributionModel.H