COxidationMurphyShaddix.C
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 #include "COxidationMurphyShaddix.H"
00028
00029
00030
00031 template<class CloudType>
00032 Foam::label Foam::COxidationMurphyShaddix<CloudType>::maxIters_ = 1000;
00033
00034 template<class CloudType>
00035 Foam::scalar Foam::COxidationMurphyShaddix<CloudType>::tolerance_ = 1e-06;
00036
00037
00038
00039
00040 template<class CloudType>
00041 Foam::COxidationMurphyShaddix<CloudType>::COxidationMurphyShaddix
00042 (
00043 const dictionary& dict,
00044 CloudType& owner
00045 )
00046 :
00047 SurfaceReactionModel<CloudType>
00048 (
00049 dict,
00050 owner,
00051 typeName
00052 ),
00053 D0_(dimensionedScalar(this->coeffDict().lookup("D0")).value()),
00054 rho0_(dimensionedScalar(this->coeffDict().lookup("rho0")).value()),
00055 T0_(dimensionedScalar(this->coeffDict().lookup("T0")).value()),
00056 Dn_(dimensionedScalar(this->coeffDict().lookup("Dn")).value()),
00057 A_(dimensionedScalar(this->coeffDict().lookup("A")).value()),
00058 E_(dimensionedScalar(this->coeffDict().lookup("E")).value()),
00059 n_(dimensionedScalar(this->coeffDict().lookup("n")).value()),
00060 WVol_(dimensionedScalar(this->coeffDict().lookup("WVol")).value()),
00061 CsLocalId_(-1),
00062 O2GlobalId_(owner.composition().globalCarrierId("O2")),
00063 CO2GlobalId_(owner.composition().globalCarrierId("CO2")),
00064 WC_(0.0),
00065 WO2_(0.0)
00066 {
00067
00068 label idSolid = owner.composition().idSolid();
00069 CsLocalId_ = owner.composition().localId(idSolid, "C");
00070
00071
00072 WO2_ = owner.mcCarrierThermo().speciesData()[O2GlobalId_].W();
00073 scalar WCO2 = owner.mcCarrierThermo().speciesData()[CO2GlobalId_].W();
00074 WC_ = WCO2 - WO2_;
00075 }
00076
00077
00078
00079
00080 template<class CloudType>
00081 Foam::COxidationMurphyShaddix<CloudType>::~COxidationMurphyShaddix()
00082 {}
00083
00084
00085
00086
00087 template<class CloudType>
00088 bool Foam::COxidationMurphyShaddix<CloudType>::active() const
00089 {
00090 return true;
00091 }
00092
00093
00094 template<class CloudType>
00095 Foam::scalar Foam::COxidationMurphyShaddix<CloudType>::calculate
00096 (
00097 const scalar dt,
00098 const label cellI,
00099 const scalar d,
00100 const scalar T,
00101 const scalar Tc,
00102 const scalar pc,
00103 const scalar rhoc,
00104 const scalar mass,
00105 const scalarField& YGas,
00106 const scalarField& YLiquid,
00107 const scalarField& YSolid,
00108 const scalarField& YMixture,
00109 const scalarField& dMassVolatile,
00110 scalarField& dMassGas,
00111 scalarField& dMassLiquid,
00112 scalarField& dMassSolid,
00113 scalarField& dMassSRCarrier
00114 ) const
00115 {
00116
00117 const label idSolid = CloudType::parcelType::SLD;
00118 const scalar fComb = YMixture[idSolid]*YSolid[CsLocalId_];
00119
00120
00121 if (fComb < SMALL)
00122 {
00123 return 0.0;
00124 }
00125
00126
00127 const scalar rhoO2 =
00128 rhoc*this->owner().mcCarrierThermo().Y(O2GlobalId_)[cellI];
00129
00130 if (rhoO2 < SMALL)
00131 {
00132 return 0.0;
00133 }
00134
00135
00136 const scalar Ap = mathematicalConstant::pi*sqr(d);
00137
00138
00139
00140 const scalar D = D0_*(rho0_/rhoc)*pow(Tc/T0_, Dn_);
00141
00142
00143 const scalar ppO2 = rhoO2/WO2_*specie::RR*Tc;
00144
00145
00146 const scalar qVol = sum(dMassVolatile)/(WVol_*Ap);
00147
00148
00149 const scalar C = pc/(specie::RR*Tc);
00150
00151 if (debug)
00152 {
00153 Pout<< "mass = " << mass << nl
00154 << "fComb = " << fComb << nl
00155 << "Ap = " << Ap << nl
00156 << "dt = " << dt << nl
00157 << "C = " << C << nl
00158 << endl;
00159 }
00160
00161
00162 scalar qCsOld = 0;
00163 scalar qCs = 1;
00164
00165 const scalar qCsLim = mass*fComb/(WC_*Ap*dt);
00166
00167 if (debug)
00168 {
00169 Pout << "qCsLim = " << qCsLim << endl;
00170 }
00171
00172 label iter = 0;
00173 while ((mag(qCs - qCsOld)/qCs > tolerance_) && (iter <= maxIters_))
00174 {
00175 qCsOld = qCs;
00176 const scalar PO2Surface = ppO2*exp(-(qCs + qVol)*d/(2*C*D));
00177 qCs = A_*exp(-E_/(specie::RR*T))*pow(PO2Surface, n_);
00178 qCs = (100.0*qCs + iter*qCsOld)/(100.0 + iter);
00179 qCs = min(qCs, qCsLim);
00180
00181 if (debug)
00182 {
00183 Pout<< "iter = " << iter
00184 << ", qCsOld = " << qCsOld
00185 << ", qCs = " << qCs
00186 << nl << endl;
00187 }
00188
00189 iter++;
00190 }
00191
00192 if (iter > maxIters_)
00193 {
00194 WarningIn
00195 (
00196 "scalar Foam::COxidationMurphyShaddix<CloudType>::calculate(...)"
00197 ) << "iter limit reached (" << maxIters_ << ")" << nl << endl;
00198 }
00199
00200
00201 scalar dOmega = qCs*Ap*dt;
00202
00203
00204 dMassSRCarrier[O2GlobalId_] += -dOmega*WO2_;
00205 dMassSRCarrier[CO2GlobalId_] += dOmega*(WC_ + WO2_);
00206
00207
00208 dMassSolid[CsLocalId_] += dOmega*WC_;
00209
00210 const scalar HC =
00211 this->owner().composition().solids().properties()[CsLocalId_].Hf()
00212 + this->owner().composition().solids().properties()[CsLocalId_].cp()*T;
00213 const scalar HCO2 =
00214 this->owner().mcCarrierThermo().speciesData()[CO2GlobalId_].H(T);
00215 const scalar HO2 =
00216 this->owner().mcCarrierThermo().speciesData()[O2GlobalId_].H(T);
00217
00218
00219 return dOmega*(WC_*HC + WO2_*HO2 - (WC_ + WO2_)*HCO2);
00220 }
00221
00222
00223
Copyright © 2000-2009 OpenCFD Ltd