1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "COxidationMurphyShaddix.H"
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 template<class CloudType>
32 Foam::label Foam::COxidationMurphyShaddix<CloudType>::maxIters_ = 1000;
34 template<class CloudType>
35 Foam::scalar Foam::COxidationMurphyShaddix<CloudType>::tolerance_ = 1e-06;
38 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
40 template<class CloudType>
41 Foam::COxidationMurphyShaddix<CloudType>::COxidationMurphyShaddix
43 const dictionary& dict,
47 SurfaceReactionModel<CloudType>
53 D0_(dimensionedScalar(this->coeffDict().lookup("D0")).value()),
54 rho0_(dimensionedScalar(this->coeffDict().lookup("rho0")).value()),
55 T0_(dimensionedScalar(this->coeffDict().lookup("T0")).value()),
56 Dn_(dimensionedScalar(this->coeffDict().lookup("Dn")).value()),
57 A_(dimensionedScalar(this->coeffDict().lookup("A")).value()),
58 E_(dimensionedScalar(this->coeffDict().lookup("E")).value()),
59 n_(dimensionedScalar(this->coeffDict().lookup("n")).value()),
60 WVol_(dimensionedScalar(this->coeffDict().lookup("WVol")).value()),
62 O2GlobalId_(owner.composition().globalCarrierId("O2")),
63 CO2GlobalId_(owner.composition().globalCarrierId("CO2")),
68 label idSolid = owner.composition().idSolid();
69 CsLocalId_ = owner.composition().localId(idSolid, "C");
71 // Set local copies of thermo properties
72 WO2_ = owner.mcCarrierThermo().speciesData()[O2GlobalId_].W();
73 scalar WCO2 = owner.mcCarrierThermo().speciesData()[CO2GlobalId_].W();
78 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
80 template<class CloudType>
81 Foam::COxidationMurphyShaddix<CloudType>::~COxidationMurphyShaddix()
85 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
87 template<class CloudType>
88 bool Foam::COxidationMurphyShaddix<CloudType>::active() const
94 template<class CloudType>
95 Foam::scalar Foam::COxidationMurphyShaddix<CloudType>::calculate
105 const scalarField& YGas,
106 const scalarField& YLiquid,
107 const scalarField& YSolid,
108 const scalarField& YMixture,
109 const scalarField& dMassVolatile,
110 scalarField& dMassGas,
111 scalarField& dMassLiquid,
112 scalarField& dMassSolid,
113 scalarField& dMassSRCarrier
116 // Fraction of remaining combustible material
117 const label idSolid = CloudType::parcelType::SLD;
118 const scalar fComb = YMixture[idSolid]*YSolid[CsLocalId_];
120 // Surface combustion until combustible fraction is consumed
126 // Cell carrier phase O2 species density [kg/m^3]
128 rhoc*this->owner().mcCarrierThermo().Y(O2GlobalId_)[cellI];
135 // Particle surface area [m^2]
136 const scalar Ap = mathematicalConstant::pi*sqr(d);
138 // Calculate diffision constant at continuous phase temperature
139 // and density [m^2/s]
140 const scalar D = D0_*(rho0_/rhoc)*pow(Tc/T0_, Dn_);
142 // Far field partial pressure O2 [Pa]
143 const scalar ppO2 = rhoO2/WO2_*specie::RR*Tc;
145 // Molar emission rate of volatiles per unit surface area
146 const scalar qVol = sum(dMassVolatile)/(WVol_*Ap);
148 // Total molar concentration of the carrier phase [kmol/m^3]
149 const scalar C = pc/(specie::RR*Tc);
153 Pout<< "mass = " << mass << nl
154 << "fComb = " << fComb << nl
155 << "Ap = " << Ap << nl
156 << "dt = " << dt << nl
161 // Molar reaction rate per unit surface area [kmol/(m^2.s)]
165 const scalar qCsLim = mass*fComb/(WC_*Ap*dt);
169 Pout << "qCsLim = " << qCsLim << endl;
173 while ((mag(qCs - qCsOld)/qCs > tolerance_) && (iter <= maxIters_))
176 const scalar PO2Surface = ppO2*exp(-(qCs + qVol)*d/(2*C*D));
177 qCs = A_*exp(-E_/(specie::RR*T))*pow(PO2Surface, n_);
178 qCs = (100.0*qCs + iter*qCsOld)/(100.0 + iter);
179 qCs = min(qCs, qCsLim);
183 Pout<< "iter = " << iter
184 << ", qCsOld = " << qCsOld
192 if (iter > maxIters_)
196 "scalar Foam::COxidationMurphyShaddix<CloudType>::calculate(...)"
197 ) << "iter limit reached (" << maxIters_ << ")" << nl << endl;
200 // Calculate the number of molar units reacted
201 scalar dOmega = qCs*Ap*dt;
203 // Add to carrier phase mass transfer
204 dMassSRCarrier[O2GlobalId_] += -dOmega*WO2_;
205 dMassSRCarrier[CO2GlobalId_] += dOmega*(WC_ + WO2_);
207 // Add to particle mass transfer
208 dMassSolid[CsLocalId_] += dOmega*WC_;
211 this->owner().composition().solids().properties()[CsLocalId_].Hf()
212 + this->owner().composition().solids().properties()[CsLocalId_].cp()*T;
214 this->owner().mcCarrierThermo().speciesData()[CO2GlobalId_].H(T);
216 this->owner().mcCarrierThermo().speciesData()[O2GlobalId_].H(T);
219 return dOmega*(WC_*HC + WO2_*HO2 - (WC_ + WO2_)*HCO2);
223 // ************************************************************************* //