Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00040 
00041 
00042 
00043 
00044 
00045 
00046 
00047 
00048 #ifndef InjectionModel_H
00049 #define InjectionModel_H
00050 
00051 #include <OpenFOAM/IOdictionary.H>
00052 #include <OpenFOAM/autoPtr.H>
00053 #include <OpenFOAM/runTimeSelectionTables.H>
00054 
00055 
00056 
00057 namespace Foam
00058 {
00059 
00060 
00061 
00062 
00063 
00064 template<class CloudType>
00065 class InjectionModel
00066 {
00067 public:
00068 
00069     
00070 
00071         
00072         
00073         enum parcelBasis
00074         {
00075             pbNumber,
00076             pbMass
00077         };
00078 
00079 
00080 private:
00081 
00082     
00083 
00084         
00085         const dictionary& dict_;
00086 
00087         
00088         CloudType& owner_;
00089 
00090         
00091         const dictionary coeffDict_;
00092 
00093 
00094     
00095 
00096         
00097         void readProps();
00098 
00099         
00100         void writeProps();
00101 
00102 
00103 protected:
00104 
00105     
00106 
00107         
00108         typedef typename CloudType::parcelType parcelType;
00109 
00110         
00111 
00112             
00113             const scalar SOI_;
00114 
00115             
00116             
00117             scalar volumeTotal_;
00118 
00119             
00120             scalar massTotal_;
00121 
00122             
00123             scalar massInjected_;
00124 
00125 
00126         
00127 
00128             
00129             label nInjections_;
00130 
00131             
00132             label parcelsAddedTotal_;
00133 
00134 
00135         
00136 
00137             
00138             parcelBasis parcelBasis_;
00139 
00140             
00141             scalar time0_;
00142 
00143             
00144             scalar timeStep0_;
00145 
00146 
00147     
00148 
00149         
00150         virtual label parcelsToInject
00151         (
00152             const scalar time0,
00153             const scalar time1
00154         ) const = 0;
00155 
00156         
00157         virtual scalar volumeToInject
00158         (
00159             const scalar time0,
00160             const scalar time1
00161         ) const = 0;
00162 
00163         
00164         
00165         virtual bool validInjection(const label parcelI) = 0;
00166 
00167         
00168         virtual void prepareForNextTimeStep
00169         (
00170             const scalar time,
00171             label& newParcels,
00172             scalar& newVolume
00173         );
00174 
00175         
00176         
00177         
00178         virtual void findCellAtPosition(label& cellI, vector& position);
00179 
00180         
00181         virtual scalar setNumberOfParticles
00182         (
00183             const label parcels,
00184             const scalar volume,
00185             const scalar diameter,
00186             const scalar rho
00187         );
00188 
00189         
00190         virtual void postInjectCheck
00191         (
00192             const label parcelsAdded,
00193             const scalar massAdded
00194         );
00195 
00196 
00197 public:
00198 
00199     
00200     TypeName("InjectionModel");
00201 
00202     
00203     declareRunTimeSelectionTable
00204     (
00205         autoPtr,
00206         InjectionModel,
00207         dictionary,
00208         (
00209             const dictionary& dict,
00210             CloudType& owner
00211         ),
00212         (dict, owner)
00213     );
00214 
00215 
00216     
00217 
00218         
00219         InjectionModel(CloudType& owner);
00220 
00221         
00222         InjectionModel
00223         (
00224             const dictionary& dict,
00225             CloudType& owner,
00226             const word& type
00227         );
00228 
00229 
00230     
00231     virtual ~InjectionModel();
00232 
00233 
00234     
00235     static autoPtr<InjectionModel<CloudType> > New
00236     (
00237         const dictionary& dict,
00238         CloudType& owner
00239     );
00240 
00241 
00242     
00243 
00244         
00245         inline const dictionary& dict() const;
00246 
00247         
00248         inline const CloudType& owner() const;
00249 
00250         
00251         inline CloudType& owner();
00252 
00253         
00254         inline const dictionary& coeffDict() const;
00255 
00256 
00257     
00258 
00259         
00260         virtual bool active() const = 0;
00261 
00262 
00263         
00264 
00265             
00266             inline scalar timeStart() const;
00267 
00268             
00269             inline scalar volumeTotal() const;
00270 
00271             
00272             inline scalar massTotal() const;
00273 
00274             
00275             inline scalar massInjected() const;
00276 
00277             
00278             virtual scalar timeEnd() const = 0;
00279 
00280             
00281 
00282                 
00283                 inline label nInjections() const;
00284 
00285                 
00286                 inline label parcelsAddedTotal() const;
00287 
00288 
00289         
00290 
00291             
00292             template<class TrackData>
00293             void inject(TrackData& td);
00294 
00295 
00296         
00297 
00298             
00299             virtual void setPositionAndCell
00300             (
00301                 const label parcelI,
00302                 const label nParcels,
00303                 const scalar time,
00304                 vector& position,
00305                 label& cellOwner
00306             ) = 0;
00307 
00308             
00309             virtual void setProperties
00310             (
00311                 const label parcelI,
00312                 const label nParcels,
00313                 const scalar time,
00314                 typename CloudType::parcelType& parcel
00315             ) = 0;
00316 
00317             
00318             virtual bool fullyDescribed() const = 0;
00319 };
00320 
00321 
00322 
00323 
00324 } 
00325 
00326 
00327 
00328 #define makeInjectionModel(CloudType)                                         \
00329                                                                               \
00330     defineNamedTemplateTypeNameAndDebug(InjectionModel<CloudType>, 0);        \
00331                                                                               \
00332     defineTemplateRunTimeSelectionTable(InjectionModel<CloudType>, dictionary);
00333 
00334 
00335 #define makeInjectionModelType(SS, CloudType, ParcelType)                     \
00336                                                                               \
00337     defineNamedTemplateTypeNameAndDebug(SS<CloudType<ParcelType> >, 0);       \
00338                                                                               \
00339     InjectionModel<CloudType<ParcelType> >::                                  \
00340         adddictionaryConstructorToTable<SS<CloudType<ParcelType> > >          \
00341             add##SS##CloudType##ParcelType##ConstructorToTable_;
00342 
00343 
00344 #define makeInjectionModelThermoType(SS, CloudType, ParcelType, ThermoType)   \
00345                                                                               \
00346     defineNamedTemplateTypeNameAndDebug                                       \
00347     (                                                                         \
00348         SS<CloudType<ParcelType<ThermoType> > >,                              \
00349         0                                                                     \
00350     );                                                                        \
00351                                                                               \
00352     InjectionModel<CloudType<ParcelType<ThermoType> > >::                     \
00353         adddictionaryConstructorToTable                                       \
00354         <SS<CloudType<ParcelType<ThermoType> > > >                            \
00355             add##SS##CloudType##ParcelType##ThermoType##ConstructorToTable_;
00356 
00357 
00358 
00359 
00360 
00361 #include "InjectionModelI.H"
00362 
00363 
00364 
00365 #ifdef NoRepository
00366 #   include <lagrangianIntermediate/InjectionModel.C>
00367 #endif
00368 
00369 
00370 
00371 #endif
00372 
00373