CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

char combustion chemistry; multi-step raection, coalChemistryFoam

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   August 4, 2010, 18:10
Default char combustion chemistry; multi-step raection, coalChemistryFoam
  #1
Member
 
N. A.
Join Date: May 2010
Posts: 64
Rep Power: 7
N. A. is on a distinguished road
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:arcelType::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:i*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;
}

// ************************************************** *********************** //
N. A. is offline   Reply With Quote

Old   November 5, 2014, 03:55
Default
  #2
Senior Member
 
Wen Xu
Join Date: May 2014
Posts: 144
Rep Power: 3
wenxu is on a distinguished road
Quote:
Originally Posted by N. A. View Post
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:arcelType::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:i*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;
}

// ************************************************** *********************** //
sorry,i do not know,but i have she same problem.....
wenxu is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to write k and epsilon before the abnormal end xiuying OpenFOAM Running, Solving & CFD 8 August 27, 2013 15:33
Transient simulation not converging skabilan OpenFOAM Running, Solving & CFD 12 September 17, 2007 17:48
IcoFoam parallel woes msrinath80 OpenFOAM Running, Solving & CFD 9 July 22, 2007 02:58
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 19:07
2 Step Methane-Air Chemistry Model Prateep Chatterjee FLUENT 2 September 22, 2001 13:00


All times are GMT -4. The time now is 10:19.