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