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 #include "ReactingLookupTableInjection.H"
00027
00028
00029
00030 template<class CloudType>
00031 Foam::label Foam::ReactingLookupTableInjection<CloudType>::parcelsToInject
00032 (
00033 const scalar time0,
00034 const scalar time1
00035 ) const
00036 {
00037 if ((time0 >= 0.0) && (time0 < duration_))
00038 {
00039 return round(injectorCells_.size()*(time1 - time0)*nParcelsPerSecond_);
00040 }
00041 else
00042 {
00043 return 0;
00044 }
00045 }
00046
00047
00048 template<class CloudType>
00049 Foam::scalar Foam::ReactingLookupTableInjection<CloudType>::volumeToInject
00050 (
00051 const scalar time0,
00052 const scalar time1
00053 ) const
00054 {
00055 scalar volume = 0.0;
00056 if ((time0 >= 0.0) && (time0 < duration_))
00057 {
00058 forAll(injectors_, i)
00059 {
00060 volume += injectors_[i].mDot()/injectors_[i].rho()*(time1 - time0);
00061 }
00062 }
00063
00064 return volume;
00065 }
00066
00067
00068
00069
00070 template<class CloudType>
00071 Foam::ReactingLookupTableInjection<CloudType>::ReactingLookupTableInjection
00072 (
00073 const dictionary& dict,
00074 CloudType& owner
00075 )
00076 :
00077 InjectionModel<CloudType>(dict, owner, typeName),
00078 inputFileName_(this->coeffDict().lookup("inputFile")),
00079 duration_(readScalar(this->coeffDict().lookup("duration"))),
00080 nParcelsPerSecond_
00081 (
00082 readScalar(this->coeffDict().lookup("parcelsPerSecond"))
00083 ),
00084 injectors_
00085 (
00086 IOobject
00087 (
00088 inputFileName_,
00089 owner.db().time().constant(),
00090 owner.db(),
00091 IOobject::MUST_READ,
00092 IOobject::NO_WRITE
00093 )
00094 ),
00095 injectorCells_(0)
00096 {
00097
00098 injectorCells_.setSize(injectors_.size());
00099 forAll(injectors_, i)
00100 {
00101 this->findCellAtPosition(injectorCells_[i], injectors_[i].x());
00102 }
00103
00104
00105 this->volumeTotal_ = 0.0;
00106 forAll(injectors_, i)
00107 {
00108 this->volumeTotal_ += injectors_[i].mDot()/injectors_[i].rho();
00109 }
00110 this->volumeTotal_ *= duration_;
00111 }
00112
00113
00114
00115
00116 template<class CloudType>
00117 Foam::ReactingLookupTableInjection<CloudType>::~ReactingLookupTableInjection()
00118 {}
00119
00120
00121
00122
00123 template<class CloudType>
00124 bool Foam::ReactingLookupTableInjection<CloudType>::active() const
00125 {
00126 return true;
00127 }
00128
00129
00130 template<class CloudType>
00131 Foam::scalar Foam::ReactingLookupTableInjection<CloudType>::timeEnd() const
00132 {
00133 return this->SOI_ + duration_;
00134 }
00135
00136
00137 template<class CloudType>
00138 void Foam::ReactingLookupTableInjection<CloudType>::setPositionAndCell
00139 (
00140 const label parcelI,
00141 const label nParcels,
00142 const scalar time,
00143 vector& position,
00144 label& cellOwner
00145 )
00146 {
00147 label injectorI = parcelI*injectorCells_.size()/nParcels;
00148
00149 position = injectors_[injectorI].x();
00150 cellOwner = injectorCells_[injectorI];
00151 }
00152
00153
00154 template<class CloudType>
00155 void Foam::ReactingLookupTableInjection<CloudType>::setProperties
00156 (
00157 const label parcelI,
00158 const label nParcels,
00159 const scalar,
00160 typename CloudType::parcelType& parcel
00161 )
00162 {
00163 label injectorI = parcelI*injectorCells_.size()/nParcels;
00164
00165
00166 parcel.U() = injectors_[injectorI].U();
00167
00168
00169 parcel.d() = injectors_[injectorI].d();
00170
00171
00172 parcel.rho() = injectors_[injectorI].rho();
00173
00174
00175 parcel.T() = injectors_[injectorI].T();
00176
00177
00178 parcel.cp() = injectors_[injectorI].cp();
00179
00180
00181 parcel.Y() = injectors_[injectorI].Y();
00182 }
00183
00184
00185 template<class CloudType>
00186 bool Foam::ReactingLookupTableInjection<CloudType>::fullyDescribed() const
00187 {
00188 return true;
00189 }
00190
00191
00192 template<class CloudType>
00193 bool Foam::ReactingLookupTableInjection<CloudType>::validInjection(const label)
00194 {
00195 return true;
00196 }
00197
00198
00199