FreeFOAM The Cross-Platform CFD Toolkit
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) 2008-2010 OpenCFD Ltd.
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 
50 #include <pdf/pdf.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  //- Field of cell labels corresponding to injector positions
90  labelList injectorCells_;
91 
92  //- Number of parcels per injector
93  const label nParcelsPerInjector_;
94 
95  //- Field of number of parcels injected for each injector
96  labelList nParcelsInjected_;
97 
98 
99  // Parcel properties
100 
101  //- Initial parcel velocity
102  const vector U0_;
103 
104  //- Field of parcel diameters
105  scalarList diameters_;
106 
107  //- Parcel size PDF model
108  const autoPtr<pdfs::pdf> parcelPDF_;
109 
110 
111 protected:
112 
113  // Protected member functions
114 
115  //- Number of parcels to introduce over the time step relative to SOI
116  label parcelsToInject
117  (
118  const scalar time0,
119  const scalar time1
120  ) const;
121 
122  //- Volume of parcels to introduce over the time step relative to SOI
123  scalar volumeToInject
124  (
125  const scalar time0,
126  const scalar time1
127  ) const;
128 
129 
130 public:
131 
132  //- Runtime type information
133  TypeName("FieldActivatedInjection");
134 
135 
136  // Constructors
137 
138  //- Construct from dictionary
140  (
141  const dictionary& dict,
142  CloudType& owner
143  );
144 
145 
146  // Destructor
147  virtual ~FieldActivatedInjection();
148 
149 
150  // Member Functions
151 
152  //- Flag to indicate whether model activates injection model
153  bool active() const;
154 
155  //- Return the end-of-injection time
156  scalar timeEnd() const;
157 
158 
159  // Injection geometry
160 
161  //- Set the injection position and owner cell
162  virtual void setPositionAndCell
163  (
164  const label parcelI,
165  const label nParcels,
166  const scalar time,
167  vector& position,
168  label& cellOwner
169  );
170 
171  //- Set the parcel properties
172  virtual void setProperties
173  (
174  const label parcelI,
175  const label nParcels,
176  const scalar time,
177  typename CloudType::parcelType& parcel
178  );
179 
180  //- Flag to identify whether model fully describes the parcel
181  virtual bool fullyDescribed() const;
182 
183  //- Return flag to identify whether or not injection of parcelI is
184  // permitted
185  virtual bool validInjection(const label parcelI);
186 };
187 
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 } // End namespace Foam
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 #ifdef NoRepository
196 # include "FieldActivatedInjection.C"
197 #endif
198 
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 
201 #endif
202 
203 // ************************ vim: set sw=4 sts=4 et: ************************ //