FreeFOAM The Cross-Platform CFD Toolkit
PatchInjection.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) 2009-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::PatchInjection
26 
27 Description
28  Patch injection
29 
30  - User specifies
31  - Total mass to inject
32  - Name of patch
33  - Injection duration
34  - Initial parcel velocity
35  - Injection volume flow rate
36  - Parcel diameters obtained by PDF model
37  - Parcels injected at cell centres adjacent to patch
38 
39 SourceFiles
40  PatchInjection.C
41 
42 \*---------------------------------------------------------------------------*/
43 
44 #ifndef PatchInjection_H
45 #define PatchInjection_H
46 
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 template<class Type>
55 class DataEntry;
56 
57 class pdf;
58 
59 /*---------------------------------------------------------------------------*\
60  Class PatchInjection Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 template<class CloudType>
65 :
66  public InjectionModel<CloudType>
67 {
68  // Private data
69 
70  //- Name of patch
71  const word patchName_;
72 
73  //- Injection duration [s]
74  const scalar duration_;
75 
76  //- Number of parcels to introduce per second []
77  const label parcelsPerSecond_;
78 
79  //- Initial parcel velocity [m/s]
80  const vector U0_;
81 
82  //- Volume flow rate of parcels to introduce relative to SOI [m^3/s]
83  const autoPtr<DataEntry<scalar> > volumeFlowRate_;
84 
85  //- Parcel size PDF model
86  const autoPtr<pdfs::pdf> parcelPDF_;
87 
88  //- Cell owners
89  labelList cellOwners_;
90 
91  //- Fraction of injection controlled by this processor
92  scalar fraction_;
93 
94 
95 protected:
96 
97  // Protected member functions
98 
99  //- Number of parcels to introduce over the time step relative to SOI
100  label parcelsToInject
101  (
102  const scalar time0,
103  const scalar time1
104  ) const;
105 
106  //- Volume of parcels to introduce over the time step relative to SOI
107  scalar volumeToInject
108  (
109  const scalar time0,
110  const scalar time1
111  ) const;
112 
113 
114 public:
115 
116  //- Runtime type information
117  TypeName("PatchInjection");
118 
119 
120  // Constructors
121 
122  //- Construct from dictionary
124  (
125  const dictionary& dict,
126  CloudType& owner
127  );
128 
129 
130  //- Destructor
131  virtual ~PatchInjection();
132 
133 
134  // Member Functions
135 
136  //- Flag to indicate whether model activates injection model
137  bool active() const;
138 
139  //- Return the end-of-injection time
140  scalar timeEnd() const;
141 
142 
143  // Injection geometry
144 
145  //- Set the injection position and owner cell
146  virtual void setPositionAndCell
147  (
148  const label parcelI,
149  const label nParcels,
150  const scalar time,
151  vector& position,
152  label& cellOwner
153  );
154 
155  virtual void setProperties
156  (
157  const label parcelI,
158  const label nParcels,
159  const scalar time,
160  typename CloudType::parcelType& parcel
161  );
162 
163  //- Flag to identify whether model fully describes the parcel
164  virtual bool fullyDescribed() const;
165 
166  //- Return flag to identify whether or not injection of parcelI is
167  // permitted
168  virtual bool validInjection(const label parcelI);
169 };
170 
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 } // End namespace Foam
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 #ifdef NoRepository
179 # include "PatchInjection.C"
180 #endif
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 #endif
185 
186 // ************************ vim: set sw=4 sts=4 et: ************************ //