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-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::FieldActivatedInjection
28
29Group
30 grpLagrangianIntermediateInjectionSubModels
31
32Description
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
46SourceFiles
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
61namespace Foam
62{
63
64/*---------------------------------------------------------------------------*\
65 Class FieldActivatedInjection Declaration
66\*---------------------------------------------------------------------------*/
67
68template<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
124public:
125
126 //- Runtime type information
127 TypeName("fieldActivatedInjection");
128
129
130 // Constructors
131
132 //- Construct from dictionary
134 (
135 const dictionary& dict,
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
212#endif
213
214// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215
216#endif
217
218// ************************************************************************* //
const CloudType & owner() const
Return const access to the owner cloud.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:75
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220
Conditional injection at specified positions.
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
virtual ~FieldActivatedInjection()=default
Destructor.
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.
TypeName("fieldActivatedInjection")
Runtime type information.
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
virtual void updateMesh()
Set injector locations when mesh is updated.
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
scalar timeEnd() const
Return the end-of-injection time.
Templated injection model class.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:113
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:107
A class for handling words, derived from Foam::string.
Definition: word.H:68
Namespace for OpenFOAM.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73