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 "COxidationMurphyShaddix.H"
00027 #include <OpenFOAM/mathematicalConstants.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 scalar N,
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 C = pc/(specie::RR*Tc);
00147
00148 if (debug)
00149 {
00150 Pout<< "mass = " << mass << nl
00151 << "fComb = " << fComb << nl
00152 << "Ap = " << Ap << nl
00153 << "dt = " << dt << nl
00154 << "C = " << C << nl
00155 << endl;
00156 }
00157
00158
00159 scalar qCsOld = 0;
00160 scalar qCs = 1;
00161
00162 const scalar qCsLim = mass*fComb/(WC_*Ap*dt);
00163
00164 if (debug)
00165 {
00166 Pout << "qCsLim = " << qCsLim << endl;
00167 }
00168
00169 label iter = 0;
00170 while ((mag(qCs - qCsOld)/qCs > tolerance_) && (iter <= maxIters_))
00171 {
00172 qCsOld = qCs;
00173 const scalar PO2Surface = ppO2*exp(-(qCs + N)*d/(2*C*D));
00174 qCs = A_*exp(-E_/(specie::RR*T))*pow(PO2Surface, n_);
00175 qCs = (100.0*qCs + iter*qCsOld)/(100.0 + iter);
00176 qCs = min(qCs, qCsLim);
00177
00178 if (debug)
00179 {
00180 Pout<< "iter = " << iter
00181 << ", qCsOld = " << qCsOld
00182 << ", qCs = " << qCs
00183 << nl << endl;
00184 }
00185
00186 iter++;
00187 }
00188
00189 if (iter > maxIters_)
00190 {
00191 WarningIn
00192 (
00193 "scalar Foam::COxidationMurphyShaddix<CloudType>::calculate(...)"
00194 ) << "iter limit reached (" << maxIters_ << ")" << nl << endl;
00195 }
00196
00197
00198 scalar dOmega = qCs*Ap*dt;
00199
00200
00201 dMassSRCarrier[O2GlobalId_] += -dOmega*WO2_;
00202 dMassSRCarrier[CO2GlobalId_] += dOmega*(WC_ + WO2_);
00203
00204
00205 dMassSolid[CsLocalId_] += dOmega*WC_;
00206
00207 const scalar HC =
00208 this->owner().composition().solids().properties()[CsLocalId_].Hf()
00209 + this->owner().composition().solids().properties()[CsLocalId_].cp()*T;
00210 const scalar HCO2 =
00211 this->owner().mcCarrierThermo().speciesData()[CO2GlobalId_].H(T);
00212 const scalar HO2 =
00213 this->owner().mcCarrierThermo().speciesData()[O2GlobalId_].H(T);
00214
00215
00216 return dOmega*(WC_*HC + WO2_*HO2 - (WC_ + WO2_)*HCO2);
00217 }
00218
00219
00220