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 "ReactingCloud_.H"
00027
00028 #include <lagrangianIntermediate/CompositionModel.H>
00029 #include <lagrangianIntermediate/PhaseChangeModel.H>
00030
00031
00032
00033 template<class ParcelType>
00034 void Foam::ReactingCloud<ParcelType>::checkSuppliedComposition
00035 (
00036 const scalarField& YSupplied,
00037 const scalarField& Y,
00038 const word& YName
00039 )
00040 {
00041 if (YSupplied.size() != Y.size())
00042 {
00043 FatalErrorIn
00044 (
00045 "ReactingCloud<ParcelType>::checkSuppliedComposition"
00046 "("
00047 "const scalarField&, "
00048 "const scalarField&, "
00049 "const word&"
00050 ")"
00051 ) << YName << " supplied, but size is not compatible with "
00052 << "parcel composition: " << nl << " "
00053 << YName << "(" << YSupplied.size() << ") vs required composition "
00054 << YName << "(" << Y.size() << ")" << nl
00055 << abort(FatalError);
00056 }
00057 }
00058
00059
00060 template<class ParcelType>
00061 void Foam::ReactingCloud<ParcelType>::preEvolve()
00062 {
00063 ThermoCloud<ParcelType>::preEvolve();
00064 }
00065
00066
00067 template<class ParcelType>
00068 void Foam::ReactingCloud<ParcelType>::evolveCloud()
00069 {
00070 const volScalarField& T = this->carrierThermo().T();
00071 const volScalarField cp = this->carrierThermo().Cp();
00072 const volScalarField& p = this->carrierThermo().p();
00073
00074 autoPtr<interpolation<scalar> > rhoInterp = interpolation<scalar>::New
00075 (
00076 this->interpolationSchemes(),
00077 this->rho()
00078 );
00079
00080 autoPtr<interpolation<vector> > UInterp = interpolation<vector>::New
00081 (
00082 this->interpolationSchemes(),
00083 this->U()
00084 );
00085
00086 autoPtr<interpolation<scalar> > muInterp = interpolation<scalar>::New
00087 (
00088 this->interpolationSchemes(),
00089 this->mu()
00090 );
00091
00092 autoPtr<interpolation<scalar> > TInterp = interpolation<scalar>::New
00093 (
00094 this->interpolationSchemes(),
00095 T
00096 );
00097
00098 autoPtr<interpolation<scalar> > cpInterp = interpolation<scalar>::New
00099 (
00100 this->interpolationSchemes(),
00101 cp
00102 );
00103
00104 autoPtr<interpolation<scalar> > pInterp = interpolation<scalar>::New
00105 (
00106 this->interpolationSchemes(),
00107 p
00108 );
00109
00110 typename ParcelType::trackData td
00111 (
00112 *this,
00113 constProps_,
00114 rhoInterp(),
00115 UInterp(),
00116 muInterp(),
00117 TInterp(),
00118 cpInterp(),
00119 pInterp(),
00120 this->g().value()
00121 );
00122
00123 this->injection().inject(td);
00124
00125 if (this->coupled())
00126 {
00127 resetSourceTerms();
00128 }
00129
00130 Cloud<ParcelType>::move(td);
00131 }
00132
00133
00134 template<class ParcelType>
00135 void Foam::ReactingCloud<ParcelType>::postEvolve()
00136 {
00137 ThermoCloud<ParcelType>::postEvolve();
00138 }
00139
00140
00141
00142
00143 template<class ParcelType>
00144 Foam::ReactingCloud<ParcelType>::ReactingCloud
00145 (
00146 const word& cloudName,
00147 const volScalarField& rho,
00148 const volVectorField& U,
00149 const dimensionedVector& g,
00150 basicThermo& thermo,
00151 bool readFields
00152 )
00153 :
00154 ThermoCloud<ParcelType>(cloudName, rho, U, g, thermo, false),
00155 reactingCloud(),
00156 constProps_(this->particleProperties()),
00157 mcCarrierThermo_
00158 (
00159 dynamic_cast<multiComponentMixture<thermoType>&>(thermo)
00160 ),
00161 compositionModel_
00162 (
00163 CompositionModel<ReactingCloud<ParcelType> >::New
00164 (
00165 this->particleProperties(),
00166 *this
00167 )
00168 ),
00169 phaseChangeModel_
00170 (
00171 PhaseChangeModel<ReactingCloud<ParcelType> >::New
00172 (
00173 this->particleProperties(),
00174 *this
00175 )
00176 ),
00177 rhoTrans_(mcCarrierThermo_.species().size()),
00178 dMassPhaseChange_(0.0)
00179 {
00180
00181 forAll(rhoTrans_, i)
00182 {
00183 rhoTrans_.set
00184 (
00185 i,
00186 new DimensionedField<scalar, volMesh>
00187 (
00188 IOobject
00189 (
00190 this->name() + "rhoTrans_" + mcCarrierThermo_.species()[i],
00191 this->db().time().timeName(),
00192 this->db(),
00193 IOobject::NO_READ,
00194 IOobject::NO_WRITE,
00195 false
00196 ),
00197 this->mesh(),
00198 dimensionedScalar("zero", dimMass, 0.0)
00199 )
00200 );
00201 }
00202
00203 if (readFields)
00204 {
00205 ParcelType::readFields(*this);
00206 }
00207 }
00208
00209
00210
00211
00212 template<class ParcelType>
00213 Foam::ReactingCloud<ParcelType>::~ReactingCloud()
00214 {}
00215
00216
00217
00218
00219 template<class ParcelType>
00220 void Foam::ReactingCloud<ParcelType>::checkParcelProperties
00221 (
00222 ParcelType& parcel,
00223 const scalar lagrangianDt,
00224 const bool fullyDescribed
00225 )
00226 {
00227 ThermoCloud<ParcelType>::checkParcelProperties
00228 (
00229 parcel,
00230 lagrangianDt,
00231 fullyDescribed
00232 );
00233
00234 if (!fullyDescribed)
00235 {
00236 parcel.Y() = composition().YMixture0();
00237 }
00238 else
00239 {
00240 checkSuppliedComposition
00241 (
00242 parcel.Y(),
00243 composition().YMixture0(),
00244 "YMixture"
00245 );
00246 }
00247
00248
00249 parcel.mass0() = parcel.mass();
00250 }
00251
00252
00253 template<class ParcelType>
00254 void Foam::ReactingCloud<ParcelType>::resetSourceTerms()
00255 {
00256 ThermoCloud<ParcelType>::resetSourceTerms();
00257 forAll(rhoTrans_, i)
00258 {
00259 rhoTrans_[i].field() = 0.0;
00260 }
00261 }
00262
00263
00264 template<class ParcelType>
00265 void Foam::ReactingCloud<ParcelType>::evolve()
00266 {
00267 if (this->active())
00268 {
00269 preEvolve();
00270
00271 evolveCloud();
00272
00273 postEvolve();
00274
00275 info();
00276 Info<< endl;
00277 }
00278 }
00279
00280
00281 template<class ParcelType>
00282 void Foam::ReactingCloud<ParcelType>::info() const
00283 {
00284 ThermoCloud<ParcelType>::info();
00285
00286 Info<< " Mass transfer phase change = "
00287 << returnReduce(dMassPhaseChange_, sumOp<scalar>()) << nl;
00288 }
00289
00290
00291 template<class ParcelType>
00292 void Foam::ReactingCloud<ParcelType>::addToMassPhaseChange(const scalar dMass)
00293 {
00294 dMassPhaseChange_ += dMass;
00295 }
00296
00297
00298