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