initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / lagrangian / intermediate / submodels / Kinematic / InjectionModel / PatchInjection / PatchInjection.H
blob05117ce3be46f62a559ec7977d708cd35d5cd796
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2009-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
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.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::PatchInjection
28 Description
29     Patch injection
31     - User specifies
32       - Total mass to inject
33       - Name of patch
34       - Injection duration
35       - Initial parcel velocity
36       - Injection volume flow rate
37     - Parcel diameters obtained by PDF model
38     - Parcels injected at cell centres adjacent to patch
40 SourceFiles
41     PatchInjection.C
43 \*---------------------------------------------------------------------------*/
45 #ifndef PatchInjection_H
46 #define PatchInjection_H
48 #include "InjectionModel.H"
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 namespace Foam
55 template<class Type>
56 class DataEntry;
58 class pdf;
60 /*---------------------------------------------------------------------------*\
61                        Class PatchInjection Declaration
62 \*---------------------------------------------------------------------------*/
64 template<class CloudType>
65 class PatchInjection
67     public InjectionModel<CloudType>
69     // Private data
71         //- Name of patch
72         const word patchName_;
74         //- Injection duration [s]
75         const scalar duration_;
77         //- Number of parcels to introduce per second []
78         const label parcelsPerSecond_;
80         //- Initial parcel velocity [m/s]
81         const vector U0_;
83         //- Volume flow rate of parcels to introduce relative to SOI [m^3/s]
84         const autoPtr<DataEntry<scalar> > volumeFlowRate_;
86         //- Parcel size PDF model
87         const autoPtr<pdf> parcelPDF_;
89         //- Cell owners
90         labelList cellOwners_;
92         //- Fraction of injection controlled by this processor
93         scalar fraction_;
96 protected:
98     // Protected member functions
100         //- Number of parcels to introduce over the time step relative to SOI
101         label parcelsToInject
102         (
103             const scalar time0,
104             const scalar time1
105         ) const;
107         //- Volume of parcels to introduce over the time step relative to SOI
108         scalar volumeToInject
109         (
110             const scalar time0,
111             const scalar time1
112         ) const;
115 public:
117     //- Runtime type information
118     TypeName("PatchInjection");
121     // Constructors
123         //- Construct from dictionary
124         PatchInjection
125         (
126             const dictionary& dict,
127             CloudType& owner
128         );
131     //- Destructor
132     virtual ~PatchInjection();
135     // Member Functions
137         //- Flag to indicate whether model activates injection model
138         bool active() const;
140         //- Return the end-of-injection time
141         scalar timeEnd() const;
144         // Injection geometry
146             //- Set the injection position and owner cell
147             virtual void setPositionAndCell
148             (
149                 const label parcelI,
150                 const label nParcels,
151                 const scalar time,
152                 vector& position,
153                 label& cellOwner
154             );
156             virtual void setProperties
157             (
158                 const label parcelI,
159                 const label nParcels,
160                 const scalar time,
161                 typename CloudType::parcelType& parcel
162             );
164             //- Flag to identify whether model fully describes the parcel
165             virtual bool fullyDescribed() const;
167             //- Return flag to identify whether or not injection of parcelI is
168             //  permitted
169             virtual bool validInjection(const label parcelI);
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 } // End namespace Foam
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 #ifdef NoRepository
180 #   include "PatchInjection.C"
181 #endif
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 #endif
187 // ************************************************************************* //