|
[Sponsors] |
Error in New Surface reaction model (Having multiple reactions) |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 28, 2018, 07:24 |
Error in New Surface reaction model (Having multiple reactions)
|
#1 |
New Member
SURAJ
Join Date: Jun 2017
Location: IIT KANPUR,India
Posts: 15
Rep Power: 9 |
I need to model following suraface reactions for coal combustion-
C + 0.5 O2 -----> CO (Reaction a) C + CO2 --------> 2CO (Reaction b) C + H2O --------> CO + H2 (Reaction c) Since I needed effect of both kinetics and diffusion.so,I edited COxidationKineticDiffusionLimitedRate model which is modeled for C + Sb*O2 ------> CO2. named the new reaction model as COxidationmultistep2 This surface reaction model I complied and running without any error. But the mass fraction which I am getting for CO is coming greater than 1.which is not possible. Now, My COxidationmultistep2.H and COxidationmultistep2.C looks like this- COxidationmultistep2.H Code:
/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ 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 3 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, see <http://www.gnu.org/licenses/>. Class Foam::COxidationmultistep2LimitedRate Description Kinetic/diffusion limited rate surface reaction model for coal parcels. Limited to: C(s) + Sb*O2 -> CO2 C(s) + H2O -> CO + H2 C(s) + CO2 -> 2CO where Sb is the stoichiometry of the reaction \*---------------------------------------------------------------------------*/ #ifndef COxidationmultistep2_H #define COxidationmultistep2_H #include "SurfaceReactionModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { // Forward class declarations template<class CloudType> class COxidationmultistep2; /*---------------------------------------------------------------------------*\ Class COxidationmultistep2 Declaration \*---------------------------------------------------------------------------*/ template<class CloudType> class COxidationmultistep2 : public SurfaceReactionModel<CloudType> { // Private data // Model constants // Model constants //- Stoichiometry of reaction // const scalar Sb_; //- Mass diffusion limited rate constant, C1 const scalar C1_; //- Kinetics limited rate pre-exponential constant for first reaction, C2a const scalar C2a_; //- Kinetics limited rate pre-exponential constant for second reaction, C2b const scalar C2b_; //- Kinetics limited rate pre-exponential constant for third reaction, C2c const scalar C2c_; //- Kinetics limited rate activation energy for first reaction const scalar Ea_; //- Kinetics limited rate activation energy for first reaction const scalar Eb_; //- Kinetics limited rate activation energy for first reaction const scalar Ec_; // Addressing //- Cs positions in global/local lists label CsLocalId_; //- O2 position in global list label O2GlobalId_; //- H2O position in global list label H2OGlobalId_; //me //- CO position in global list label COGlobalId_; //me //- H2 position in global list label H2GlobalId_; //me //- CO2 positions in global list label CO2GlobalId_; //me // Local copies of thermo properties //- Molecular weight of C [kg/kmol] scalar WC_; //- Molecular weight of O2 [kg/kmol] scalar WO2_; //- Molecular weight of H2O [kg/kmol] scalar WH2O_; //me //- Molecular weight of CO [kg/kmol] // scalar WCO_; //me //- Molecular weight of H2 [kg/kmol] // scalar WH2_; //me //- Molecular weight of CO2 [kg/kmol] scalar WCO2_; //me //- Formation enthalpy for CO2 [J/kg] scalar HcCO2_; //Formation enthalpy for O2 [J/kg] scalar HcO2_; //Formation enthalpy for H2O [J/kg] scalar HcH2O_; //Formation enthalpy for CO [J/kg] scalar HcCO_; //Formation enthalpy for H2 [J/kg] scalar HcH2_; public: //- Runtime type information TypeName("COxidationmultistep2"); // Constructors //- Construct from dictionary COxidationmultistep2 ( const dictionary& dict, CloudType& owner ); //- Construct copy COxidationmultistep2 ( const COxidationmultistep2<CloudType>& srm ); //- Construct and return a clone virtual autoPtr<SurfaceReactionModel<CloudType>> clone() const { return autoPtr<SurfaceReactionModel<CloudType>> ( new COxidationmultistep2<CloudType>(*this) ); } //- Destructor virtual ~COxidationmultistep2(); // Member Functions //- Update surface reactions virtual scalar 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 scalar N, scalarField& dMassGas, scalarField& dMassLiquid, scalarField& dMassSolid, scalarField& dMassSRCarrier ) const; }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository #include "COxidationmultistep2.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif // ************************************************************************* // Code:
/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ 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 3 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, see <http://www.gnu.org/licenses/>. \*---------------------------------------------------------------------------*/ #include "COxidationmultistep2.H" #include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class CloudType> Foam::COxidationmultistep2<CloudType>:: COxidationmultistep2 ( const dictionary& dict, CloudType& owner ) : SurfaceReactionModel<CloudType>(dict, owner, typeName), // Sb_(readScalar(this->coeffDict().lookup("Sb"))), //Reading from file C1_(readScalar(this->coeffDict().lookup("C1"))), //Reading from the file C2a_(readScalar(this->coeffDict().lookup("C2a"))), //Reading from the file C2b_(readScalar(this->coeffDict().lookup("C2b"))), //Reading from the file C2c_(readScalar(this->coeffDict().lookup("C2c"))), //Reading from the file Ea_(readScalar(this->coeffDict().lookup("Ea"))), //Reading from the file Eb_(readScalar(this->coeffDict().lookup("Eb"))), //Reading from the file Ec_(readScalar(this->coeffDict().lookup("Ec"))), //Reading from the file CsLocalId_(-1), // O2GlobalId_(owner.composition().carrierId("O2")), // CO2GlobalId_(owner.composition().carrierId("CO2")), H2OGlobalId_(owner.composition().carrierId("H2O")), //me H2GlobalId_(owner.composition().carrierId("H2")), //me COGlobalId_(owner.composition().carrierId("CO")), //me WC_(0.0), WO2_(0.0), WH2O_(0.0), //me WCO2_(0.0), //me //WH2_(0.0), //me //WCO_(0.0), //me HcCO2_(0.0), //me HcO2_(0.0), //me HcH2O_(0.0), //me HcCO_(0.0), //me HcH2_(0.0) //me { // Determine Cs ids label idSolid = owner.composition().idSolid(); CsLocalId_ = owner.composition().localId(idSolid, "C"); // Set local copies of thermo properties WO2_ = owner.thermo().carrier().W(O2GlobalId_); WH2O_ = owner.thermo().carrier().W(H2OGlobalId_); //me WCO2_ = owner.thermo().carrier().W(CO2GlobalId_); WC_ = WCO2_ - WO2_; const scalar WH2 = owner.thermo().carrier().W(H2OGlobalId_); //me const scalar WCO = owner.thermo().carrier().W(COGlobalId_); //me HcCO2_ = owner.thermo().carrier().Hc(CO2GlobalId_); //calculating enthalpy of formation of CO2 HcO2_ = owner.thermo().carrier().Hc(O2GlobalId_); //calculating enthalpy of formation of O2 HcH2O_ = owner.thermo().carrier().Hc(H2OGlobalId_); //calculating enthalpy of formation of H2O HcCO_ = owner.thermo().carrier().Hc(COGlobalId_); //calculating enthalpy of formation of CO2 HcH2_= owner.thermo().carrier().Hc(H2GlobalId_); //calculating enthalpy of formation of H2 const scalar YCloc = owner.composition().Y0(idSolid)[CsLocalId_]; const scalar YSolidTot = owner.composition().YMixture0()[idSolid]; Info<< " C(s): particle mass fraction = " << YCloc*YSolidTot << endl; } template<class CloudType> Foam::COxidationmultistep2<CloudType>:: COxidationmultistep2 ( const COxidationmultistep2<CloudType>& srm ) : SurfaceReactionModel<CloudType>(srm), // Sb_(srm.Sb_), C1_(srm.C1_), C2a_(srm.C2a_), C2b_(srm.C2b_), C2c_(srm.C2c_), Ea_(srm.Ea_), Eb_(srm.Eb_), Ec_(srm.Ec_), CsLocalId_(srm.CsLocalId_), O2GlobalId_(srm.O2GlobalId_), CO2GlobalId_(srm.CO2GlobalId_), H2OGlobalId_(srm.H2OGlobalId_), //me H2GlobalId_(srm.H2GlobalId_), //me COGlobalId_(srm.COGlobalId_), //me WC_(srm.WC_), WO2_(srm.WO2_), WH2O_(srm.WH2O_), //me WCO2_(srm.WCO2_), //me //WH2_(srm.WH2_), //me //WCO_(srm.WCO_), //me HcCO2_(srm.HcCO2_), HcO2_(srm.HcO2_), //me HcH2O_(srm.HcH2O_), //me HcCO_(srm.HcCO_), //me HcH2_(srm.HcH2_) {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // template<class CloudType> Foam::COxidationmultistep2<CloudType>:: ~COxidationmultistep2() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class CloudType> Foam::scalar Foam::COxidationmultistep2<CloudType>::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 scalar N, 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; } const SLGThermo& thermo = this->owner().thermo(); // Local mass fraction of O2,H2O,CO2 in the carrier phase const scalar YO2 = thermo.carrier().Y(O2GlobalId_)[celli]; const scalar YH2O = thermo.carrier().Y(H2OGlobalId_)[celli]; const scalar YCO2 = thermo.carrier().Y(CO2GlobalId_)[celli]; // Diffusion rate coefficient const scalar D0 = C1_/d*pow(0.5*(T + Tc), 0.75); // Kinetic rateS OF REACTION a,b,c const scalar Rka = C2a_*exp(-Ea_/(RR*Tc)); const scalar Rkb = C2b_*exp(-Eb_/(RR*Tc)); const scalar Rkc = C2c_*exp(-Ec_/(RR*Tc)); // Particle surface area const scalar Ap = constant::mathematical::pi*sqr(d); // Change in C mass [kg] scalar dmCa = Ap*rhoc*RR*Tc*YO2/WO2_*D0*Rka/(D0 + Rka)*dt; //Change in C mass [kg] due to reaction a scalar dmCb = Ap*rhoc*RR*Tc*YCO2/WCO2_*D0*Rkb/(D0 + Rkb)*dt; //Change in C mass [kg] due to reaction b scalar dmCc = Ap*rhoc*RR*Tc*YH2O/WH2O_*D0*Rkc/(D0 + Rkc)*dt; //Change in C mass [kg] due to reaction c scalar dmC = dmCa + dmCb + dmCc; //Total change in mass due to all reactions a,b,c // Limit mass transfer by availability of C dmC = min(mass*fComb, dmC); // Molar consumption // const scalar dOmega = dmC/WC_; // //const scalar dmO2 = dOmega*Sb_*WO2_; const scalar dmO2 = dmCa/WC_*0.5*WO2_; //Change in O2 mass [kg] due to reaction a const scalar dmCOa = dmCa + dmO2; //Change in CO mass [kg] due to reaction a const scalar dmCO2 = dmCb/WC_*WCO2_; //Change in CO2 mass [kg] due to reaction b const scalar dmCOb = dmCb + dmCO2; ////Change in CO mass [kg] due to reaction b const scalar dmH2O = dmCc/WC_*WH2O_; //Change in H2O mass [kg] due to reaction c const scalar dmCOc = dmCc/WC_*28.0; //Change in CO mass [kg] due to reaction c const scalar dmH2 = dmCc + dmH2O - dmCOc; //Change in H2 mass [kg] due to reaction c const scalar dmCO = dmCOa + dmCOb + dmCOc; //Total Change in CO mass [kg] due to reaction a,b,c combined // Update local particle C mass dMassSolid[CsLocalId_] += dmC ; // Update carrier O2 and CO2 mass dMassSRCarrier[O2GlobalId_] -= dmO2; dMassSRCarrier[CO2GlobalId_] -= dmCO2; dMassSRCarrier[H2OGlobalId_] -= dmH2O; dMassSRCarrier[H2GlobalId_] += dmH2; dMassSRCarrier[COGlobalId_] += dmCO; const scalar HsC = thermo.solids().properties()[CsLocalId_].Hs(T); // carrier sensible enthalpy exchange handled via change in mass // Heat of reaction [J] return dmC*HsC + dmCO2*HcCO2_ + dmH2O*HcH2O_ - dmCO*HcCO_ - dmH2*HcH2_; } // ************************************************************************* // I will bw very thankful to him. Regards, Suraj |
|
April 12, 2021, 06:03 |
|
#2 |
New Member
Guanwen Luo
Join Date: Jan 2021
Posts: 6
Rep Power: 5 |
Hi, did u solve this problem, I have the same question as you. Thanks.
|
|
May 23, 2023, 22:21 |
|
#3 |
New Member
xinyu
Join Date: Apr 2022
Posts: 24
Rep Power: 4 |
Hi, it's been a long time. Have you solved this problem? I also have the same problem. I tried to add only one reaction, C+0.5 O2->CO, but the temperature became very high everywhere in the reactor. Is this a problem with the reaction heat?
|
|
Tags |
coal combustion, coal gasification, surface reaction |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
PaSR + infinite reaction rate in reactingFoam --> no reactions occurring | tatu | OpenFOAM Running, Solving & CFD | 3 | June 2, 2024 11:04 |
how to set periodic boundary conditions | Ganesh | FLUENT | 15 | November 18, 2020 07:09 |
Multiple reaction probem | luonghungtruyen | FLUENT | 0 | December 1, 2016 04:02 |
Overflow Error in Multiphase Modelling with Two Continuous Fluids | ashtonJ | CFX | 6 | August 11, 2014 15:32 |
Wall surface reaction, definition issue | GBNB | Fluent UDF and Scheme Programming | 2 | February 23, 2013 03:09 |