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