initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / src / lagrangian / intermediate / submodels / Kinematic / InjectionModel / InjectionModel / InjectionModel.H
blobf19d59723fb955cf9c3e5560fbda1274f2fdee72
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 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::InjectionModel
29 Description
30     Templated injection model class
32 SourceFiles
33     InjectionModel.C
34     NewInjectionModel.C
36 \*---------------------------------------------------------------------------*/
38 #ifndef InjectionModel_H
39 #define InjectionModel_H
41 #include "IOdictionary.H"
42 #include "autoPtr.H"
43 #include "runTimeSelectionTables.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 namespace Foam
50 /*---------------------------------------------------------------------------*\
51                          Class InjectionModel Declaration
52 \*---------------------------------------------------------------------------*/
54 template<class CloudType>
55 class InjectionModel
58     // Private data
60         //- The cloud dictionary
61         const dictionary& dict_;
63         // Reference to the owner cloud class
64         CloudType& owner_;
66         //- The coefficients dictionary
67         const dictionary coeffDict_;
70 protected:
72     // Protected data
74         // Global injection properties
76             //- Start of injection [s]
77             scalar SOI_;
79             //- Total volume of parcels to introduce [m^3]
80             //  Initialised in the individual injection models
81             scalar volumeTotal_;
84         // Injection properties per Lagrangian time step
86             //- Time at start of injection time step [s]
87             scalar timeStep0_;
89             //- Number of parcels to introduce []
90             label nParcels_;
92             //- Volume of parcels to introduce [m^3]
93             scalar volume_;
96     // Protected member functions
98         //- Number of parcels to introduce over the time step
99         virtual label nParcelsToInject
100         (
101             const scalar time0,
102             const scalar time1
103         ) const = 0;
105         //- Volume of parcels to introduce over the time step
106         virtual scalar volumeToInject
107         (
108             const scalar time0,
109             const scalar time1
110         ) const = 0;
113 public:
115     //- Runtime type information
116     TypeName("InjectionModel");
118     //- Declare runtime constructor selection table
119     declareRunTimeSelectionTable
120     (
121         autoPtr,
122         InjectionModel,
123         dictionary,
124         (
125             const dictionary& dict,
126             CloudType& owner
127         ),
128         (dict, owner)
129     );
132     // Constructors
134         //- Construct from dictionary
135         InjectionModel
136         (
137             const dictionary& dict,
138             CloudType& owner,
139             const word& type
140         );
143     // Destructor
145         virtual ~InjectionModel();
148     // Selector
150         static autoPtr<InjectionModel<CloudType> > New
151         (
152             const dictionary& dict,
153             CloudType& owner
154         );
157     // Access
159         //- Return const access the owner cloud object
160         const CloudType& owner() const;
162         //- Return non-const access the owner cloud object for manipulation
163         CloudType& owner();
165         //- Return the dictionary
166         const dictionary& dict() const;
168         //- Return the coefficients dictionary
169         const dictionary& coeffDict() const;
172     // Member Functions
174         //- Flag to indicate whether model activates injection model
175         virtual bool active() const = 0;
178         // Global information
180             //- Return the start-of-injection time
181             scalar timeStart() const;
183             //- Return the total volume to be injected across the event
184             scalar volumeTotal() const;
186             //- Return the end-of-injection time
187             virtual scalar timeEnd() const = 0;
190         // Per Lagrangian time step properties
192             //- Determine properties for next time step/injection interval
193             void prepareForNextTimeStep
194             (
195                 const scalar time0,
196                 const scalar time1
197             );
199             //- Return the number of parcels to introduce
200             label nParcels() const;
202             //- Return the volume of parcels to introduce
203             scalar volume() const;
205             //- Return the volume fraction to introduce
206             scalar volumeFraction() const;
209         // Injection geometry
211             //- Return the injection position
212             virtual vector position
213             (
214                 const label iParcel,
215                 const scalar time,
216                 const polyMeshInfo& meshInfo
217             ) = 0;
219             //- Return the velocity of the parcel to introduce at a time
220             virtual vector velocity
221             (
222                 const label iParcel,
223                 const scalar time,
224                 const polyMeshInfo& meshInfo
225             ) = 0;
227             //- Return the diameter of the parcel to introduce at a time
228             virtual scalar d0
229             (
230                 const label iParcel,
231                 const scalar time
232             ) const = 0;
236 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 } // End namespace Foam
240 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242 #define makeInjectionModel(CloudType)                                         \
243                                                                               \
244     defineNamedTemplateTypeNameAndDebug(InjectionModel<CloudType>, 0);        \
245                                                                               \
246     defineTemplateRunTimeSelectionTable(InjectionModel<CloudType>, dictionary);
249 #define makeInjectionModelType(SS, CloudType, ParcelType)                     \
250                                                                               \
251     defineNamedTemplateTypeNameAndDebug(SS<CloudType<ParcelType> >, 0);       \
252                                                                               \
253     InjectionModel<CloudType<ParcelType> >::                                  \
254         adddictionaryConstructorToTable<SS<CloudType<ParcelType> > >          \
255             add##SS##CloudType##ParcelType##ConstructorToTable_;
258 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
260 #ifdef NoRepository
261 #   include "InjectionModel.C"
262 #endif
264 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
266 #endif
268 // ************************************************************************* //