CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   char combustion chemistry; multi-step raection, coalChemistryFoam (http://www.cfd-online.com/Forums/openfoam/78884-char-combustion-chemistry-multi-step-raection-coalchemistryfoam.html)

N. A. August 4, 2010 18:10

char combustion chemistry; multi-step raection, coalChemistryFoam
 
Hello Foam users,

I am trying to implement a 3-step char combustion chemsitry mechanism for coalChemistryFoam solver. I found that there is an available model COxidationKineticDiffusionLimitedRate.C in the following location:

~/OpenFOAM/OpenFOM-1.6/src/lagrangian/ mycoalCombustion/submodels/ surfaceReactionModel/COxidationKineticDiffusionLimitedRate

The COxidationKineticDiffusionLimitedRate model uses a single step reaction of C+O2--> CO2

I intend to use following reactions to determine consumption of C:
C + 0.5O2 --> CO ; K1 is the rate constant
C + CO2 --> 2CO ; K2 is the rate constant
C + H2O --> CO+H2 ; K3 is the rate constant

The question I have are following:

1. Do I need to create variable for dmCO and dmH2 just as dmC and dmO2 are created?
2. How can dmC, dmCO and dmH2 be calculated using the kinetic rates of above reactions and implemented in the routine

If anyone has implemented multi-step surface chemistry I would be very thankful to learn how it is being implemented. I am still learning C++ and implementation in OpenFOAM and it would be great to get a help for a faster learning curve.

Many thanks
N.A.


-----The original COxidationKineticDiffusionLimitedRate.C file------

/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "COxidationKineticDiffusionLimitedRate.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::COxidationKineticDiffusionLimitedRate<CloudT ype>::
COxidationKineticDiffusionLimitedRate
(
const dictionary& dict,
CloudType& owner
)
:
SurfaceReactionModel<CloudType>
(
dict,
owner,
typeName
),
Sb_(dimensionedScalar(this->coeffDict().lookup("Sb")).value()),
C1_(dimensionedScalar(this->coeffDict().lookup("C1")).value()),
C2_(dimensionedScalar(this->coeffDict().lookup("C2")).value()),
E_(dimensionedScalar(this->coeffDict().lookup("E")).value()),
CsLocalId_(-1),
O2GlobalId_(owner.composition().globalCarrierId("O 2")),
CO2GlobalId_(owner.composition().globalCarrierId(" CO2")),
WC_(0.0),
WO2_(0.0),
HcCO2_(0.0)
{
// Determine Cs ids
label idSolid = owner.composition().idSolid();
CsLocalId_ = owner.composition().localId(idSolid, "C");
// Set local copies of thermo properties
WO2_ = owner.mcCarrierThermo().speciesData()[O2GlobalId_].W();
scalar WCO2 = owner.mcCarrierThermo().speciesData()[CO2GlobalId_].W();
WC_ = WCO2 - WO2_;
HcCO2_ = owner.mcCarrierThermo().speciesData()[CO2GlobalId_].Hc();
if (Sb_ < 0)
{
FatalErrorIn
(
"COxidationKineticDiffusionLimitedRate"
"("
"const dictionary&, "
"CloudType&"
")"
) << "Stoichiometry of reaction, Sb, must be greater than zero" << nl
<< exit(FatalError);
}
}

// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::COxidationKineticDiffusionLimitedRate<CloudT ype>::
~COxidationKineticDiffusionLimitedRate()
{}

// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::COxidationKineticDiffusionLimitedRate<CloudT ype>::active() const
{
return true;
}

template<class CloudType>
Foam::scalar Foam::COxidationKineticDiffusionLimitedRate<CloudT ype>::calculate
(
const scalar dt,
const label cellI,
const scalar d,
const scalar T,
const scalar Tc,
const scalar pc,
const scalar rhoc,
const scalar mass,
const scalarField& YGas,
const scalarField& YLiquid,
const scalarField& YSolid,
const scalarField& YMixture,
const scalarField& dMassVolatile,
scalarField& dMassGas,
scalarField& dMassLiquid,
scalarField& dMassSolid,
scalarField& dMassSRCarrier
) const
{
// Fraction of remaining combustible material
const label idSolid = CloudType::parcelType::SLD;
const scalar fComb = YMixture[idSolid]*YSolid[CsLocalId_];
// Surface combustion active combustible fraction is consumed
if (fComb < SMALL)
{
return 0.0;
}
// Local mass fraction of O2 in the carrier phase
const scalar YO2 = this->owner().mcCarrierThermo().Y(O2GlobalId_)[cellI];
// Diffusion rate coefficient
const scalar D0 = C1_/d*pow(0.5*(T + Tc), 0.75);
// Kinetic rate
const scalar Rk = C2_*exp(-E_/(specie::RR*Tc));
// Particle surface area
const scalar Ap = mathematicalConstant::pi*sqr(d);
// Change in C mass [kg]
scalar dmC = Ap*rhoc*specie::RR*Tc*YO2/WO2_*D0*Rk/(D0 + Rk);
// Limit mass transfer by availability of C
dmC = min(mass*fComb, dmC);
// Change in O2 mass [kg]
const scalar dmO2 = dmC/WC_*Sb_*WO2_;
// Mass of newly created CO2 [kg]
const scalar dmCO2 = dmC + dmO2;
// Update local particle C mass
dMassSolid[CsLocalId_] += dmC;
// Update carrier O2 and CO2 mass
dMassSRCarrier[O2GlobalId_] -= dmO2;
dMassSRCarrier[CO2GlobalId_] += dmCO2;
// Heat of reaction [J]
return -HcCO2_*dmCO2;
}

// ************************************************** *********************** //


All times are GMT -4. The time now is 04:02.