From 88f19cfe39a13e978bc989163fc4555a235fcd69 Mon Sep 17 00:00:00 2001 From: Hang Zhou Date: Tue, 19 May 2020 14:11:33 -0600 Subject: [PATCH 01/10] Adding coal type `Given_From_Input_File` into char models. Modifying the coal type name used in interpolation to get CPD parameters, whose format should be camelcase. --- src/particles/ParticleInterface.cpp | 2 +- src/particles/coal/CharCombustion/CharData.cpp | 1 + .../CharCombustion/Gasification/CharGasificationData.cpp | 1 + src/particles/coal/CoalData.cpp | 6 +++--- src/particles/coal/CoalData.h | 2 +- src/particles/coal/Devolatilization/CPD/CPDData.cpp | 6 +++--- 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/particles/ParticleInterface.cpp b/src/particles/ParticleInterface.cpp index 4ccaecb..0d31ab8 100755 --- a/src/particles/ParticleInterface.cpp +++ b/src/particles/ParticleInterface.cpp @@ -760,7 +760,7 @@ namespace Particles { const Tarsoot::TarsootModel tarSootModel = Tarsoot::tarsoot_model( rootParser_["Particles"]["TarSootModel"].as() ); Char::CharModel charModel; if(rootParser_["Particles"]["CharModel"].size() > 1){ - charModel = Char::char_model("Gasif_Oxid"); + charModel = Char::char_model("GasifOxid"); } else{ charModel = Char::char_model( rootParser_["Particles"]["CharModel"].as() ); diff --git a/src/particles/coal/CharCombustion/CharData.cpp b/src/particles/coal/CharCombustion/CharData.cpp index f980e4a..8e678cb 100644 --- a/src/particles/coal/CharCombustion/CharData.cpp +++ b/src/particles/coal/CharCombustion/CharData.cpp @@ -76,6 +76,7 @@ set_data() case Coal::Eastern_Bituminous_Char: case Coal::Illinois_No_6: case Coal::Illinois_No_6_Char: + case Coal::Given_From_Input_File: insufficient_data(); break; diff --git a/src/particles/coal/CharCombustion/Gasification/CharGasificationData.cpp b/src/particles/coal/CharCombustion/Gasification/CharGasificationData.cpp index 7c62fee..b1da097 100644 --- a/src/particles/coal/CharCombustion/Gasification/CharGasificationData.cpp +++ b/src/particles/coal/CharCombustion/Gasification/CharGasificationData.cpp @@ -34,6 +34,7 @@ namespace CharGasification{ case Coal::Eastern_Bituminous_Char: case Coal::Illinois_No_6: case Coal::Illinois_No_6_Char: + case Coal::Given_From_Input_File: /* The correlation for aH2o_ is based on data [1] from a limited range of coal * compositions so if c_ is outside the range ah2o_ is set to the value corresponding diff --git a/src/particles/coal/CoalData.cpp b/src/particles/coal/CoalData.cpp index bbafee4..f5e2b7c 100755 --- a/src/particles/coal/CoalData.cpp +++ b/src/particles/coal/CoalData.cpp @@ -37,7 +37,7 @@ namespace Coal{ case Eastern_Bituminous_Char: name = "EasternBituminousChar"; break; case Illinois_No_6: name = "IllinoisNo6"; break; case Illinois_No_6_Char: name = "IllinoisNo6Char"; break; - case Given_From_InputFile: name = "GivenFromInputFile"; break; + case Given_From_Input_File: name = "GivenFromInputFile"; break; default: @@ -75,7 +75,7 @@ namespace Coal{ else if( coaltype == coal_type_name(Coal::Eastern_Bituminous_Char )) return Coal::Eastern_Bituminous_Char; else if( coaltype == coal_type_name(Coal::Illinois_No_6 )) return Coal::Illinois_No_6; else if( coaltype == coal_type_name(Coal::Illinois_No_6_Char )) return Coal::Illinois_No_6_Char; - else if( coaltype == coal_type_name(Coal::Given_From_InputFile )) return Coal::Given_From_InputFile; + else if( coaltype == coal_type_name(Coal::Given_From_Input_File )) return Coal::Given_From_Input_File; else{ ostringstream msg; msg << endl @@ -393,7 +393,7 @@ namespace Coal{ fixedc_ = 0.8508; break; - case Given_From_InputFile: + case Given_From_Input_File: { const YAML::Node coalUltimate = particleParser["CoalComposition"]["UltimateAnalysis"]; const YAML::Node coalProximate = particleParser["CoalComposition"]["ProximateAnalysis"]; diff --git a/src/particles/coal/CoalData.h b/src/particles/coal/CoalData.h index a304f1e..09dfe03 100755 --- a/src/particles/coal/CoalData.h +++ b/src/particles/coal/CoalData.h @@ -38,7 +38,7 @@ namespace Coal{ Eastern_Bituminous_Char = 19, Illinois_No_6 = 20, Illinois_No_6_Char = 21, - Given_From_InputFile = 22, + Given_From_Input_File = 22, INVALID_COALTYPE = 99 }; diff --git a/src/particles/coal/Devolatilization/CPD/CPDData.cpp b/src/particles/coal/Devolatilization/CPD/CPDData.cpp index 0acd6c1..0d6702f 100755 --- a/src/particles/coal/Devolatilization/CPD/CPDData.cpp +++ b/src/particles/coal/Devolatilization/CPD/CPDData.cpp @@ -329,7 +329,7 @@ namespace CPD{ tarMassFrac0_ = 0.1559; break; - case Coal::Given_From_InputFile: //Interpolation + case Coal::Given_From_Input_File: //Interpolation { const YAML::Node coalUltimate = particleParser["CoalComposition"]["UltimateAnalysis"]; const YAML::Node coalProximate = particleParser["CoalComposition"]["ProximateAnalysis"]; @@ -563,8 +563,8 @@ namespace CPD{ vector> fg_list; vector fg_x; vector > distance_pair; - const vector coalName{"NorthDakota_Lignite", "Gillette_Subbituminous", "MontanaRosebud_Subbituminous", - "Illinois_Bituminous", "Kentucky_Bituminous", "Pittsburgh_Bituminous"}; + const vector coalName{"NorthDakotaLignite", "GilletteSubbituminous", "MontanaRosebudSubbituminous", + "IllinoisBituminous", "KentuckyBituminous", "PittsburghBituminous"}; const int n=4; for (size_t i=0; i Date: Tue, 26 May 2020 16:54:50 -0600 Subject: [PATCH 02/10] Modifying the method to set initial/inflow values of coal particle loading, CPD parameters (l, delta_i and g_i), and tar and soot mass. They can be given in the input file by `Particles: {ParticleLoading: ParticleLoadingInflow: }`, `Particles:{CPDInflow:{l: deltai: gi:} CPDInit:{l: deltai: gi:}}`, and `Particles:{TarSootInflowFrac: TarSootInitFrac:}`, respectively. If they are not given in the input file, they will be set based on the equivalence ratio and coal composition. --- src/parser/ParseInputFile.cpp | 3 +- src/particles/ParticleInterface.cpp | 21 +++- src/particles/ParticleInterface.h | 2 +- src/particles/coal/CoalInterface.cpp | 96 ++++++++++++------- .../Devolatilization/CPD/CPDInterface.cpp | 30 ++++-- .../TarSootReactionInterface.cpp | 24 +++-- 6 files changed, 118 insertions(+), 58 deletions(-) diff --git a/src/parser/ParseInputFile.cpp b/src/parser/ParseInputFile.cpp index 3b0d2ec..17a8899 100644 --- a/src/parser/ParseInputFile.cpp +++ b/src/parser/ParseInputFile.cpp @@ -248,8 +248,7 @@ parse_initial_inflow_conditions( const YAML::Node& parser, } if( !parser["InitialConditions"] ){ - std::ostringstream msg; - msg << "No initial condition block 'InitialConditions' was found! Initial conditions are set to be the same as inflow conditions\n"; + std::cout << "No initial condition block 'InitialConditions' was found! Initial conditions are set to be the same as inflow conditions\n" << std::endl; } bool hasMixtureFraction = false; diff --git a/src/particles/ParticleInterface.cpp b/src/particles/ParticleInterface.cpp index 0d31ab8..2d4d0e4 100755 --- a/src/particles/ParticleInterface.cpp +++ b/src/particles/ParticleInterface.cpp @@ -161,11 +161,22 @@ namespace Particles { liquidimplement_(false) { if(rootParser_["Particles"]["ParticleType"].as() != "Coal"){ - npar_ = int(rootParser_["Particles"]["ParticleLoading"].as()); // number of particles per gas mass + if(rootParser_["Particles"]["ParticleLoading"]){ + npar_ = rootParser_["Particles"]["ParticleLoading"].as(); // number of particles per gas mass + } + else{ + std::ostringstream msg; + msg << "No particle loading block, 'ParticleLoading', was found in 'Particles' block!\n"; + throw std::runtime_error( msg.str()); + } + if(rootParser_["Particles"]["ParticleLoadingInflow"]){ - nparInflow_ = int(rootParser_["Particles"]["ParticleLoadingInflow"].as()); + nparInflow_ = rootParser_["Particles"]["ParticleLoadingInflow"].as(); } else{ + std::cout << "No inflow particle loading block, 'ParticleLoadingInflow', was found in 'Particles' block! \n" + "Inflow particle loading is set to be the same as initial particle loading\n" + << std::endl; nparInflow_ = npar_; } } @@ -191,6 +202,9 @@ namespace Particles { } } nparsize_ = particleNumArray.size(); + if(rootParser_["Particles"]["ParticleType"].as() == "Coal"){ + coalimplement_ = true; + } if (!isRestart_){ setup_initial_conditions_particle(); @@ -202,8 +216,7 @@ namespace Particles { liquidimplement_ = true; Vaporization_ = new Vap::Vaporization(integrator_, rootParser_, particleNumArray_, equIndex_); } - if(rootParser_["Particles"]["ParticleType"].as() == "Coal"){ - coalimplement_ = true; + if(coalimplement_){ setup_coal_subprocess(); } } diff --git a/src/particles/ParticleInterface.h b/src/particles/ParticleInterface.h index df25376..f7b5d39 100755 --- a/src/particles/ParticleInterface.h +++ b/src/particles/ParticleInterface.h @@ -112,7 +112,7 @@ namespace Particles { bool liquidimplement_; // if true, it means that there are liquid particles bool coalimplement_; // if true, it means that there are coal particles const bool isRestart_; - int npar_, nparInflow_; // number of particles per gas mass + double npar_, nparInflow_; // number of particles per gas mass int nparsize_; // number of particle size public: diff --git a/src/particles/coal/CoalInterface.cpp b/src/particles/coal/CoalInterface.cpp index ecfaa23..20b1f84 100755 --- a/src/particles/coal/CoalInterface.cpp +++ b/src/particles/coal/CoalInterface.cpp @@ -22,6 +22,7 @@ using Expr::matrix::sensitivity; namespace Coal{ typedef Expr::LinearFunction::Builder LinearT; + typedef Expr::ConstantExpr::Builder ConstantT; typedef Expr::PlaceHolder::Builder PlaceHolderT; typedef ReactorEnsembleUtil::SumOp::Builder SumOpT; @@ -138,36 +139,27 @@ namespace Coal{ const Coal::CoalComposition coalComp(coaltype_, rootParser_["Particles"]); const int IdxO2 = CanteraObjects::species_index( "O2" ); - for( size_t i = 0;i < nparsize;i++){ + std::vector nparList(nparsize, 1); + if(rootParser_["Particles"]["Size"]["Distribution"].as() == "UserDefinedList"){ + nparList = rootParser_["Particles"]["Size"]["Numbers"].as>(); + } - std::vector nparList(nparsize, 1); - if(rootParser_["Particles"]["Size"]["Distribution"].as() == "UserDefinedList"){ - nparList = rootParser_["Particles"]["Size"]["Numbers"].as>(); - } - double ymoisInit, yvolInit, ycharInit, ymoisInflow, yvolInflow, ycharInflow; - if(rootParser_["Particles"]["CoalInitComp"]){ - const std::vector coalInitComp = rootParser_["Particles"]["CoalInitComp"].as >(); - ymoisInit = coalInitComp[0]; - yvolInit = coalInitComp[1]; - ycharInit = coalInitComp[2]; - } - else{ - ymoisInit = coalComp.get_moisture(); - yvolInit = coalComp.get_vm(); - ycharInit = coalComp.get_fixed_c(); - } + double ymoisInit, yvolInit, ycharInit, ymoisInflow, yvolInflow, ycharInflow; + const std::vector defaultCoalComp={coalComp.get_moisture(), coalComp.get_vm(), coalComp.get_fixed_c()}; + const std::vector coalInitComp = rootParser_["Particles"]["CoalInitComp"].as >(defaultCoalComp); + const std::vector coalInflowComp = rootParser_["Particles"]["CoalInflowComp"].as >(defaultCoalComp); + ymoisInit = coalInitComp[0]; + yvolInit = coalInitComp[1]; + ycharInit = coalInitComp[2]; + ymoisInflow = coalInflowComp[0]; + yvolInflow = coalInflowComp[1]; + ycharInflow = coalInflowComp[2]; + std::cout << " moist: " << ymoisInflow << " " << coalComp.get_moisture() + << " vol: " << yvolInflow << " " << coalComp.get_vm() + << " char: " << ycharInflow << " " << coalComp.get_fixed_c() + << std::endl; - if(rootParser_["Particles"]["CoalInflowComp"]){ - const std::vector coalInflowComp = rootParser_["Particles"]["CoalInflowComp"].as >(); - ymoisInflow = coalInflowComp[0]; - yvolInflow = coalInflowComp[1]; - ycharInflow = coalInflowComp[2]; - } - else{ - ymoisInflow = coalComp.get_moisture(); - yvolInflow = coalComp.get_vm(); - ycharInflow = coalComp.get_fixed_c(); - } + for( size_t i = 0;i < nparsize;i++){ // moisture, volatile and char mass initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCoal.moistureMassFracTags[i], tagsPart.partMassFracTags[i], ymoisInit, 0.0) ) ); @@ -187,16 +179,52 @@ namespace Coal{ initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCoal.charMassFracInflowTags[i], tagsPart.partMassFracInflowTags[i], ycharInflow, 0.0 ))); } - // number fraction of particle - initRoots_.insert( initFactory_.register_expression( new PartLoadingT( tagsPart.partNumFracTags, tags.massTags[IdxO2], tagsCoal.fuelAirEquivalenceRatio, tagsPart.partRhoTags, tagsPart.partSizeTags, - nparList, coalComp, yvolInit, ycharInit, devModel_, charModel_ ))); - initRoots_.insert( initFactory_.register_expression( new PartLoadingT( tagsPart.partNumFracInflowTags, tags.massInflowTags[IdxO2], tagsCoal.fuelAirEquivalenceRatio, tagsPart.partRhoTags, tagsPart.partSizeTags, - nparList, coalComp, yvolInflow, ycharInflow, devModel_, charModel_ ))); - initRoots_.insert( initFactory_.register_expression( new DivideT( tagsCoal.moistureMassEachPartTags[i], tagsCoal.moistureMassFracTags[i], tagsPart.partNumFracTags[i]))); initRoots_.insert( initFactory_.register_expression( new DivideT( tagsCoal.volMassEachPartTags[i], tagsCoal.volMassFracTags[i], tagsPart.partNumFracTags[i]))); initRoots_.insert( initFactory_.register_expression( new DivideT( tagsCoal.charMassEachPartTags[i], tagsCoal.charMassFracTags[i], tagsPart.partNumFracTags[i]))); } + // number fraction of particle + + if(rootParser_["Particles"]["ParticleLoadingInflow"]){ + const double nparInflow = rootParser_["Particles"]["ParticleLoadingInflow"].as(); + for( size_t i = 0;i < nparsize;i++){ + if(rootParser_["Particles"]["Size"]["Distribution"].as() == "Identity"){ + initRoots_.insert( initFactory_.register_expression( new ConstantT(tagsPart.partNumFracInflowTags[i], nparInflow))); + } + else if(rootParser_["Particles"]["Size"]["Distribution"].as() == "UserDefinedList"){ + const std::vector nparFracList = rootParser_["Particles"]["Size"]["NumbersFraction"].as >(); + initRoots_.insert( initFactory_.register_expression( new ConstantT(tagsPart.partNumFracInflowTags[i], nparInflow*nparFracList[i]))); + } + else{ + // npar/nparsize is always equal to 1 in the present code. + initRoots_.insert( initFactory_.register_expression( new ConstantT(tagsPart.partNumFracInflowTags[i], nparInflow/nparsize))); + } + } + } + else{ + initRoots_.insert( initFactory_.register_expression( new PartLoadingT( tagsPart.partNumFracInflowTags, tags.massInflowTags[IdxO2], tagsCoal.fuelAirEquivalenceRatio, tagsPart.partRhoTags, tagsPart.partSizeTags, + nparList, coalComp, yvolInflow, ycharInflow, devModel_, charModel_ ))); + } + if(rootParser_["Particles"]["ParticleLoading"]){ + const double npar = rootParser_["Particles"]["ParticleLoading"].as(); // number of particles per gas mass + for( size_t i = 0;i < nparsize;i++){ + if(rootParser_["Particles"]["Size"]["Distribution"].as() == "Identity"){ + initRoots_.insert(initFactory_.register_expression( new ConstantT( tagsPart.partNumFracTags[i], npar))); + } + else if(rootParser_["Particles"]["Size"]["Distribution"].as() == "UserDefinedList"){ + const std::vector nparFracList = rootParser_["Particles"]["Size"]["NumbersFraction"].as >(); + initRoots_.insert(initFactory_.register_expression( new ConstantT( tagsPart.partNumFracTags[i], npar*nparFracList[i]))); + } + else{ + // npar/nparsize is always equal to 1 in the present code. + initRoots_.insert(initFactory_.register_expression( new ConstantT( tagsPart.partNumFracTags[i], npar/nparsize))); + } + } + } + else{ + initRoots_.insert( initFactory_.register_expression( new PartLoadingT( tagsPart.partNumFracTags, tags.massTags[IdxO2], tagsCoal.fuelAirEquivalenceRatio, tagsPart.partRhoTags, tagsPart.partSizeTags, + nparList, coalComp, yvolInit, ycharInit, devModel_, charModel_ ))); + } } //---------------------------------------------------------------------------------------------- diff --git a/src/particles/coal/Devolatilization/CPD/CPDInterface.cpp b/src/particles/coal/Devolatilization/CPD/CPDInterface.cpp index 000d342..0e07e79 100755 --- a/src/particles/coal/Devolatilization/CPD/CPDInterface.cpp +++ b/src/particles/coal/Devolatilization/CPD/CPDInterface.cpp @@ -141,7 +141,9 @@ namespace CPD{ const Coal::CoalEnsembleTags tagsCoal( Expr::STATE_N, particleNumArray_ ); const int nparsize = particleNumArray_.size(); - double yvolInit, yvolInflow; + double yvolInit, yvolInflow, l0_frac_init, l0_frac_inflow; // mass fraction l in particle volatile + std::vector delta_frac_init, delta_frac_inflow; // mass fraction delta in particle volatile + std::vector gi_init, gi_inflow; // mass of gi per gas mass if( rootParser_["Particles"]["CoalInitComp"] ){ const std::vector coalInitComp = rootParser_["Particles"]["CoalInitComp"].as >(); yvolInit = coalInitComp[1]; @@ -153,21 +155,31 @@ namespace CPD{ yvolInflow = coalInflowComp[1]; } else{ yvolInflow = coalcomp_.get_vm(); } + + l0_frac_init = rootParser_["Particles"]["CPDInit"]["l"].as( cpdInfo_.get_l0_mass() ); + l0_frac_inflow = rootParser_["Particles"]["CPDInflow"]["l"].as( cpdInfo_.get_l0_mass() ); + std::vector deltai0 = deltai_0( cpdInfo_, c0 ); + deltai0.push_back( tar0 ); + delta_frac_init = rootParser_["Particles"]["CPDInit"]["deltai"].as>( deltai0 ); + delta_frac_inflow = rootParser_["Particles"]["CPDInflow"]["deltai"].as>( deltai0 ); + + const std::vector defaultgi(cpdSpeciesNum, 0.0); + gi_init = rootParser_["Particles"]["CPDInit"]["gi"].as>( defaultgi ); + gi_inflow = rootParser_["Particles"]["CPDInflow"]["gi"].as>( defaultgi ); + for( size_t i = 0;i < nparsize;i++ ){ - initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCPD.lTags[i], tagsPart.partMassFracTags[i], yvolInit * cpdInfo_.get_l0_mass(), 0.0 ))); - initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCPD.lInflowTags[i], tagsPart.partMassFracInflowTags[i], yvolInflow * cpdInfo_.get_l0_mass(), 0.0 ))); + initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCPD.lTags[i], tagsPart.partMassFracTags[i], yvolInit * l0_frac_init, 0.0 ))); + initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCPD.lInflowTags[i], tagsPart.partMassFracInflowTags[i], yvolInflow * l0_frac_inflow, 0.0 ))); initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCPD.initPartMassFracTags[i], tagsPart.partMassFracTags[i], 1.0, 0.0 ))); initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCPD.lInitTags[i], tagsCPD.lTags[i], 1, 0 ))); - std::vector deltai0 = deltai_0( cpdInfo_, c0 ); - deltai0.push_back( tar0 ); for( size_t j = 0;j < cpdSpeciesNum;j++ ){ - initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCPD.deltaTags[i*cpdSpeciesNum + j], tagsPart.partMassFracTags[i], yvolInit * deltai0[j], 0.0 ))); - initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCPD.deltaInflowTags[i*cpdSpeciesNum + j], tagsPart.partMassFracInflowTags[i], yvolInflow * deltai0[j], 0.0 ))); + initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCPD.deltaTags[i*cpdSpeciesNum + j], tagsPart.partMassFracTags[i], yvolInit * delta_frac_init[j], 0.0 ))); + initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCPD.deltaInflowTags[i*cpdSpeciesNum + j], tagsPart.partMassFracInflowTags[i], yvolInflow * delta_frac_inflow[j], 0.0 ))); initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCPD.deltaInitTags[i*cpdSpeciesNum+j], tagsCPD.deltaTags[i*cpdSpeciesNum+j], 1.0, 0.0))); - initRoots_.insert( initFactory_.register_expression( new ConstantT( tagsCPD.gTags[i*cpdSpeciesNum + j], 0.0 ))); - initRoots_.insert( initFactory_.register_expression( new ConstantT( tagsCPD.gInflowTags[i*cpdSpeciesNum + j], 0.0 ))); + initRoots_.insert( initFactory_.register_expression( new ConstantT( tagsCPD.gTags[i*cpdSpeciesNum + j], gi_init[j] ))); + initRoots_.insert( initFactory_.register_expression( new ConstantT( tagsCPD.gInflowTags[i*cpdSpeciesNum + j], gi_inflow[j] ))); } } } diff --git a/src/particles/coal/TarSootReaction/TarSootReactionInterface.cpp b/src/particles/coal/TarSootReaction/TarSootReactionInterface.cpp index f976cf8..11c8372 100755 --- a/src/particles/coal/TarSootReaction/TarSootReactionInterface.cpp +++ b/src/particles/coal/TarSootReaction/TarSootReactionInterface.cpp @@ -182,21 +182,29 @@ namespace Tarsoot { //--------------------------------------------------------------------------- void TarSootInterface::setup_initial_conditions_tarsoot(){ + const ReactorEnsembleUtil::ReactorEnsembleTags tags ( Expr::STATE_N); const Tarsoot::TarSootTags tagsTarsoot( Expr::STATE_N, particleNumArray_ ); + double tarInflow, sootInflow, tarInit, sootInit; + const std::vector defaultTarSoot = {0.0, 0.0}; + tarInflow = rootParser_["Particles"]["TarSootInflowFrac"].as>(defaultTarSoot)[0]; + sootInflow = rootParser_["Particles"]["TarSootInflowFrac"].as>(defaultTarSoot)[1]; + tarInit = rootParser_["Particles"]["TarSootInitFrac"].as>(defaultTarSoot)[0]; + sootInit = rootParser_["Particles"]["TarSootInitFrac"].as>(defaultTarSoot)[1]; + if( rootParser_["ReactorParameters"]["ReactorType"].as() == "ConstantVolume" ){ - initFactory_.register_expression( new ConstantT( tagsTarsoot.rhotarGasMassTag, 0.0 )); - initRoots_.insert( initFactory_.register_expression(new LinearT( tagsTarsoot.rhotarGasInflowTag, tagsTarsoot.rhotarGasMassTag, 1.0, 0.0 ))); + initRoots_.insert( initFactory_.register_expression( new LinearT( tagsTarsoot.rhotarGasMassTag, tags.rhoTag, tarInit, 0.0))); + initRoots_.insert( initFactory_.register_expression(new LinearT( tagsTarsoot.rhotarGasInflowTag, tags.rhoInflowTag, tarInflow, 0.0 ))); if(haveSoot_){ - initFactory_.register_expression( new ConstantT( tagsTarsoot.rhosootMassTag, 0.0 )); - initRoots_.insert( initFactory_.register_expression(new LinearT( tagsTarsoot.rhosootInflowTag, tagsTarsoot.rhosootMassTag, 1.0, 0.0 ))); + initRoots_.insert( initFactory_.register_expression( new LinearT( tagsTarsoot.rhosootMassTag, tags.rhoTag, sootInit, 0.0))); + initRoots_.insert( initFactory_.register_expression(new LinearT( tagsTarsoot.rhosootInflowTag, tags.rhoInflowTag, sootInflow, 0.0 ))); } } if( rootParser_["ReactorParameters"]["ReactorType"].as() == "ConstantPressure" ){ - initFactory_.register_expression( new ConstantT( tagsTarsoot.tarGasMassTag, 0.0 )); - initRoots_.insert( initFactory_.register_expression( new LinearT( tagsTarsoot.tarGasInflowTag, tagsTarsoot.tarGasMassTag, 1.0, 0.0 ) ) ); + initRoots_.insert( initFactory_.register_expression( new ConstantT( tagsTarsoot.tarGasMassTag, tarInit ))); + initRoots_.insert( initFactory_.register_expression( new ConstantT( tagsTarsoot.tarGasInflowTag,tarInflow ) ) ); if(haveSoot_){ - initFactory_.register_expression( new ConstantT( tagsTarsoot.sootMassTag, 0.0 )); - initRoots_.insert( initFactory_.register_expression( new LinearT( tagsTarsoot.sootInflowTag, tagsTarsoot.sootMassTag, 1.0, 0.0 ) ) ); + initRoots_.insert( initFactory_.register_expression( new ConstantT( tagsTarsoot.sootMassTag, sootInit ))); + initRoots_.insert( initFactory_.register_expression( new ConstantT( tagsTarsoot.sootInflowTag,sootInflow ) ) ); } } } -- GitLab From b834b5e3a281a18d4f2c4d66c43821c16672f610 Mon Sep 17 00:00:00 2001 From: Hang Zhou Date: Tue, 26 May 2020 23:14:21 -0600 Subject: [PATCH 03/10] Adding an option to specify reactor shape. Now, spherical and cylinder are supported, which can be given in the input file by `ReactorParameters: {ReactorShape:}'. Radius needs to be given for both types of reactor (default: 0.001). Height needs to be given for cylinder reactor (default: 0.0). --- src/ConvectiveHeatTransferRate.h | 35 ++++++----- src/ReactorEnsembleUtil.cpp | 3 +- src/ReactorEnsembleUtil.h | 3 +- src/ReactorVolume.h | 93 +++++++++++++++++++++++++++++ src/parser/ParseInputFile.cpp | 21 +++++-- src/particles/ParticleInterface.cpp | 16 +++-- src/particles/ParticleNumber.h | 38 ++++++------ 7 files changed, 165 insertions(+), 44 deletions(-) create mode 100755 src/ReactorVolume.h diff --git a/src/ConvectiveHeatTransferRate.h b/src/ConvectiveHeatTransferRate.h index a3f4944..c6b90f5 100644 --- a/src/ConvectiveHeatTransferRate.h +++ b/src/ConvectiveHeatTransferRate.h @@ -48,6 +48,10 @@ namespace ReactorEnsembleUtil{ * \f] * Here, \f$ k \f$ is the convective coefficient between gas phase and surroundings, * \f$ T_{\inf} \f$ is the surroundings temperature. + * \f$ \frac{A}{V}\f$ is the area/volume ratio of the reactor. + * For spherical reactor, \f$ \frac{A}{V}=\frac{3}{r}\f$, with \f$r\f$ represents the reacotr radius. + * For cylinder reactor, \f$ \frac{A}{V}=\frac{2(r+h)}{rh}\f$, + * with \f$r\f$ and \f$h\f$ represent radius of the circular end of the cylinder and height of the cylinder. * * The sensitivity is given as * \f[ @@ -129,31 +133,34 @@ namespace ReactorEnsembleUtil{ * * The convective heat transfer term under constant pressure condition is give as * \f[ - * Q_{cov} = \frac{3 k }{\rho r } (T_{\inf} - T) + * Q_{cov} = k \frac{A}{\rho V} (T_{\inf} - T) * \f] * Here, \f$ k \f$ is the convective coefficient between gas phase and surroundings, - * \f$ r \f$ is the reactor radius, * \f$ T_{\inf} \f$ is the surroundings temperature. + * \f$ \frac{A}{V}\f$ is the area/volume ratio of the reactor. + * For spherical reactor, \f$ \frac{A}{V}=\frac{3}{r}\f$, with \f$r\f$ represents the reacotr radius. + * For cylinder reactor, \f$ \frac{A}{V}=\frac{2(r+h)}{rh}\f$, + * with \f$r\f$ and \f$h\f$ represent radius of the circular end of the cylinder and height of the cylinder. * * The sensitivity is given as * \f[ - * \frac{\partial Q_{cov}}{\partial \phi} = \frac{3}{r} (\frac{\partial k}{\partial \phi}\frac{T_{\inf}-T}{\rho} + * \frac{\partial Q_{cov}}{\partial \phi} = \frac{A}{V} (\frac{\partial k}{\partial \phi}\frac{T_{\inf}-T}{\rho} * + \frac{k}{\rho}(\frac{\partial T_{\inf}}{\partial \phi}-\frac{\partial T}{\partial \phi}) * - \frac{k}{\rho^2}\frac{\partial \rho}{\partial \phi}(T_{\inf}-T)) * \f] */ template class ConvectionHeatRateCP : public Expr::Expression { - const double radiusReactor_; + const double surfaceAreaPerVolume_; DECLARE_FIELDS( FieldT, temp_, rho_, convCoeff_, convTemp_); ConvectionHeatRateCP( const Expr::Tag tempTag, const Expr::Tag rhoTag, const Expr::Tag convectionCoeffTag, const Expr::Tag convectionTempTag, - const double radiusReactor) + const double surfaceAreaPerVolume) : Expr::Expression(), - radiusReactor_( radiusReactor){ + surfaceAreaPerVolume_( surfaceAreaPerVolume){ this->set_gpu_runnable( true ); temp_ = this->template create_field_request( tempTag ); rho_ = this->template create_field_request( rhoTag ); @@ -164,7 +171,7 @@ namespace ReactorEnsembleUtil{ public: class Builder : public Expr::ExpressionBuilder { const Expr::Tag tempTag_, rhoTag_, convectionCoeffTag_, convectionTempTag_; - const double radiusReactor_; + const double surfaceAreaPerVolume_; public: /** * @brief The mechanism for building a ConvectionHeatRateCP object @@ -174,25 +181,25 @@ namespace ReactorEnsembleUtil{ * @param rhoTag Gas phase density * @param convectionCoeffTag Convective heat transfer coefficient between gas phase and surroundings * @param convectionTempTag Surroundings temperature - * @param radiusReactor Reactor radius + * @param surfaceAreaPerVolume Ratio between surface area and volume of reactor */ Builder( const Expr::Tag heatRateTag, const Expr::Tag tempTag, const Expr::Tag rhoTag, const Expr::Tag convectionCoeffTag, const Expr::Tag convectionTempTag, - const double radiusReactor) + const double surfaceAreaPerVolume) : Expr::ExpressionBuilder( heatRateTag ), tempTag_( tempTag ), rhoTag_( rhoTag ), convectionCoeffTag_( convectionCoeffTag ), convectionTempTag_( convectionTempTag ), - radiusReactor_( radiusReactor ){} + surfaceAreaPerVolume_( surfaceAreaPerVolume ){} ~Builder(){} Expr::ExpressionBase* build() const{ - return new ConvectionHeatRateCP( tempTag_, rhoTag_, convectionCoeffTag_, convectionTempTag_, radiusReactor_ ); + return new ConvectionHeatRateCP( tempTag_, rhoTag_, convectionCoeffTag_, convectionTempTag_, surfaceAreaPerVolume_ ); } }; @@ -202,7 +209,7 @@ namespace ReactorEnsembleUtil{ const FieldT& rho = rho_->field_ref(); const FieldT& convCoeff = convCoeff_->field_ref(); const FieldT& convTemp = convTemp_->field_ref(); - this->value() <<= 3.0 * convCoeff / ( radiusReactor_ * rho ) * (convTemp - temp); + this->value() <<= convCoeff * surfaceAreaPerVolume_ /rho * (convTemp - temp); } void sensitivity( const Expr::Tag& sensVarTag ){ @@ -215,8 +222,8 @@ namespace ReactorEnsembleUtil{ const FieldT& drhodv = rho_->sens_field_ref( sensVarTag ); const FieldT& dconvCoeffdv = convCoeff_->sens_field_ref( sensVarTag ); const FieldT& dconvTempdv = convTemp_->sens_field_ref( sensVarTag ); - dfdv <<= 3.0/radiusReactor_ * ((dconvCoeffdv/rho-convCoeff/square(rho)*drhodv) * (convTemp - temp) - + convCoeff/rho * (dconvTempdv-dTdv)); + dfdv <<= surfaceAreaPerVolume_ * ((dconvCoeffdv/rho-convCoeff/square(rho)*drhodv) * (convTemp - temp) + + convCoeff/rho * (dconvTempdv-dTdv)); } }; diff --git a/src/ReactorEnsembleUtil.cpp b/src/ReactorEnsembleUtil.cpp index 8ac018d..2bf819c 100644 --- a/src/ReactorEnsembleUtil.cpp +++ b/src/ReactorEnsembleUtil.cpp @@ -144,7 +144,8 @@ namespace ReactorEnsembleUtil{ dsTag ( Expr::Tag( "ds" , state ) ), dtTag ( Expr::Tag( "dt" , state ) ), mixtureFractionTag( Expr::Tag( "mixture_fraction" , state ) ), - timeTag ( Expr::Tag( "simulation_time" , state ) ) + timeTag ( Expr::Tag( "simulation_time" , state ) ), + reactorVolumeTag ( Expr::Tag( "reactor_volume" , state ) ) { const std::vector& spNames = CanteraObjects::species_names(); moleTags = Expr::tag_list( spNames, state, "X_" ); diff --git a/src/ReactorEnsembleUtil.h b/src/ReactorEnsembleUtil.h index 988f050..701a913 100644 --- a/src/ReactorEnsembleUtil.h +++ b/src/ReactorEnsembleUtil.h @@ -103,7 +103,8 @@ namespace ReactorEnsembleUtil{ dsTag, ///< dualtime dtTag, ///< timestep mixtureFractionTag,///< mixture fraction (used for initialization) - timeTag; ///< simulation time + timeTag, ///< simulation time + reactorVolumeTag; ///< reactor volume Expr::TagList moleTags, ///< mole fractions massTags, ///< mass fractions diff --git a/src/ReactorVolume.h b/src/ReactorVolume.h new file mode 100755 index 0000000..603ff69 --- /dev/null +++ b/src/ReactorVolume.h @@ -0,0 +1,93 @@ + +/** + * @file ReactorVolume.h + * @par Getting the reactor volume + * @author Hang Zhou + * + */ + +#ifndef REACTORVOLUME_H_ +#define REACTORVOLUME_H_ + +#include + +namespace ReactorEnsembleUtil { + + /** + * @class ReactorVolume + * @ingroup ReactorEnsembleUtil + * @brief Getting the reactor volume based on volume shape, radius and height + * + * The expression is given as + * For spherical reactor: + * \f[ + * V = \frac{4}{3}\pi r^3 + * \f] + * Here, \f$r\f$ is the radius of spherical of the reactor. + * For cylinder reactor: + * \f[ + * V = \pi r^2 h + * \f] + * Here, \f$r\f$ is the radius of the circular end of the cylinder. + * \f$h\f$ is the height of the cylinder. + */ + + template + class ReactorVolume : public Expr::Expression { + const double radius_, height_; + const std::string reactorShape_; + + ReactorVolume( const std::string reactorShape, + const double radius, + const double height) + : Expr::Expression(), + reactorShape_(reactorShape), + radius_(radius), + height_(height){ this->set_gpu_runnable( true );} + + public: + class Builder : public Expr::ExpressionBuilder { + const double radius_, height_; + const std::string reactorShape_; + public: + /** + * @brief The mechanism for building a SherwoodNumber object + * @tparam FieldT + * @param reactorVolumeTag reactor volume + * @param reactorShape reactor shape (spherical or cylinder) + * @param radius radius for spherical reactor or radius of the circular end of the cylinder reactor + * @param height height of the cylinder + */ + Builder( const Expr::Tag reactorVolumeTag, + const std::string reactorShape, + const double radius, + const double height) + : Expr::ExpressionBuilder( reactorVolumeTag ), + reactorShape_ ( reactorShape ), + radius_ ( radius ), + height_ ( height ) + {} + + ~Builder(){} + + Expr::ExpressionBase* build() const{ + return new ReactorVolume( reactorShape_, radius_, height_ ); + } + }; + + + void evaluate(){ + using namespace SpatialOps; + + if(reactorShape_ == "Spherical"){ + this->value() <<= 4.0/3.0 * M_PI * radius_ * radius_ * radius_; + } + if(reactorShape_ == "Cylinder"){ + this->value() <<= M_PI * radius_ * radius_ * height_; + } + } + }; + +} // namespace ReactorEnsembleUtil + +#endif /* REACTORVOLUME_H_ */ diff --git a/src/parser/ParseInputFile.cpp b/src/parser/ParseInputFile.cpp index 17a8899..f085ffc 100644 --- a/src/parser/ParseInputFile.cpp +++ b/src/parser/ParseInputFile.cpp @@ -197,12 +197,24 @@ parse_reactor_parameters( const YAML::Node& rootParser, if( !parser ){ std::cout << "No 'ReactorParameters' spec was found in the input file. Using default parameters\n"; } + const std::string reactorShape = parser["ReactorShape"].as("Spherical"); const double radius = parser["Radius"].as( 0.001 ); + const double height = parser["Height"].as( 0.0 ); + double SoV; std::cout << std::endl; - std::cout << "Reactor ensemble specifications" << std::endl - << "------------------------------------" << std::endl - << " - reactor radius (m) : " << radius << std::endl; + std::cout << "Reactor ensemble specifications" << std::endl + << "------------------------------------" << std::endl + << " - reactor shape : " << reactorShape << std::endl + << " - reactor radius (m) : " << radius << std::endl; + if(reactorShape == "Cylinder"){ + std::cout << " - reactor height (m) : " << height << std::endl; + SoV = 2.0*(radius+height)/(radius*height); + } + if(reactorShape == "Spherical"){ + SoV = 3.0 / radius; + } + std::cout << " - area/volume ratio (1/m): " << SoV << std::endl; // build the expressions implied by these quantities const ReactorEnsembleUtil::ReactorEnsembleTags tags( Expr::STATE_NONE ); @@ -211,12 +223,11 @@ parse_reactor_parameters( const YAML::Node& rootParser, const double SoV = 3.0 / radius; // 1/m, surface area to volume ratio typedef ReactorEnsembleUtil::ConvectionHeatRateCV::Builder ConvectionCVT; factory.register_expression( new ConvectionCVT( tags.rhoEgyHeatRhsTag, tags.tempTag, tags.convecCoeffTag, tags.convecTempTag, SoV ) ); - std::cout << " - area/volume ratio (1/m): " << SoV << std::endl; } else{ typedef ReactorEnsembleUtil::ConvectionHeatRateCP::Builder ConvectionCPT; typedef ReactorEnsembleUtil::HheatPartialT ::Builder HheatPartialTT; - factory.register_expression( new ConvectionCPT( tags.enthHeatRhsTag, tags.tempTag, tags.rhoTag, tags.convecCoeffTag, tags.convecTempTag, radius )); + factory.register_expression( new ConvectionCPT( tags.enthHeatRhsTag, tags.tempTag, tags.rhoTag, tags.convecCoeffTag, tags.convecTempTag, SoV )); } const std::string ReactionInGas = rootParser["ReactionInGas"].as( "True" ); diff --git a/src/particles/ParticleInterface.cpp b/src/particles/ParticleInterface.cpp index 2d4d0e4..1a5a01b 100755 --- a/src/particles/ParticleInterface.cpp +++ b/src/particles/ParticleInterface.cpp @@ -44,6 +44,7 @@ #include "SumOp.h" #include "NusseltNumber.h" #include "SherwoodNumber.h" +#include "ReactorVolume.h" #include "ParticleInterface.h" #include "ParticleMassFraction.h" @@ -79,6 +80,7 @@ namespace Particles { typedef ReactorEnsembleUtil::NusseltNumber::Builder NuNumberT; typedef ReactorEnsembleUtil::DivisionExpression::Builder DivideT; typedef ReactorEnsembleUtil::SherwoodNumber::Builder ShNumberT; + typedef ReactorEnsembleUtil::ReactorVolume::Builder ReactorVolumeT; typedef Particles::PartMassFraction::Builder MassFracPartT; typedef Particles::PartSize::Builder SizePartT; @@ -235,7 +237,6 @@ namespace Particles { const ReactorEnsembleUtil::ReactorEnsembleTags tags( Expr::STATE_N ); const Particles::ParticleEnsembleTags tagsPart( Expr::STATE_N, particleNumArray_ ); - const double radius = rootParser_["ReactorParameters"]["Radius"].as( 0.001 ); // Parser particle initial conditions based on input file BOOST_FOREACH( const YAML::Node& parserPart_Spec, rootParser_["Particles"]["InitialConditions"] ){ assert( parserPart_Spec.IsDefined()); @@ -290,8 +291,13 @@ namespace Particles { } } initRoots_.insert( initFactory_.register_expression( new DivideT( tagsPart.massEachPartTags[i], tagsPart.partMassFracTags[i], tagsPart.partNumFracTags[i]))); - initRoots_.insert( initFactory_.register_expression( new PartNumT( tagsPart.partNumTags[i], tagsPart.partNumFracTags[i], tags.rhoTag, radius))); + initRoots_.insert( initFactory_.register_expression( new PartNumT( tagsPart.partNumTags[i], tagsPart.partNumFracTags[i], tags.rhoTag, tags.reactorVolumeTag))); } + + const std::string reactorShape = rootParser_["ReactorParameters"]["ReactorShape"].as("Spherical"); + const double radius = rootParser_["ReactorParameters"]["Radius"].as( 0.001 ); + const double height = rootParser_["ReactorParameters"]["Height"].as( 0.0 ); + initFactory_.register_expression( new ReactorVolumeT( tags.reactorVolumeTag, reactorShape, radius, height)); initRoots_.insert( initFactory_.register_expression( new ViscosityT( tags.dynviscosityTag, tags. tempTag, tags.massTags ) ) ); } @@ -301,12 +307,12 @@ namespace Particles { const Particles::ParticleEnsembleTags tagsEPart( Expr::STATE_NONE, particleNumArray_ ); const ReactorEnsembleUtil::ReactorEnsembleTags tagsE( Expr::STATE_NONE ); - const double radius = rootParser_["ReactorParameters"]["Radius"].as( 0.001 ); Expr::ExpressionFactory& execFactory = integrator_->factory(); parse_particle_parameters(); + execFactory.register_expression( new PlaceHolderT( tagsE.reactorVolumeTag )); execFactory.register_expression( new ThermalConducT( tagsE.thermalConducTag, tagsE.tempTag, tagsE.massTags, tagsE.mmwTag ) ); // To simplify the jacobian matrix and because there is no sensitivity in viscosity function in PoKiTT now, // viscosity is set to be constant in present code. @@ -372,7 +378,7 @@ namespace Particles { integrator_->add_variable( tagsEPart.partTempTags[i].name(), tagsEPart.partTempFullRhsTags[i], equIndex_, equIndex_); integrator_->register_root_expression( new DivideT( tagsEPart.massEachPartTags[i], tagsEPart.partMassFracTags[i], tagsEPart.partNumFracTags[i])); - integrator_->register_root_expression( new PartNumT( tagsEPart.partNumTags[i], tagsEPart.partNumFracTags[i], tagsE.rhoTag, radius)); + integrator_->register_root_expression( new PartNumT( tagsEPart.partNumTags[i], tagsEPart.partNumFracTags[i], tagsE.rhoTag, tagsE.reactorVolumeTag)); } // modify gas phase equations if(rootParser_["ReactorParameters"]["ReactorType"].as() == "ConstantPressure"){ @@ -423,6 +429,7 @@ namespace Particles { } integrator_->copy_from_initial_condition_to_execution( tagsE.dynviscosityTag.name()); } + integrator_->copy_from_initial_condition_to_execution( tagsE.reactorVolumeTag.name()); } for( size_t i = 0;i < nparsize_;i++ ){ integrator_->lock_field( tagsEPart.partTempInflowTags[i] ); @@ -439,6 +446,7 @@ namespace Particles { } } integrator_->lock_field( tagsE.dynviscosityTag ); + integrator_->lock_field( tagsE.reactorVolumeTag ); if(coalimplement_){ CoalInterface_->initialize_coal(); diff --git a/src/particles/ParticleNumber.h b/src/particles/ParticleNumber.h index cc1d34b..64c5ffa 100644 --- a/src/particles/ParticleNumber.h +++ b/src/particles/ParticleNumber.h @@ -19,41 +19,39 @@ namespace Particles{ * * The expression is given as * \f[ - * N_p = n_p \rho (4/3) \pi r^3 + * N_p = n_p \rho V * \f] * Here, \f$ n_p\f$ is the number of particles per gas mass. * \f$ \rho\f$ is the density of gas phase - * \f$ r\f$ is the reactor radius. + * \f$ V\f$ is the reactor volume. * * The sensitivity of the result is given as * \f[ - * \frac{\partial N_p}{\partial \phi} = (4/3) \pi r^3 (\rho \frac{\partial n_p}{\partial \phi} - * + n_p \frac{\partial \rho}{\partial \phi}) + * \frac{\partial N_p}{\partial \phi} = V (\rho \frac{\partial n_p}{\partial \phi} + * + n_p \frac{\partial \rho}{\partial \phi}) * \f] */ template< typename FieldT > class ParticleNumber : public Expr::Expression { - DECLARE_FIELDS( FieldT, pNumFrac_, rho_ ) - const double radius_; + DECLARE_FIELDS( FieldT, pNumFrac_, rho_, reactorVolume_ ) ParticleNumber( const Expr::Tag& pNumFracTag, const Expr::Tag& rhoTag, - const double radius) - : Expr::Expression(), - radius_(radius) + const Expr::Tag& reactorVolumeTag) + : Expr::Expression() { this->set_gpu_runnable(true); - pNumFrac_ = this->template create_field_request( pNumFracTag ); - rho_ = this->template create_field_request( rhoTag ); + pNumFrac_ = this->template create_field_request( pNumFracTag ); + rho_ = this->template create_field_request( rhoTag ); + reactorVolume_ = this->template create_field_request( reactorVolumeTag ); } public: class Builder : public Expr::ExpressionBuilder { - const Expr::Tag pNumFracTag_, rhoTag_; - const double radius_; + const Expr::Tag pNumFracTag_, rhoTag_, reactorVolumeTag_; public: /** * @brief The mechanism for building a ParticleNumber object @@ -61,20 +59,20 @@ namespace Particles{ * @param pNumTag Number of particle * @param pNumFracTag Number of particle per gas mass * @param rhoTag Density of gas - * @param radius Radius of the reactor + * @param reactorVolumeTag volume of the reactor */ Builder( const Expr::Tag& pNumTag, const Expr::Tag& pNumFracTag, const Expr::Tag& rhoTag, - const double radius) + const Expr::Tag& reactorVolumeTag) : ExpressionBuilder(pNumTag), pNumFracTag_( pNumFracTag), rhoTag_(rhoTag), - radius_(radius) + reactorVolumeTag_(reactorVolumeTag) {} ~Builder(){} Expr::ExpressionBase* build() const{ - return new ParticleNumber(pNumFracTag_, rhoTag_, radius_); + return new ParticleNumber(pNumFracTag_, rhoTag_, reactorVolumeTag_); } }; @@ -85,16 +83,18 @@ namespace Particles{ FieldT& result = this->value(); const FieldT& rho = rho_->field_ref(); const FieldT& pNumFrac = pNumFrac_->field_ref(); - result <<= pNumFrac * rho * (M_PI*4/3*radius_*radius_*radius_); + const FieldT& reactorVolume = reactorVolume_->field_ref(); + result <<= pNumFrac * rho * reactorVolume; } void sensitivity( const Expr::Tag& sensVarTag ){ FieldT & dfdv = this->sensitivity_result( sensVarTag ); const FieldT& rho = rho_->field_ref(); const FieldT& pNumFrac = pNumFrac_->field_ref(); + const FieldT& reactorVolume = reactorVolume_->field_ref(); const FieldT& drhodv = rho_->sens_field_ref(sensVarTag); const FieldT& dpNumFracdv = pNumFrac_->sens_field_ref(sensVarTag); - dfdv <<= (dpNumFracdv*rho + pNumFrac*drhodv)* (M_PI*4/3*radius_*radius_*radius_); + dfdv <<= (dpNumFracdv*rho + pNumFrac*drhodv)* reactorVolume; } }; -- GitLab From 1cabe72b981caf988de5122157b4babd7b2d8d73 Mon Sep 17 00:00:00 2001 From: Hang Zhou Date: Wed, 17 Jun 2020 17:27:53 -0600 Subject: [PATCH 04/10] Deleting the weight functions used to calculate the source terms in CPD models. Because the source term is releated to the mass of labile bridge and delta, it will become zero when the mass is zero. And the source terms are set to be zero if mass is negative. So, it will not oscillate around zero like what we have for vaporization model, that is, weight function is not required. --- .../coal/Devolatilization/CPD/CPDData.cpp | 10 +-- .../Devolatilization/CPD/CPDInterface.cpp | 22 ++----- .../coal/Devolatilization/CPD/CPDInterface.h | 2 - .../coal/Devolatilization/CPD/C_RHS.h | 35 ++--------- .../coal/Devolatilization/CPD/Deltai_RHS.h | 62 ++++--------------- .../coal/Devolatilization/CPD/E_fun.h | 6 +- .../coal/Devolatilization/CPD/Gi_RHS.h | 61 ++++-------------- .../coal/Devolatilization/CPD/L_RHS.h | 37 +++-------- .../coal/TarSootReaction/SootFormationRate.h | 8 +-- .../coal/TarSootReaction/SootOxidationRate.h | 4 +- 10 files changed, 54 insertions(+), 193 deletions(-) diff --git a/src/particles/coal/Devolatilization/CPD/CPDData.cpp b/src/particles/coal/Devolatilization/CPD/CPDData.cpp index 0d6702f..c6b494c 100755 --- a/src/particles/coal/Devolatilization/CPD/CPDData.cpp +++ b/src/particles/coal/Devolatilization/CPD/CPDData.cpp @@ -371,7 +371,7 @@ namespace CPD{ // jcs why is "sumfg_" that Babak originally used not correct? sumfg_ = std::accumulate( fg_.begin(), fg_.end(), 0.0 ) + tarMassFrac0_; - A0_.push_back( 0.56E18 ); // CO2 extra loose ( 1) + A0_.push_back( 0.81E13 ); // CO2 extra loose ( 1) A0_.push_back( 0.65E17 ); // CO2 loose ( 2) A0_.push_back( 0.11E16 ); // CO2 tight ( 3) A0_.push_back( 0.22E19 ); // H2O loose ( 4) @@ -386,10 +386,10 @@ namespace CPD{ A0_.push_back( 0.34E12 ); // CH4 tight (14) A0_.push_back( 0.10E15 ); // H aromatic (15) A0_.push_back( 0.20E14 ); // CO extra tight (17) - A0_.push_back( 0.86E15 ); // tar + A0_.push_back( 0.84E15 ); // tar // These are E0/R - E0_.push_back( 30000 ); + E0_.push_back( 22500 ); E0_.push_back( 33850 ); E0_.push_back( 38315 ); E0_.push_back( 30000 ); @@ -404,10 +404,10 @@ namespace CPD{ E0_.push_back( 30000 ); E0_.push_back( 40500 ); E0_.push_back( 45500 ); - E0_.push_back( 27700 ); // tar + E0_.push_back( 30000 ); // tar // These are sigma/R - sigma_.push_back( 2000 ); + sigma_.push_back( 1500 ); sigma_.push_back( 1500 ); sigma_.push_back( 2000 ); sigma_.push_back( 1500 ); diff --git a/src/particles/coal/Devolatilization/CPD/CPDInterface.cpp b/src/particles/coal/Devolatilization/CPD/CPDInterface.cpp index 0e07e79..0848986 100755 --- a/src/particles/coal/Devolatilization/CPD/CPDInterface.cpp +++ b/src/particles/coal/Devolatilization/CPD/CPDInterface.cpp @@ -55,7 +55,6 @@ namespace CPD{ { initPartMassFracTags = Expr::tag_list( particleNumArray, state, "init_part_mass_frac_" ); lTags = Expr::tag_list( particleNumArray, state, "l_" ); - lInitTags = Expr::tag_list( particleNumArray, state, "l_init_" ); lInflowTags = Expr::tag_list( particleNumArray, state, "l_", "_inflow" ); lMixRhsTags = Expr::tag_list( particleNumArray, state, "l_", "_mix_rhs" ); lKinRhsTags = Expr::tag_list( particleNumArray, state, "l_", "_kin_rhs" ); @@ -74,7 +73,6 @@ namespace CPD{ egygTags = Expr::tag_list( cpdArray , state, "egy_g_" ); kgTags = Expr::tag_list( cpdArray , state, "kg_" ); deltaTags = Expr::tag_list( cpdArray , state, "delta_" ); - deltaInitTags = Expr::tag_list( cpdArray , state, "delta_init_" ); deltaInflowTags = Expr::tag_list( cpdArray , state, "delta_", "_inflow" ); deltaMixRhsTags = Expr::tag_list( cpdArray , state, "delta_", "_mix_rhs" ); deltaKinRhsTags = Expr::tag_list( cpdArray , state, "delta_", "_kin_rhs" ); @@ -172,12 +170,10 @@ namespace CPD{ initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCPD.lInflowTags[i], tagsPart.partMassFracInflowTags[i], yvolInflow * l0_frac_inflow, 0.0 ))); initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCPD.initPartMassFracTags[i], tagsPart.partMassFracTags[i], 1.0, 0.0 ))); - initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCPD.lInitTags[i], tagsCPD.lTags[i], 1, 0 ))); for( size_t j = 0;j < cpdSpeciesNum;j++ ){ initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCPD.deltaTags[i*cpdSpeciesNum + j], tagsPart.partMassFracTags[i], yvolInit * delta_frac_init[j], 0.0 ))); initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCPD.deltaInflowTags[i*cpdSpeciesNum + j], tagsPart.partMassFracInflowTags[i], yvolInflow * delta_frac_inflow[j], 0.0 ))); - initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCPD.deltaInitTags[i*cpdSpeciesNum+j], tagsCPD.deltaTags[i*cpdSpeciesNum+j], 1.0, 0.0))); initRoots_.insert( initFactory_.register_expression( new ConstantT( tagsCPD.gTags[i*cpdSpeciesNum + j], gi_init[j] ))); initRoots_.insert( initFactory_.register_expression( new ConstantT( tagsCPD.gInflowTags[i*cpdSpeciesNum + j], gi_inflow[j] ))); } @@ -198,22 +194,20 @@ namespace CPD{ for( size_t i = 0;i < nparsize;i++ ){ execFactory.register_expression( new PlaceHolderT( tagsECPD.initPartMassFracTags[i] )); - execFactory.register_expression( new PlaceHolderT( tagsECPD.lInitTags[i] )); // kb execFactory.register_expression( new kbT( tagsECPD.kbTags[i], tagsEPart.partTempTags[i] )); //l_rhs execFactory.register_expression( new PlaceHolderT( tagsECPD.lInflowTags[i] )); execFactory.register_expression( new ZeroDMixingCPT( tagsECPD.lMixRhsTags[i], tagsECPD.lInflowTags[i], tagsECPD.lTags[i], tagsE.tauMixTag, tagsE.rhoInflowTag, tagsE.rhoTag )); execFactory.register_expression( new SourceFromGasMassT( tagsECPD.lKinRhsTags[i], tagsEPart.partToGasMassTag, tagsECPD.lTags[i])); - execFactory.register_expression( new LRhsT( tagsECPD.lReacTags[i], tagsECPD.kbTags[i], tagsECPD.lTags[i], tagsECPD.lInitTags[i] )); //negative + execFactory.register_expression( new LRhsT( tagsECPD.lReacTags[i], tagsECPD.kbTags[i], tagsECPD.lTags[i] )); //negative execFactory.attach_dependency_to_expression( tagsECPD.lReacTags[i], tagsECPD.lKinRhsTags[i], Expr::ADD_SOURCE_EXPRESSION); execFactory.register_expression( new SumT( tagsECPD.lFullRhsTags[i], { tagsECPD.lKinRhsTags[i], tagsECPD.lMixRhsTags[i] } )); //C_rhs - execFactory.register_expression( new CRhsT( tagsEDev.volCharTags[i], tagsECPD.kbTags[i], tagsECPD.lTags[i], tagsECPD.lInitTags[i], cpdInfo_ )); // positive + execFactory.register_expression( new CRhsT( tagsEDev.volCharTags[i], tagsECPD.kbTags[i], tagsECPD.lTags[i], cpdInfo_ )); // positive for( size_t j = 0;j < cpdSpeciesNum;j++ ){ - execFactory.register_expression( new PlaceHolderT( tagsECPD.deltaInitTags[i*cpdSpeciesNum+j] )); //kg_i execFactory.register_expression( new FEfungiT( tagsECPD.fEgTags[i * cpdSpeciesNum + j], tagsECPD.gTags[i * cpdSpeciesNum + j], tagsECPD.initPartMassFracTags[i], cpdInfo_, j )); execFactory.register_expression( new EgifunT( tagsECPD.egygTags[i * cpdSpeciesNum + j], tagsECPD.fEgTags[i * cpdSpeciesNum + j], cpdInfo_, j )); @@ -223,7 +217,7 @@ namespace CPD{ execFactory.register_expression( new PlaceHolderT( tagsECPD.deltaInflowTags[i * cpdSpeciesNum + j] )); execFactory.register_expression( new SourceFromGasMassT( tagsECPD.deltaKinRhsTags[i * cpdSpeciesNum + j], tagsEPart.partToGasMassTag, tagsECPD.deltaTags[i * cpdSpeciesNum + j])); execFactory.register_expression( new DeltaiRhsT( tagsECPD.deltaReacTags[i * cpdSpeciesNum + j], tagsECPD.kbTags[i], tagsECPD.kgTags[i * cpdSpeciesNum + j], tagsECPD.deltaTags[i * cpdSpeciesNum + j], - tagsECPD.deltaInitTags[i * cpdSpeciesNum + j], tagsECPD.lTags[i], tagsECPD.lInitTags[i], cpdInfo_, tarSootInfo_, j )); + tagsECPD.lTags[i], cpdInfo_, tarSootInfo_, j )); execFactory.attach_dependency_to_expression( tagsECPD.deltaReacTags[i * cpdSpeciesNum + j], tagsECPD.deltaKinRhsTags[i * cpdSpeciesNum + j], Expr::ADD_SOURCE_EXPRESSION); execFactory.register_expression( new ZeroDMixingCPT( tagsECPD.deltaMixRhsTags[i * cpdSpeciesNum + j], tagsECPD.deltaInflowTags[i * cpdSpeciesNum + j],tagsECPD.deltaTags[i * cpdSpeciesNum + j], tagsE.tauMixTag, tagsE.rhoInflowTag, tagsE.rhoTag )); @@ -233,7 +227,7 @@ namespace CPD{ execFactory.register_expression( new PlaceHolderT( tagsECPD.gInflowTags[i * cpdSpeciesNum + j] )); execFactory.register_expression( new SourceFromGasMassT( tagsECPD.gKinRhsTags[i*cpdSpeciesNum+j], tagsEPart.partToGasMassTag, tagsECPD.gTags[i*cpdSpeciesNum+j])); execFactory.register_expression( new GiRhsT( tagsECPD.gReacTags[i * cpdSpeciesNum + j], tagsECPD.kbTags[i], tagsECPD.kgTags[i * cpdSpeciesNum + j], tagsECPD.deltaTags[i * cpdSpeciesNum + j], - tagsECPD.deltaInitTags[i * cpdSpeciesNum + j], tagsECPD.lTags[i], tagsECPD.lInitTags[i], cpdInfo_, tarSootInfo_, j )); //positive + tagsECPD.lTags[i], cpdInfo_, tarSootInfo_, j )); //positive execFactory.attach_dependency_to_expression( tagsECPD.gReacTags[i * cpdSpeciesNum + j], tagsECPD.gKinRhsTags[i * cpdSpeciesNum + j], Expr::ADD_SOURCE_EXPRESSION); execFactory.register_expression( new ZeroDMixingCPT( tagsECPD.gMixRhsTags[i * cpdSpeciesNum + j], tagsECPD.gInflowTags[i * cpdSpeciesNum + j], tagsECPD.gTags[i * cpdSpeciesNum + j], tagsE.tauMixTag, tagsE.rhoInflowTag, tagsE.rhoTag )); @@ -267,15 +261,10 @@ namespace CPD{ for( size_t i = 0;i < nparsize;i++ ){ if(!isRestart_){ integrator_->copy_from_initial_condition_to_execution(tagsECPD.initPartMassFracTags[i].name()); - integrator_->copy_from_initial_condition_to_execution(tagsECPD.lInitTags[i].name()); integrator_->copy_from_initial_condition_to_execution(tagsECPD.lInflowTags[i].name()); - for(size_t j = 0; jcopy_from_initial_condition_to_execution(tagsECPD.deltaInitTags[i*cpdSpeciesNum+j].name()); - } } integrator_->lock_field( tagsECPD.initPartMassFracTags[i] ); - integrator_->lock_field( tagsECPD.lInitTags[i] ); integrator_->lock_field( tagsECPD.lInflowTags[i] ); for(size_t j = 0; jlock_field( tagsECPD.deltaInflowTags[i*cpdSpeciesNum+j] ); integrator_->lock_field( tagsECPD.gInflowTags[i*cpdSpeciesNum+j] ); - integrator_->lock_field( tagsECPD.deltaInitTags[i*cpdSpeciesNum+j] ); } } } @@ -393,8 +381,6 @@ namespace CPD{ const CPD::CPDTags tagsECPD( Expr::STATE_NONE, particleNumArray_, cpdArray_ ); for( size_t i=0; i { const CPDInformation& cpd_; - DECLARE_FIELDS( FieldT, kb_, l_, lInit_ ) + DECLARE_FIELDS( FieldT, kb_, l_ ) const double mwl0_, rho_; C_RHS( const Expr::Tag& kbTag, const Expr::Tag& lTag, - const Expr::Tag& lInitTag, const CPDInformation& cpd ) : Expr::Expression(), cpd_ ( cpd ), @@ -54,13 +53,12 @@ namespace CPD{ this->set_gpu_runnable(true); kb_ = this->template create_field_request( kbTag ); l_ = this->template create_field_request( lTag ); - lInit_ = this->template create_field_request( lInitTag ); } public: class Builder : public Expr::ExpressionBuilder { - const Expr::Tag lTag_, lInitTag_, kbTag_; + const Expr::Tag lTag_, kbTag_; const CPDInformation& cpd_; public: /** @@ -69,23 +67,20 @@ namespace CPD{ * @param crhsTag production rate of C from CPD model * @param kbTag reaction constant from \f$l\f$ to \f$l^*\f$. * @param lTag mass of labile bridge per gas mass - * @param lInitTag initial mass of labile bridge per gas mass * @param cpd CPDInformation */ Builder( const Expr::Tag& crhsTag, const Expr::Tag& kbTag, const Expr::Tag& lTag, - const Expr::Tag& lInitTag, const CPDInformation& cpd ) : ExpressionBuilder(crhsTag), lTag_ ( lTag ), - lInitTag_( lInitTag ), kbTag_( kbTag ), cpd_( cpd ){} ~Builder(){} Expr::ExpressionBase* build() const{ - return new C_RHS( kbTag_, lTag_, lInitTag_, cpd_ ); + return new C_RHS( kbTag_, lTag_, cpd_ ); } }; @@ -94,37 +89,19 @@ namespace CPD{ FieldT& result = this->value(); const FieldT& kb = kb_->field_ref(); const FieldT& ell = l_ ->field_ref(); - const FieldT& lInit = lInit_ ->field_ref(); - SpatFldPtr weight = SpatialFieldStore::get( result ); - SpatFldPtr a = SpatialFieldStore::get( result ); - - *a <<= cond(lInit == 0.0, 1e-1) - ( lInit*1e3); - *weight <<= max(0, 1-exp(-(1/ *a)*ell)); - - result <<= *weight * ( kb * ell ) / (rho_ + 1.0) * (12.0 / mwl0_); + result <<= cond(ell<=0.0, 0.0) + (( kb * ell ) / (rho_ + 1.0) * (12.0 / mwl0_)); } void sensitivity( const Expr::Tag& var){ using namespace SpatialOps; FieldT& dfdv = this->sensitivity_result(var); const FieldT& kb = kb_->field_ref(); const FieldT& ell = l_ ->field_ref(); - const FieldT& lInit = lInit_ ->field_ref(); const FieldT& dkbdv = kb_->sens_field_ref(var); const FieldT& dldv = l_->sens_field_ref(var); - SpatFldPtr weight = SpatialFieldStore::get( dfdv ); - SpatFldPtr dweightdv = SpatialFieldStore::get( dfdv ); - SpatFldPtr a = SpatialFieldStore::get( dfdv ); - - *a <<= cond(lInit == 0.0, 1e-1) - ( lInit*1e3); - *weight <<= max(0, 1-exp(-(1/ *a)*ell)); - *dweightdv <<= cond( ell<=0.0, 0.0) - ( (1/ *a) * exp(-(1/ *a)*ell) * dldv); - - dfdv <<= (*weight * (dkbdv * ell + kb * dldv) + *dweightdv * ( kb * ell )) / (rho_ + 1.0) * (12.0 / mwl0_); // "ell" is in kg + dfdv <<= cond(ell<=0.0, 0.0)((dkbdv * ell + kb * dldv) / (rho_ + 1.0) * (12.0 / mwl0_)); // "ell" is in kg } }; diff --git a/src/particles/coal/Devolatilization/CPD/Deltai_RHS.h b/src/particles/coal/Devolatilization/CPD/Deltai_RHS.h index b3894c0..6e96c82 100755 --- a/src/particles/coal/Devolatilization/CPD/Deltai_RHS.h +++ b/src/particles/coal/Devolatilization/CPD/Deltai_RHS.h @@ -47,14 +47,12 @@ namespace CPD{ double fgi_, mwfg_; const TarAndSootInfo& tarSootInfo_; - DECLARE_FIELDS( FieldT, kb_, kgi_, deltai_, l_, deltaiInit_, lInit_ ) + DECLARE_FIELDS( FieldT, kb_, kgi_, deltai_, l_ ) Deltai_RHS( const Expr::Tag& kbTag, const Expr::Tag& kgiTag, const Expr::Tag& deltaiTag, - const Expr::Tag& deltaiInitTag, const Expr::Tag& lTag, - const Expr::Tag& lInitTag, const CPDInformation& cpd, const TarAndSootInfo& tarSootInfo, const int index) @@ -71,9 +69,7 @@ namespace CPD{ kb_ = this->template create_field_request( kbTag ); kgi_ = this->template create_field_request( kgiTag ); deltai_ = this->template create_field_request( deltaiTag ); - deltaiInit_ = this->template create_field_request( deltaiInitTag ); l_ = this->template create_field_request( lTag ); - lInit_ = this->template create_field_request( lInitTag ); if( index_ == cpd_.get_fgi().size()){ fgi_ = tarFrac0_; @@ -88,7 +84,7 @@ namespace CPD{ public: class Builder : public Expr::ExpressionBuilder { - const Expr::Tag kbTag_, kgiTag_, deltaiTag_, lTag_, deltaiInitTag_, lInitTag_; + const Expr::Tag kbTag_, kgiTag_, deltaiTag_, lTag_; const CPDInformation& cpd_; const TarAndSootInfo& tarSootInfo_; const int index_; @@ -99,9 +95,7 @@ namespace CPD{ * @param kbTag reaction constant of labile bridge * @param kgiTag reaction constant from \f$\delta_i\f$ to \f$g_i\f$. * @param deltaiTag amount of side chain i - * @param deltaiInitTag initial amount of side chain i * @param lTag labile bridge - * @param lInitTag initial labile bridge * @param cpd CPDInformation * @param tarSootInfo TarAndSootInfo * @param index index of species in g_i list @@ -110,9 +104,7 @@ namespace CPD{ const Expr::Tag& kbTag, const Expr::Tag& kgiTag, const Expr::Tag& deltaiTag, - const Expr::Tag& deltaiInitTag, const Expr::Tag& lTag, - const Expr::Tag& lInitTag, const CPDInformation& cpd, const TarAndSootInfo& tarSootInfo, const int index ) @@ -120,16 +112,14 @@ namespace CPD{ kbTag_ ( kbTag ), kgiTag_ ( kgiTag ), deltaiTag_ ( deltaiTag ), - deltaiInitTag_ ( deltaiInitTag ), lTag_ ( lTag ), - lInitTag_ ( lInitTag ), cpd_ ( cpd ), tarSootInfo_ ( tarSootInfo ), index_ ( index ){} ~Builder(){} Expr::ExpressionBase* build() const{ - return new Deltai_RHS( kbTag_ ,kgiTag_, deltaiTag_, deltaiInitTag_, lTag_, lInitTag_, cpd_, tarSootInfo_, index_ ); + return new Deltai_RHS( kbTag_ ,kgiTag_, deltaiTag_, lTag_, cpd_, tarSootInfo_, index_ ); } }; @@ -140,24 +130,12 @@ namespace CPD{ const FieldT& kb = kb_ ->field_ref(); const FieldT& kgi = kgi_ ->field_ref(); const FieldT& deltai = deltai_ ->field_ref(); - const FieldT& deltaiInit = deltaiInit_->field_ref(); const FieldT& ell = l_ ->field_ref(); - const FieldT& lInit = lInit_ ->field_ref(); - SpatFldPtr weightl = SpatialFieldStore::get( result ); - SpatFldPtr al = SpatialFieldStore::get( result ); - SpatFldPtr weightDelta = SpatialFieldStore::get( result ); - SpatFldPtr aDelta = SpatialFieldStore::get( result ); - - *al <<= cond(lInit == 0.0, 1e-1) - ( lInit*1e3); - *weightl <<= max(0, 1-exp(-(1/ *al)*ell)); - *aDelta <<= cond(deltaiInit == 0.0, 1e-1) - ( deltaiInit*1e3); - *weightDelta <<= max(0, 1-exp(-(1/ *aDelta)*deltai)); - - result <<= cond(fgi_ == 0.0, 0.0) - ( *weightl * rho_ * kb * ell / (rho_ + 1.0) * fgi_ / sumfg_ - *weightDelta * kgi * deltai); + result <<= cond(fgi_ == 0.0 or (ell<=0.0 and deltai<=0.0), 0.0) + (ell<=0.0 and deltai>0.0, - kgi * deltai) + (ell>0.0 and deltai<=0.0, rho_ * kb * ell / (rho_ + 1.0) * fgi_ / sumfg_) + ( rho_ * kb * ell / (rho_ + 1.0) * fgi_ / sumfg_ - kgi * deltai); } void sensitivity( const Expr::Tag& var){ @@ -167,34 +145,16 @@ namespace CPD{ const FieldT& kb = kb_->field_ref(); const FieldT& kgi = kgi_->field_ref(); const FieldT& deltai = deltai_->field_ref(); - const FieldT& deltaiInit = deltaiInit_->field_ref(); const FieldT& ell = l_->field_ref(); - const FieldT& lInit = lInit_->field_ref(); const FieldT& dkbdv = kb_->sens_field_ref( var ); const FieldT& dkgidv = kgi_->sens_field_ref( var ); const FieldT& ddeltaidv = deltai_->sens_field_ref( var ); const FieldT& dldv = l_->sens_field_ref( var ); - SpatFldPtr weightl = SpatialFieldStore::get( dfdv ); - SpatFldPtr dweightldv = SpatialFieldStore::get( dfdv ); - SpatFldPtr al = SpatialFieldStore::get( dfdv ); - SpatFldPtr weightDelta = SpatialFieldStore::get( dfdv ); - SpatFldPtr dweightDeltadv = SpatialFieldStore::get( dfdv ); - SpatFldPtr aDelta = SpatialFieldStore::get( dfdv ); - - *al <<= cond(lInit == 0.0, 1e-1) - ( lInit*1e3); - *weightl <<= max(0, 1-exp(-(1/ *al)*ell)); - *dweightldv <<= cond( ell<=0.0, 0.0) - ( (1/ *al) * exp(-(1/ *al)*ell) * dldv); - *aDelta <<= cond(deltaiInit == 0.0, 1e-1) - ( deltaiInit*1e3); - *weightDelta <<= max(0, 1-exp(-(1/ *aDelta)*deltai)); - *dweightDeltadv <<= cond( deltai<=0.0, 0.0) - ( (1/ *aDelta) * exp(-(1/ *aDelta)*deltai) * ddeltaidv); - dfdv <<= cond(fgi_ == 0.0, 0.0) - ( (*dweightldv * kb * ell + *weightl*(dkbdv * ell + kb*dldv)) * rho_ / (rho_ + 1.0) * fgi_ / sumfg_ - - *dweightDeltadv * kgi * deltai - *weightDelta * (dkgidv * deltai+kgi*ddeltaidv)); + dfdv <<= cond(fgi_ == 0.0 or (ell<=0.0 and deltai<=0.0), 0.0) + (ell<=0.0 and deltai>0.0, - (dkgidv * deltai+kgi*ddeltaidv)) + (ell>0.0 and deltai<=0.0, rho_ *(dkbdv * ell + kb*dldv) / (rho_ + 1.0) * fgi_ / sumfg_) + ( rho_ *(dkbdv * ell + kb*dldv) / (rho_ + 1.0) * fgi_ / sumfg_ - (dkgidv * deltai+kgi*ddeltaidv)); } }; //-------------------------------------------------------------------- diff --git a/src/particles/coal/Devolatilization/CPD/E_fun.h b/src/particles/coal/Devolatilization/CPD/E_fun.h index 12babe8..bd4e8ab 100755 --- a/src/particles/coal/Devolatilization/CPD/E_fun.h +++ b/src/particles/coal/Devolatilization/CPD/E_fun.h @@ -73,7 +73,7 @@ namespace CPD{ using namespace SpatialOps; const double gascon = 1.985; const double Eb0 = 55.43E3; - this->value() <<= Eb0/gascon + sqrt(2) * sigma_ * inv_erf( 1.0 - 2.0 * max( min( fEb_->field_ref(), 0.999 ), 1.0e-3 ) ); + this->value() <<= Eb0/gascon - sqrt(2) * sigma_ * inv_erf( 1.0 - 2.0 * max( min( fEb_->field_ref(), 0.999 ), 1.0e-3 ) ); } void sensitivity( const Expr::Tag& var){ @@ -82,7 +82,7 @@ namespace CPD{ const FieldT& fEb = fEb_->field_ref(); const FieldT& dfEbdv = fEb_->sens_field_ref( var ); - dfdv <<= cond( fEb > 1.0e-3 && fEb < 0.999, sqrt(M_PI/2) * sigma_ * exp(square(inv_erf(1.0 - 2.0 * fEb))) * dfEbdv) + dfdv <<= cond( fEb > 1.0e-3 && fEb < 0.999, sqrt(M_PI*2) * sigma_ * exp(square(inv_erf(1.0 - 2.0 * fEb))) * dfEbdv) (0.0); } }; @@ -165,7 +165,7 @@ namespace CPD{ const FieldT& fEgi = fEgi_->field_ref(); const FieldT& dfEgidv = fEgi_->sens_field_ref( var ); - dfdv <<= cond( fEgi > 1.0e-3 && fEgi < 0.999, sqrt(M_PI/2) * sigma_[index_] * exp(square(inv_erf(1.0 - 2.0 * fEgi))) * dfEgidv) + dfdv <<= cond( fEgi > 1.0e-3 && fEgi < 0.999, sqrt(M_PI*2) * sigma_[index_] * exp(square(inv_erf(1.0 - 2.0 * fEgi))) * dfEgidv) (0.0); } diff --git a/src/particles/coal/Devolatilization/CPD/Gi_RHS.h b/src/particles/coal/Devolatilization/CPD/Gi_RHS.h index c768b30..5352002 100755 --- a/src/particles/coal/Devolatilization/CPD/Gi_RHS.h +++ b/src/particles/coal/Devolatilization/CPD/Gi_RHS.h @@ -49,7 +49,7 @@ namespace CPD{ template class Gi_RHS: public Expr::Expression { - DECLARE_FIELDS( FieldT, kb_, kgi_, deltai_, deltaiInit_, l_, linit_ ) + DECLARE_FIELDS( FieldT, kb_, kgi_, deltai_, l_ ) const CPDInformation& cpd_; const TarAndSootInfo& tarSootInfo_; const int index_; @@ -59,9 +59,7 @@ namespace CPD{ Gi_RHS( const Expr::Tag& kbTag, const Expr::Tag& kgiTag, const Expr::Tag& deltaiTag, - const Expr::Tag& deltaiInitTag, const Expr::Tag& lTag, - const Expr::Tag& linitTag, const CPDInformation& cpd, const TarAndSootInfo& tarSootInfo, const int index) @@ -77,9 +75,7 @@ namespace CPD{ kb_ = this->template create_field_request( kbTag ); kgi_ = this->template create_field_request( kgiTag ); deltai_ = this->template create_field_request( deltaiTag ); - deltaiInit_ = this->template create_field_request( deltaiInitTag ); l_ = this->template create_field_request( lTag ); - linit_ = this->template create_field_request( linitTag ); if( index_ == cpd_.get_fgi().size()){ fgi_ = cpd_.get_tarMassFrac(); @@ -94,7 +90,7 @@ namespace CPD{ public: class Builder : public Expr::ExpressionBuilder { - const Expr::Tag kbTag_, kgiTag_, deltaiTag_, deltaiInitTag_, lTag_, linitTag_; + const Expr::Tag kbTag_, kgiTag_, deltaiTag_, lTag_; const CPDInformation& cpd_; const TarAndSootInfo& tarSootInfo_; const int index_; @@ -106,7 +102,6 @@ namespace CPD{ * \param kbTag : reaction constant of labile bridge (FieldT) * \param kgiTag : reaction constat of gas (vecotr of FieldT) * \param deltaiTag : mass of delta_i per gas mass - * \param deltaiInitTag: initial mass of delta_i per gas mass * \param lTag : mass of laible bridges per gas mass * \param cpd : the CPDInformation object. This must have a lifetime at least as long as this expression. * \param tarSootInfo : TarAndSootInfo @@ -116,9 +111,7 @@ namespace CPD{ const Expr::Tag& kbTag, const Expr::Tag& kgiTag, const Expr::Tag& deltaiTag, - const Expr::Tag& deltaiInitTag, const Expr::Tag& lTag, - const Expr::Tag& linitTag, const CPDInformation& cpd, const TarAndSootInfo& tarSootInfo, const int index) @@ -126,15 +119,13 @@ namespace CPD{ kbTag_ ( kbTag ), kgiTag_ ( kgiTag ), deltaiTag_ ( deltaiTag ), - deltaiInitTag_ ( deltaiInitTag), lTag_ ( lTag ), - linitTag_ ( linitTag ), cpd_ ( cpd ), tarSootInfo_ ( tarSootInfo ), index_ (index ){} ~Builder(){} Expr::ExpressionBase* build() const{ - return new Gi_RHS( kbTag_ ,kgiTag_, deltaiTag_, deltaiInitTag_, lTag_, linitTag_, cpd_, tarSootInfo_, index_ ); + return new Gi_RHS( kbTag_ ,kgiTag_, deltaiTag_, lTag_, cpd_, tarSootInfo_, index_ ); } }; @@ -145,24 +136,12 @@ namespace CPD{ const FieldT& kb = kb_->field_ref(); const FieldT& kgi = kgi_->field_ref(); const FieldT& deltai = deltai_->field_ref(); - const FieldT& deltaiInit = deltaiInit_->field_ref(); const FieldT& ell = l_ ->field_ref(); - const FieldT& lInit = linit_ ->field_ref(); - SpatFldPtr weightl = SpatialFieldStore::get( result ); - SpatFldPtr al = SpatialFieldStore::get( result ); - SpatFldPtr weightDelta = SpatialFieldStore::get( result ); - SpatFldPtr aDelta = SpatialFieldStore::get( result ); - - *al <<= cond(lInit == 0.0, 1e-1) - ( lInit*1e3); - *weightl <<= max(0, 1-exp(-(1/ *al)*ell)); - *aDelta <<= cond(deltaiInit == 0.0, 1e-1) - ( deltaiInit*1e3); - *weightDelta <<= max(0, 1-exp(-(1/ *aDelta)*deltai)); - - result <<= cond(fgi_ == 0.0, 0.0) - ( *weightl * kb * ell / (rho_ + 1.0) * (1-12.0/mwl0_) * fgi_ / sumfg_ + *weightDelta * kgi * deltai); + result <<= cond(fgi_ == 0.0 or (ell<=0.0 and deltai<=0.0), 0.0) + (ell<=0.0 and deltai>0.0, kgi * deltai) + (ell>0.0 and deltai<=0.0, kb * ell / (rho_ + 1.0) * (1-12.0/mwl0_) * fgi_ / sumfg_) + ( kb * ell / (rho_ + 1.0) * (1-12.0/mwl0_) * fgi_ / sumfg_+ kgi * deltai); } void sensitivity( const Expr::Tag& var){ using namespace SpatialOps; @@ -171,34 +150,16 @@ namespace CPD{ const FieldT& kb = kb_->field_ref(); const FieldT& kgi = kgi_->field_ref(); const FieldT& deltai = deltai_->field_ref(); - const FieldT& deltaiInit= deltaiInit_->field_ref(); const FieldT& ell = l_ ->field_ref(); - const FieldT& lInit = linit_->field_ref(); const FieldT& dkbdv = kb_->sens_field_ref( var ); const FieldT& dkgidv = kgi_->sens_field_ref( var ); const FieldT& ddeltaidv = deltai_->sens_field_ref( var ); const FieldT& dldv = l_ ->sens_field_ref( var ); - SpatFldPtr weightl = SpatialFieldStore::get( dfdv ); - SpatFldPtr dweightldv = SpatialFieldStore::get( dfdv ); - SpatFldPtr al = SpatialFieldStore::get( dfdv ); - SpatFldPtr weightDelta = SpatialFieldStore::get( dfdv ); - SpatFldPtr dweightDeltadv = SpatialFieldStore::get( dfdv ); - SpatFldPtr aDelta = SpatialFieldStore::get( dfdv ); - - *al <<= cond(lInit == 0.0, 1e-1) - ( lInit*1e3); - *weightl <<= max(0, 1-exp(-(1/ *al)*ell)); - *dweightldv <<= cond( ell<=0.0, 0.0) - ( (1/ *al) * exp(-(1/ *al)*ell) * dldv); - *aDelta <<= cond(deltaiInit == 0.0, 1e-1) - ( deltaiInit*1e3); - *weightDelta <<= max(0, 1-exp(-(1/ *aDelta)*deltai)); - *dweightDeltadv <<= cond( deltai<=0.0, 0.0) - ( (1/ *aDelta) * exp(-(1/ *aDelta)*deltai) * ddeltaidv); - dfdv <<= cond(fgi_ == 0.0, 0.0) - ( (*dweightldv * kb * ell + *weightl*(dkbdv * ell + kb*dldv)) / (rho_ + 1.0) * (1-12.0/mwl0_) * fgi_ / sumfg_ - + *dweightDeltadv * kgi * deltai + *weightDelta * (dkgidv * deltai+kgi*ddeltaidv)); + dfdv <<= cond(fgi_ == 0.0 or (ell<=0.0 and deltai<=0.0), 0.0) + (ell<=0.0 and deltai>0.0, (dkgidv * deltai+kgi*ddeltaidv)) + (ell>0.0 and deltai<=0.0, (dkbdv * ell + kb*dldv) / (rho_ + 1.0) * (1-12.0/mwl0_) * fgi_ / sumfg_) + ( (dkbdv * ell + kb*dldv) / (rho_ + 1.0) * (1-12.0/mwl0_) * fgi_ / sumfg_+ (dkgidv * deltai+kgi*ddeltaidv)); } }; diff --git a/src/particles/coal/Devolatilization/CPD/L_RHS.h b/src/particles/coal/Devolatilization/CPD/L_RHS.h index 4238826..c29603d 100755 --- a/src/particles/coal/Devolatilization/CPD/L_RHS.h +++ b/src/particles/coal/Devolatilization/CPD/L_RHS.h @@ -24,23 +24,21 @@ namespace CPD{ class L_RHS : public Expr::Expression { - DECLARE_FIELDS( FieldT, kb_, l_, lInit_ ) + DECLARE_FIELDS( FieldT, kb_, l_ ) L_RHS( const Expr::Tag& kbTag, - const Expr::Tag& lTag, - const Expr::Tag& lInitTag) + const Expr::Tag& lTag) : Expr::Expression() { this->set_gpu_runnable(true); kb_ = this->template create_field_request( kbTag ); l_ = this->template create_field_request( lTag ); - lInit_ = this->template create_field_request( lInitTag ); } public: class Builder : public Expr::ExpressionBuilder { - const Expr::Tag kbTag_, lTag_, lInitTag_; + const Expr::Tag kbTag_, lTag_; public: /** * @brief The mechanism for building a L_RHS object @@ -48,20 +46,17 @@ namespace CPD{ * @param rhsTag reaction rate of labile bridge * @param kbTag reaction constant of labile bridge * @param lTag mass of labile bridge per gas mass - * @param lInitTag initial mass of labile bridge per gas mass */ Builder( const Expr::Tag& rhsTag, const Expr::Tag& kbTag, - const Expr::Tag& lTag, - const Expr::Tag& lInitTag) + const Expr::Tag& lTag) : ExpressionBuilder(rhsTag), kbTag_( kbTag ), - lTag_ ( lTag ), - lInitTag_( lInitTag ){} + lTag_ ( lTag ){} ~Builder(){} Expr::ExpressionBase* build() const{ - return new L_RHS( kbTag_, lTag_, lInitTag_ ); + return new L_RHS( kbTag_, lTag_ ); } }; @@ -71,34 +66,18 @@ namespace CPD{ FieldT& result = this->value(); const FieldT& kb = kb_->field_ref(); const FieldT& ell= l_ ->field_ref(); - const FieldT& lInit = lInit_->field_ref(); - SpatFldPtr weight = SpatialFieldStore::get( result ); - SpatFldPtr a = SpatialFieldStore::get( result ); - *a <<= cond(lInit == 0.0, 1e-1) - ( lInit*1e3); - *weight <<= max(0, 1-exp(-(1/ *a)*ell)); - result <<= - *weight * kb* ell; //negative + result <<= cond(ell<=0.0,0.0)( -kb* ell); //negative } void sensitivity( const Expr::Tag& var){ using namespace SpatialOps; FieldT& dfdv = this->sensitivity_result(var); const FieldT& kb = kb_->field_ref(); const FieldT& ell = l_ ->field_ref(); - const FieldT& lInit = lInit_->field_ref(); const FieldT& dkbdv = kb_->sens_field_ref(var); const FieldT& dldv = l_ ->sens_field_ref(var); - SpatFldPtr weight = SpatialFieldStore::get( dfdv ); - SpatFldPtr dweightdv = SpatialFieldStore::get( dfdv ); - SpatFldPtr a = SpatialFieldStore::get( dfdv ); - *a <<= cond(lInit == 0.0, 1e-1) - ( lInit*1e3); - *weight <<= max(0, 1-exp(-(1/ *a)*ell)); - *dweightdv <<= cond( ell<=0.0, 0.0) - ( (1/ *a) * exp(-(1/ *a)*ell) * dldv); - - dfdv <<= - *weight * (dkbdv * ell + kb * dldv) - *dweightdv * kb* ell; + dfdv <<= cond(ell<=0.0,0.0)(-(dkbdv * ell + kb * dldv)); } }; diff --git a/src/particles/coal/TarSootReaction/SootFormationRate.h b/src/particles/coal/TarSootReaction/SootFormationRate.h index 2cc20ce..1c946a4 100755 --- a/src/particles/coal/TarSootReaction/SootFormationRate.h +++ b/src/particles/coal/TarSootReaction/SootFormationRate.h @@ -65,10 +65,10 @@ namespace Tarsoot { A_( 5.02E+8 ), E_( 198.9E+3 ), gasCon_( 8.3144621 ), - tarMw_(tarSootInfo_.tar_mw()), - tarCarbon_(tarSootInfo_.tar_carbon()), - sootMw_(tarSootInfo_.soot_mw()), - sootCarbon_(tarSootInfo_.soot_carbon()) + tarMw_(tarSootInfo.tar_mw()), + tarCarbon_(tarSootInfo.tar_carbon()), + sootMw_(tarSootInfo.soot_mw()), + sootCarbon_(tarSootInfo.soot_carbon()) { massTar_ = this->template create_field_request( massTarTag ); temp_ = this->template create_field_request( tempTag ); diff --git a/src/particles/coal/TarSootReaction/SootOxidationRate.h b/src/particles/coal/TarSootReaction/SootOxidationRate.h index 7ae64a0..cf77b73 100644 --- a/src/particles/coal/TarSootReaction/SootOxidationRate.h +++ b/src/particles/coal/TarSootReaction/SootOxidationRate.h @@ -76,8 +76,8 @@ namespace Tarsoot { gasCon_ ( 8.3144621 ), sootDens_( 1950.0 ), O2Mw_ ( 32.0 ), - cMin_( tarSootInfo_.soot_cMin() ), - sootMW_( tarSootInfo_.soot_mw() ), + cMin_( tarSootInfo.soot_cMin() ), + sootMW_( tarSootInfo.soot_mw() ), na_( 6.02E+26 ) { yO2_ = this->template create_field_request( yO2Tag ); -- GitLab From 79851c486f8ad6bc590776ac3634252b3c035668 Mon Sep 17 00:00:00 2001 From: Hang Zhou Date: Thu, 23 Jul 2020 00:10:07 -0600 Subject: [PATCH 05/10] Adding functions for plug flow reactor, so plug flow reactor can be simulated. The reactor type can be given by `ReactorParameters: ReactorType: ` in the input file. Now, three types are supported: `PSRConstangVolume`, 'PSRConstantPressure` and 'PFR`. No default reactor type is set in the code, which must be given in the input file. --- demos/1D_transient/1Dtrans_input.yaml | 2 +- demos/2D_steady_state/2Dss_input.yaml | 2 +- demos/Coal/Particle.yaml | 5 +- demos/LiquidParticle/LiquidParticle.yaml | 8 +- demos/PFR/Coal/Coal_PFR.yaml | 59 + demos/PFR/Coal/methane-gri211.xml | 5377 +++++++++++++++++ demos/PFR/Gas/Gas_PFR.yaml | 36 + demos/PFR/Gas/h2-burke.xml | 708 +++ demos/ParticleHeatUp/ParticleHeatUp.yaml | 15 +- demos/diff_mechanisms/methane.yaml | 2 +- demos/diff_mechanisms/syngas.yaml | 2 +- rtests/inputs/steady_cp_ad_closed__1pt.yaml | 2 +- rtests/inputs/steady_cp_ad_open__1pt.yaml | 2 +- rtests/inputs/steady_cp_conv_open__1pt.yaml | 2 +- .../steady_cp_conv_open__Tsurroundvar.yaml | 2 +- .../steady_cp_conv_open__hConvecvar.yaml | 2 +- rtests/inputs/steady_cv_ad_closed__1pt.yaml | 2 +- .../inputs/steady_cv_ad_closed__Tpzvar.yaml | 2 +- rtests/inputs/steady_cv_ad_closed__Tvar.yaml | 2 +- rtests/inputs/steady_cv_ad_closed__pvar.yaml | 2 +- rtests/inputs/steady_cv_ad_closed__zvar.yaml | 2 +- rtests/inputs/steady_cv_ad_open__1pt.yaml | 2 +- rtests/inputs/steady_cv_ad_open__Tpzvar.yaml | 2 +- rtests/inputs/steady_cv_ad_open__Tvar.yaml | 2 +- rtests/inputs/steady_cv_ad_open__pvar.yaml | 2 +- rtests/inputs/steady_cv_ad_open__zvar.yaml | 2 +- rtests/inputs/steady_cv_conv_open__1pt.yaml | 2 +- .../inputs/steady_cv_conv_open__Tpzvar.yaml | 2 +- .../steady_cv_conv_open__Tsurroundvar.yaml | 2 +- rtests/inputs/steady_cv_conv_open__Tvar.yaml | 2 +- .../steady_cv_conv_open__hConvecvar.yaml | 2 +- rtests/inputs/steady_cv_conv_open__pvar.yaml | 2 +- rtests/inputs/steady_cv_conv_open__zvar.yaml | 2 +- .../inputs/transient_cp_ad_closed__1pt.yaml | 2 +- rtests/inputs/transient_cp_ad_open__1pt.yaml | 2 +- .../inputs/transient_cp_conv_open__1pt.yaml | 2 +- .../transient_cp_conv_open__Tsurroundvar.yaml | 2 +- .../transient_cp_conv_open__hConvecvar.yaml | 2 +- .../inputs/transient_cp_liquid_particle.yaml | 2 +- .../inputs/transient_cp_particle_heatup.yaml | 2 +- .../inputs/transient_cv_ad_closed__1pt.yaml | 2 +- .../transient_cv_ad_closed__Tpzvar.yaml | 2 +- .../inputs/transient_cv_ad_closed__Tvar.yaml | 2 +- .../inputs/transient_cv_ad_closed__pvar.yaml | 2 +- .../inputs/transient_cv_ad_closed__zvar.yaml | 2 +- rtests/inputs/transient_cv_ad_open__1pt.yaml | 2 +- .../inputs/transient_cv_ad_open__Tpzvar.yaml | 2 +- rtests/inputs/transient_cv_ad_open__Tvar.yaml | 2 +- rtests/inputs/transient_cv_ad_open__pvar.yaml | 2 +- rtests/inputs/transient_cv_ad_open__zvar.yaml | 2 +- .../inputs/transient_cv_conv_open__1pt.yaml | 2 +- .../transient_cv_conv_open__Tpzvar.yaml | 2 +- .../transient_cv_conv_open__Tsurroundvar.yaml | 2 +- .../inputs/transient_cv_conv_open__Tvar.yaml | 2 +- .../transient_cv_conv_open__hConvecvar.yaml | 2 +- .../inputs/transient_cv_conv_open__pvar.yaml | 2 +- .../inputs/transient_cv_conv_open__zvar.yaml | 2 +- .../inputs/transient_cv_liquid_particle.yaml | 2 +- .../inputs/transient_cv_particle_heatup.yaml | 2 +- src/CMakeLists.txt | 1 + src/ConvectiveHeatTransferRate.h | 118 +- src/Main.cpp | 157 +- src/PlugFlowReactor/CMakeLists.txt | 10 + src/PlugFlowReactor/DpDx.h | 205 + .../PFRTransformationMatrixExpressions.h | 126 + .../PlugFlowReactorInterface.cpp | 235 + .../PlugFlowReactorInterface.h | 64 + src/ReactorEnsembleUtil.cpp | 20 +- src/ReactorEnsembleUtil.h | 2 + src/TransformationMatrixExpressions.h | 5 + src/parser/ParseInputFile.cpp | 177 +- src/particles/ParticleInterface.cpp | 236 +- src/particles/ParticleInterface.h | 13 +- src/particles/ParticleTransformExpressions.h | 574 +- .../Vaporization/VaporizationInterface.cpp | 31 +- .../Vaporization/VaporizationInterface.h | 17 +- .../coal/CharCombustion/CharInterface.cpp | 64 +- .../coal/CharCombustion/CharInterface.h | 3 + .../Oxidation/CharOxidationInterface.cpp | 2 +- .../LH_Fractal/CharOxidationLH_Fractal.h | 2 +- src/particles/coal/CoalInterface.cpp | 185 +- src/particles/coal/CoalInterface.h | 2 +- .../Devolatilization/CPD/CPDInterface.cpp | 129 +- .../DevolatilizationInterface.cpp | 35 +- .../DevolatilizationInterface.h | 5 +- .../KobayashiSarofim/KobSarofimInterface.cpp | 68 +- .../coal/TarSootReaction/SootFormationRate.h | 8 +- .../coal/TarSootReaction/SootOxidationRate.h | 8 +- .../TarSootReaction/TarGasificationRate.h | 8 +- .../coal/TarSootReaction/TarOxidationRate.h | 8 +- .../TarSootReactionInterface.cpp | 131 +- .../TarSootReactionInterface.h | 7 + 92 files changed, 8361 insertions(+), 607 deletions(-) create mode 100644 demos/PFR/Coal/Coal_PFR.yaml create mode 100644 demos/PFR/Coal/methane-gri211.xml create mode 100644 demos/PFR/Gas/Gas_PFR.yaml create mode 100644 demos/PFR/Gas/h2-burke.xml create mode 100755 src/PlugFlowReactor/CMakeLists.txt create mode 100644 src/PlugFlowReactor/DpDx.h create mode 100644 src/PlugFlowReactor/PFRTransformationMatrixExpressions.h create mode 100644 src/PlugFlowReactor/PlugFlowReactorInterface.cpp create mode 100644 src/PlugFlowReactor/PlugFlowReactorInterface.h diff --git a/demos/1D_transient/1Dtrans_input.yaml b/demos/1D_transient/1Dtrans_input.yaml index 3a1192f..40a0dc1 100644 --- a/demos/1D_transient/1Dtrans_input.yaml +++ b/demos/1D_transient/1Dtrans_input.yaml @@ -39,4 +39,4 @@ TimeIntegrator: tolerance: 1e-8 Restart: True ReactorParameters: - ReactorType: ConstantVolume + ReactorType: PSRConstantVolume diff --git a/demos/2D_steady_state/2Dss_input.yaml b/demos/2D_steady_state/2Dss_input.yaml index 7e43634..99484ce 100644 --- a/demos/2D_steady_state/2Dss_input.yaml +++ b/demos/2D_steady_state/2Dss_input.yaml @@ -36,4 +36,4 @@ Output: - name: tau_mix Restart: False ReactorParameters: - ReactorType: ConstantVolume + ReactorType: PSRConstantVolume diff --git a/demos/Coal/Particle.yaml b/demos/Coal/Particle.yaml index 1929c4c..2dc454b 100644 --- a/demos/Coal/Particle.yaml +++ b/demos/Coal/Particle.yaml @@ -31,7 +31,7 @@ TimeIntegrator: timestep: 1e-4 tolerance: 1e-12 ReactorParameters: - ReactorType: ConstantPressure + ReactorType: PSRConstantPressure Radius: 0.1 Particles: ParticleType: Coal @@ -45,9 +45,8 @@ Particles: variable: T_part_init - value: 1200 variable: rho_part_init - NumberOfParticles: 1 Size: Distribution: Identity Value: 150e-6 FlowParameters: - KolmogorovScale: 1e-7 + ReynoldsNumber: 2e4 diff --git a/demos/LiquidParticle/LiquidParticle.yaml b/demos/LiquidParticle/LiquidParticle.yaml index 035e2ba..4e7ec77 100644 --- a/demos/LiquidParticle/LiquidParticle.yaml +++ b/demos/LiquidParticle/LiquidParticle.yaml @@ -38,7 +38,7 @@ TimeIntegrator: timestep: 1e-6 tolerance: 1e-8 ReactorParameters: - ReactorType: ConstantPressure + ReactorType: PSRConstantPressure Radius: 0.1 Particles: ParticleType: Liquid @@ -54,10 +54,10 @@ Particles: variable: T_part_inflow - value: 1000 variable: rho_part_inflow - NumberOfParticles: 1000 - NumberOfParticlesInflow: 500 + ParticleLoading: 1000 + ParticleLoadingInflow: 500 Size: Distribution: Identity Value: 1e-4 FlowParameters: - KolmogorovScale: 1e-7 + ReynoldsNumber: 2e4 diff --git a/demos/PFR/Coal/Coal_PFR.yaml b/demos/PFR/Coal/Coal_PFR.yaml new file mode 100644 index 0000000..463020e --- /dev/null +++ b/demos/PFR/Coal/Coal_PFR.yaml @@ -0,0 +1,59 @@ +ReactionInGas: True +Cantera: + GroupName: methane-gri211 + InputFile: methane-gri211.xml +InitialConditions: +- value: 1200 + variable: T +- value: 101325 + variable: p +- value: 0.21 + variable: X_O2 +- value: 0.79 + variable: X_N2 +- value: 0.5 + variable: u +Output: + dualtime_interval: 1 + time_interval: 1 +TimeIntegrator: + dsInitial: 1e-8 + GESAT_Max: 1e1 + GESAT_Ramp: 1.1 + GESAT_Safety: 0.1 + end_time: 0.15 + timestep: 1e-6 + tolerance: 1e-5 +ReactorParameters: + ReactorType: PFR + ReactorShape: Cylinder + Radius: 0.05 + Height: 0.15 +Particles: + ParticleType: Coal + FuelAirEquivalenceRatio: 1.0 + CoalType: IllinoisNo6 + VapModel: ON + DevModel: CPD + TarSootModel: ON + TarIsC2H2: True + SootIsCarbon: False + CharModel: + GasificationModel: FirstOrder + OxidationModel: LH + InitialConditions: + - value: 350 + variable: T_part_init + - value: 1200 + variable: rho_part_init + InflowConditions: + - value: 350 + variable: T_part_inflow + - value: 1200 + variable: rho_part_inflow + Size: + Distribution: Identity + Value: 5e-5 +FlowParameters: + ReynoldsNumber: 2e4 + diff --git a/demos/PFR/Coal/methane-gri211.xml b/demos/PFR/Coal/methane-gri211.xml new file mode 100644 index 0000000..afc9e28 --- /dev/null +++ b/demos/PFR/Coal/methane-gri211.xml @@ -0,0 +1,5377 @@ + + + + + + + O H C N Ar + + H2 H O O2 OH H2O HO2 H2O2 C CH + CH2 CH2(S) CH3 CH4 CO CO2 HCO CH2O CH2OH CH3O + CH3OH C2H C2H2 C2H3 C2H4 C2H5 C2H6 HCCO CH2CO HCCOH + N NH NH2 NH3 NNH NO NO2 N2O HNO CN + HCN H2CN HCNN HCNO HOCN HNCO NCO N2 AR + + + 300.0 + 101325.0 + + + + + + + + + + + + H:2 + TPIS78 + + + + 2.344331120E+00, 7.980520750E-03, -1.947815100E-05, 2.015720940E-08, + -7.376117610E-12, -9.179351730E+02, 6.830102380E-01 + + + + 3.337279200E+00, -4.940247310E-05, 4.994567780E-07, -1.795663940E-10, + 2.002553760E-14, -9.501589220E+02, -3.205023310E+00 + + + + linear + 38.000 + 2.920 + 0.000 + 0.790 + 280.000 + + + + + + H:1 + L 7/88 + + + + 2.500000000E+00, 7.053328190E-13, -1.995919640E-15, 2.300816320E-18, + -9.277323320E-22, 2.547365990E+04, -4.466828530E-01 + + + + 2.500000010E+00, -2.308429730E-11, 1.615619480E-14, -4.735152350E-18, + 4.981973570E-22, 2.547365990E+04, -4.466829140E-01 + + + + atom + 145.000 + 2.050 + 0.000 + 0.000 + 0.000 + + + + + + O:1 + L 1/90 + + + + 3.168267100E+00, -3.279318840E-03, 6.643063960E-06, -6.128066240E-09, + 2.112659710E-12, 2.912225920E+04, 2.051933460E+00 + + + + 2.569420780E+00, -8.597411370E-05, 4.194845890E-08, -1.001777990E-11, + 1.228336910E-15, 2.921757910E+04, 4.784338640E+00 + + + + atom + 80.000 + 2.750 + 0.000 + 0.000 + 0.000 + + + + + + O:2 + TPIS89 + + + + 3.782456360E+00, -2.996734160E-03, 9.847302010E-06, -9.681295090E-09, + 3.243728370E-12, -1.063943560E+03, 3.657675730E+00 + + + + 3.282537840E+00, 1.483087540E-03, -7.579666690E-07, 2.094705550E-10, + -2.167177940E-14, -1.088457720E+03, 5.453231290E+00 + + + + linear + 107.400 + 3.458 + 0.000 + 1.600 + 3.800 + + + + + + H:1 O:1 + RUS 78 + + + + 3.992015430E+00, -2.401317520E-03, 4.617938410E-06, -3.881133330E-09, + 1.364114700E-12, 3.615080560E+03, -1.039254580E-01 + + + + 3.092887670E+00, 5.484297160E-04, 1.265052280E-07, -8.794615560E-11, + 1.174123760E-14, 3.858657000E+03, 4.476696100E+00 + + + + linear + 80.000 + 2.750 + 0.000 + 0.000 + 0.000 + + + + + + H:2 O:1 + L 8/89 + + + + 4.198640560E+00, -2.036434100E-03, 6.520402110E-06, -5.487970620E-09, + 1.771978170E-12, -3.029372670E+04, -8.490322080E-01 + + + + 3.033992490E+00, 2.176918040E-03, -1.640725180E-07, -9.704198700E-11, + 1.682009920E-14, -3.000429710E+04, 4.966770100E+00 + + + + nonlinear + 572.400 + 2.605 + 1.844 + 0.000 + 4.000 + + + + + + H:1 O:2 + L 5/89 + + + + 4.301798010E+00, -4.749120510E-03, 2.115828910E-05, -2.427638940E-08, + 9.292251240E-12, 2.948080400E+02, 3.716662450E+00 + + + + 4.017210900E+00, 2.239820130E-03, -6.336581500E-07, 1.142463700E-10, + -1.079085350E-14, 1.118567130E+02, 3.785102150E+00 + + + + nonlinear + 107.400 + 3.458 + 0.000 + 0.000 + 1.000 + + + + + + H:2 O:2 + L 7/88 + + + + 4.276112690E+00, -5.428224170E-04, 1.673357010E-05, -2.157708130E-08, + 8.624543630E-12, -1.770258210E+04, 3.435050740E+00 + + + + 4.165002850E+00, 4.908316940E-03, -1.901392250E-06, 3.711859860E-10, + -2.879083050E-14, -1.786178770E+04, 2.916156620E+00 + + + + nonlinear + 107.400 + 3.458 + 0.000 + 0.000 + 3.800 + + + + + + C:1 + L11/88 + + + + 2.554239550E+00, -3.215377240E-04, 7.337922450E-07, -7.322348890E-10, + 2.665214460E-13, 8.544388320E+04, 4.531308480E+00 + + + + 2.492668880E+00, 4.798892840E-05, -7.243350200E-08, 3.742910290E-11, + -4.872778930E-15, 8.545129530E+04, 4.801503730E+00 + + + + atom + 71.400 + 3.298 + 0.000 + 0.000 + 0.000 + + + + + + H:1 C:1 + TPIS79 + + + + 3.489816650E+00, 3.238355410E-04, -1.688990650E-06, 3.162173270E-09, + -1.406090670E-12, 7.079729340E+04, 2.084011080E+00 + + + + 2.878464730E+00, 9.709136810E-04, 1.444456550E-07, -1.306878490E-10, + 1.760793830E-14, 7.101243640E+04, 5.484979990E+00 + + + + linear + 80.000 + 2.750 + 0.000 + 0.000 + 0.000 + + + + + + H:2 C:1 + L S/93 + + + + 3.762678670E+00, 9.688721430E-04, 2.794898410E-06, -3.850911530E-09, + 1.687417190E-12, 4.600404010E+04, 1.562531850E+00 + + + + 2.874101130E+00, 3.656392920E-03, -1.408945970E-06, 2.601795490E-10, + -1.877275670E-14, 4.626360400E+04, 6.171193240E+00 + + + + linear + 144.000 + 3.800 + 0.000 + 0.000 + 0.000 + + + + + + H:2 C:1 + L S/93 + + + + 4.198604110E+00, -2.366614190E-03, 8.232962200E-06, -6.688159810E-09, + 1.943147370E-12, 5.049681630E+04, -7.691189670E-01 + + + + 2.292038420E+00, 4.655886370E-03, -2.011919470E-06, 4.179060000E-10, + -3.397163650E-14, 5.092599970E+04, 8.626501690E+00 + + + + linear + 144.000 + 3.800 + 0.000 + 0.000 + 0.000 + + + + + + H:3 C:1 + L11/89 + + + + 3.673590400E+00, 2.010951750E-03, 5.730218560E-06, -6.871174250E-09, + 2.543857340E-12, 1.644499880E+04, 1.604564330E+00 + + + + 2.285717720E+00, 7.239900370E-03, -2.987143480E-06, 5.956846440E-10, + -4.671543940E-14, 1.677558430E+04, 8.480071790E+00 + + + + linear + 144.000 + 3.800 + 0.000 + 0.000 + 0.000 + + + + + + H:4 C:1 + L 8/88 + + + + 5.149876130E+00, -1.367097880E-02, 4.918005990E-05, -4.847430260E-08, + 1.666939560E-11, -1.024664760E+04, -4.641303760E+00 + + + + 7.485149500E-02, 1.339094670E-02, -5.732858090E-06, 1.222925350E-09, + -1.018152300E-13, -9.468344590E+03, 1.843731800E+01 + + + + nonlinear + 141.400 + 3.746 + 0.000 + 2.600 + 13.000 + + + + + + C:1 O:1 + TPIS79 + + + + 3.579533470E+00, -6.103536800E-04, 1.016814330E-06, 9.070058840E-10, + -9.044244990E-13, -1.434408600E+04, 3.508409280E+00 + + + + 2.715185610E+00, 2.062527430E-03, -9.988257710E-07, 2.300530080E-10, + -2.036477160E-14, -1.415187240E+04, 7.818687720E+00 + + + + linear + 98.100 + 3.650 + 0.000 + 1.950 + 1.800 + + + + + + C:1 O:2 + L 7/88 + + + + 2.356773520E+00, 8.984596770E-03, -7.123562690E-06, 2.459190220E-09, + -1.436995480E-13, -4.837196970E+04, 9.901052220E+00 + + + + 3.857460290E+00, 4.414370260E-03, -2.214814040E-06, 5.234901880E-10, + -4.720841640E-14, -4.875916600E+04, 2.271638060E+00 + + + + linear + 244.000 + 3.763 + 0.000 + 2.650 + 2.100 + + + + + + H:1 C:1 O:1 + L12/89 + + + + 4.221185840E+00, -3.243925320E-03, 1.377994460E-05, -1.331440930E-08, + 4.337688650E-12, 3.839564960E+03, 3.394372430E+00 + + + + 2.772174380E+00, 4.956955260E-03, -2.484456130E-06, 5.891617780E-10, + -5.335087110E-14, 4.011918150E+03, 9.798344920E+00 + + + + nonlinear + 498.000 + 3.590 + 0.000 + 0.000 + 0.000 + + + + + + H:2 C:1 O:1 + L 8/88 + + + + 4.793723150E+00, -9.908333690E-03, 3.732200080E-05, -3.792852610E-08, + 1.317726520E-11, -1.430895670E+04, 6.028129000E-01 + + + + 1.760690080E+00, 9.200000820E-03, -4.422588130E-06, 1.006412120E-09, + -8.838556400E-14, -1.399583230E+04, 1.365632300E+01 + + + + nonlinear + 498.000 + 3.590 + 0.000 + 0.000 + 2.000 + + + + + + H:3 C:1 O:1 + GUNL93 + + + + 3.863889180E+00, 5.596723040E-03, 5.932717910E-06, -1.045320120E-08, + 4.369672780E-12, -3.193913670E+03, 5.473022430E+00 + + + + 3.692665690E+00, 8.645767970E-03, -3.751011200E-06, 7.872346360E-10, + -6.485542010E-14, -3.242506270E+03, 5.810432150E+00 + + + + nonlinear + 417.000 + 3.690 + 1.700 + 0.000 + 2.000 + + + + + + H:3 C:1 O:1 + 121686 + + + + 2.106204000E+00, 7.216595000E-03, 5.338472000E-06, -7.377636000E-09, + 2.075610000E-12, 9.786011000E+02, 1.315217700E+01 + + + + 3.770799000E+00, 7.871497000E-03, -2.656384000E-06, 3.944431000E-10, + -2.112616000E-14, 1.278325200E+02, 2.929575000E+00 + + + + nonlinear + 417.000 + 3.690 + 1.700 + 0.000 + 2.000 + + + + + + H:4 C:1 O:1 + L 8/88 + + + + 5.715395820E+00, -1.523091290E-02, 6.524411550E-05, -7.108068890E-08, + 2.613526980E-11, -2.564276560E+04, -1.504098230E+00 + + + + 1.789707910E+00, 1.409382920E-02, -6.365008350E-06, 1.381710850E-09, + -1.170602200E-13, -2.537487470E+04, 1.450236230E+01 + + + + nonlinear + 481.800 + 3.626 + 0.000 + 0.000 + 1.000 + + + + + + H:1 C:2 + L 1/91 + + + + 2.889657330E+00, 1.340996110E-02, -2.847695010E-05, 2.947910450E-08, + -1.093315110E-11, 6.683939320E+04, 6.222964380E+00 + + + + 3.167806520E+00, 4.752219020E-03, -1.837870770E-06, 3.041902520E-10, + -1.772327700E-14, 6.712106500E+04, 6.635894750E+00 + + + + linear + 209.000 + 4.100 + 0.000 + 0.000 + 2.500 + + + + + + H:2 C:2 + L 1/91 + + + + 8.086810940E-01, 2.336156290E-02, -3.551718150E-05, 2.801524370E-08, + -8.500729740E-12, 2.642898070E+04, 1.393970510E+01 + + + + 4.147569640E+00, 5.961666640E-03, -2.372948520E-06, 4.674121710E-10, + -3.612352130E-14, 2.593599920E+04, -1.230281210E+00 + + + + linear + 209.000 + 4.100 + 0.000 + 0.000 + 2.500 + + + + + + H:3 C:2 + L 2/92 + + + + 3.212466450E+00, 1.514791620E-03, 2.592094120E-05, -3.576578470E-08, + 1.471508730E-11, 3.485984680E+04, 8.510540250E+00 + + + + 3.016724000E+00, 1.033022920E-02, -4.680823490E-06, 1.017632880E-09, + -8.626070410E-14, 3.461287390E+04, 7.787323780E+00 + + + + nonlinear + 209.000 + 4.100 + 0.000 + 0.000 + 1.000 + + + + + + H:4 C:2 + L 1/91 + + + + 3.959201480E+00, -7.570522470E-03, 5.709902920E-05, -6.915887530E-08, + 2.698843730E-11, 5.089775930E+03, 4.097330960E+00 + + + + 2.036111160E+00, 1.464541510E-02, -6.710779150E-06, 1.472229230E-09, + -1.257060610E-13, 4.939886140E+03, 1.030536930E+01 + + + + nonlinear + 280.800 + 3.971 + 0.000 + 0.000 + 1.500 + + + + + + H:5 C:2 + L12/92 + + + + 4.306465680E+00, -4.186588920E-03, 4.971428070E-05, -5.991266060E-08, + 2.305090040E-11, 1.284162650E+04, 4.707209240E+00 + + + + 1.954656420E+00, 1.739727220E-02, -7.982066680E-06, 1.752176890E-09, + -1.496415760E-13, 1.285752000E+04, 1.346243430E+01 + + + + nonlinear + 252.300 + 4.302 + 0.000 + 0.000 + 1.500 + + + + + + H:6 C:2 + L 8/88 + + + + 4.291424920E+00, -5.501542700E-03, 5.994382880E-05, -7.084662850E-08, + 2.686857710E-11, -1.152220550E+04, 2.666823160E+00 + + + + 1.071881500E+00, 2.168526770E-02, -1.002560670E-05, 2.214120010E-09, + -1.900028900E-13, -1.142639320E+04, 1.511561070E+01 + + + + nonlinear + 252.300 + 4.302 + 0.000 + 0.000 + 1.500 + + + + + + H:1 C:2 O:1 + SRIC91 + + + + 2.251721400E+00, 1.765502100E-02, -2.372910100E-05, 1.727575900E-08, + -5.066481100E-12, 2.005944900E+04, 1.249041700E+01 + + + + 5.628205800E+00, 4.085340100E-03, -1.593454700E-06, 2.862605200E-10, + -1.940783200E-14, 1.932721500E+04, -3.930259500E+00 + + + + nonlinear + 150.000 + 2.500 + 0.000 + 0.000 + 1.000 + + + + + + H:2 C:2 O:1 + L 5/90 + + + + 2.135836300E+00, 1.811887210E-02, -1.739474740E-05, 9.343975680E-09, + -2.014576150E-12, -7.042918040E+03, 1.221564800E+01 + + + + 4.511297320E+00, 9.003597450E-03, -4.169396350E-06, 9.233458820E-10, + -7.948382010E-14, -7.551053110E+03, 6.322472050E-01 + + + + nonlinear + 436.000 + 3.970 + 0.000 + 0.000 + 2.000 + + + + + + H:2 C:2 O:1 + SRI91 + + + + 1.242373300E+00, 3.107220100E-02, -5.086686400E-05, 4.313713100E-08, + -1.401459400E-11, 8.031614300E+03, 1.387431900E+01 + + + + 5.923829100E+00, 6.792360000E-03, -2.565856400E-06, 4.498784100E-10, + -2.994010100E-14, 7.264626000E+03, -7.601774200E+00 + + + + nonlinear + 436.000 + 3.970 + 0.000 + 0.000 + 2.000 + + + + + + N:1 + L 6/88 + + + + 2.500000000E+00, 0.000000000E+00, 0.000000000E+00, 0.000000000E+00, + 0.000000000E+00, 5.610463700E+04, 4.193908700E+00 + + + + 2.415942900E+00, 1.748906500E-04, -1.190236900E-07, 3.022624500E-11, + -2.036098200E-15, 5.613377300E+04, 4.649609600E+00 + + + + atom + 71.400 + 3.298 + 0.000 + 0.000 + 0.000 + + + + + + H:1 N:1 + And94 + + + + 3.492908500E+00, 3.117919800E-04, -1.489048400E-06, 2.481644200E-09, + -1.035696700E-12, 4.188062900E+04, 1.848327800E+00 + + + + 2.783692800E+00, 1.329843000E-03, -4.247804700E-07, 7.834850100E-11, + -5.504447000E-15, 4.212084800E+04, 5.740779900E+00 + + + + linear + 80.000 + 2.650 + 0.000 + 0.000 + 4.000 + + + + + + H:2 N:1 + And89 + + + + 4.204002900E+00, -2.106138500E-03, 7.106834800E-06, -5.611519700E-09, + 1.644071700E-12, 2.188591000E+04, -1.418424800E-01 + + + + 2.834742100E+00, 3.207308200E-03, -9.339080400E-07, 1.370295300E-10, + -7.920614400E-15, 2.217195700E+04, 6.520416300E+00 + + + + nonlinear + 80.000 + 2.650 + 0.000 + 2.260 + 4.000 + + + + + + H:3 N:1 + J 6/77 + + + + 4.286027400E+00, -4.660523000E-03, 2.171851300E-05, -2.280888700E-08, + 8.263804600E-12, -6.741728500E+03, -6.253727700E-01 + + + + 2.634452100E+00, 5.666256000E-03, -1.727867600E-06, 2.386716100E-10, + -1.257878600E-14, -6.544695800E+03, 6.566292800E+00 + + + + nonlinear + 481.000 + 2.920 + 1.470 + 0.000 + 10.000 + + + + + + H:1 N:2 + T07/93 + + + + 4.344692700E+00, -4.849707200E-03, 2.005945900E-05, -2.172646400E-08, + 7.946953900E-12, 2.879197300E+04, 2.977941000E+00 + + + + 3.766754400E+00, 2.891508200E-03, -1.041662000E-06, 1.684259400E-10, + -1.009189600E-14, 2.865069700E+04, 4.470506700E+00 + + + + nonlinear + 71.400 + 3.798 + 0.000 + 0.000 + 1.000 + + + + + + O:1 N:1 + RUS 78 + + + + 4.218476300E+00, -4.638976000E-03, 1.104102200E-05, -9.336135400E-09, + 2.803577000E-12, 9.844623000E+03, 2.280846400E+00 + + + + 3.260605600E+00, 1.191104300E-03, -4.291704800E-07, 6.945766900E-11, + -4.033609900E-15, 9.920974600E+03, 6.369302700E+00 + + + + linear + 97.530 + 3.621 + 0.000 + 1.760 + 4.000 + + + + + + O:2 N:1 + L 7/88 + + + + 3.944031200E+00, -1.585429000E-03, 1.665781200E-05, -2.047542600E-08, + 7.835056400E-12, 2.896617900E+03, 6.311991700E+00 + + + + 4.884754200E+00, 2.172395600E-03, -8.280690600E-07, 1.574751000E-10, + -1.051089500E-14, 2.316498300E+03, -1.174169500E-01 + + + + nonlinear + 200.000 + 3.500 + 0.000 + 0.000 + 1.000 + + + + + + O:1 N:2 + L 7/88 + + + + 2.257150200E+00, 1.130472800E-02, -1.367131900E-05, 9.681980600E-09, + -2.930718200E-12, 8.741774400E+03, 1.075799200E+01 + + + + 4.823072900E+00, 2.627025100E-03, -9.585087400E-07, 1.600071200E-10, + -9.775230300E-15, 8.073404800E+03, -2.201720700E+00 + + + + linear + 232.400 + 3.828 + 0.000 + 0.000 + 1.000 + + + + + + H:1 O:1 N:1 + And93 + + + + 4.533491600E+00, -5.669617100E-03, 1.847320700E-05, -1.713709400E-08, + 5.545457300E-12, 1.154829700E+04, 1.749841700E+00 + + + + 2.979250900E+00, 3.494405900E-03, -7.854977800E-07, 5.747959400E-11, + -1.933591600E-16, 1.175058200E+04, 8.606372800E+00 + + + + nonlinear + 116.700 + 3.492 + 0.000 + 0.000 + 1.000 + + + + + + C:1 N:1 + HBH92 + + + + 3.612935100E+00, -9.555132700E-04, 2.144297700E-06, -3.151632300E-10, + -4.643035600E-13, 5.170834000E+04, 3.980499500E+00 + + + + 3.745980500E+00, 4.345077500E-05, 2.970598400E-07, -6.865180600E-11, + 4.413417300E-15, 5.153618800E+04, 2.786760100E+00 + + + + linear + 75.000 + 3.856 + 0.000 + 0.000 + 1.000 + + + + + + H:1 C:1 N:1 + L 7/88 + + + + 2.258988600E+00, 1.005117000E-02, -1.335176300E-05, 1.009234900E-08, + -3.008902800E-12, 1.521585300E+04, 8.916441900E+00 + + + + 3.802239200E+00, 3.146422800E-03, -1.063218500E-06, 1.661975700E-10, + -9.799757000E-15, 1.491051200E+04, 1.575460100E+00 + + + + linear + 569.000 + 3.630 + 0.000 + 0.000 + 1.000 + + + + + + H:2 C:1 N:1 + 41687 + + + + 2.851661000E+00, 5.695233100E-03, 1.071140000E-06, -1.622612000E-09, + -2.351108100E-13, 2.863782000E+04, 8.992751100E+00 + + + + 5.209703000E+00, 2.969291100E-03, -2.855589100E-07, -1.635550000E-10, + 3.043258900E-14, 2.767710900E+04, -4.444478000E+00 + + + + linear + 569.000 + 3.630 + 0.000 + 0.000 + 1.000 + + + + + + H:1 C:1 N:2 + SRI/94 + + + + 2.524319400E+00, 1.596061900E-02, -1.881635400E-05, 1.212554000E-08, + -3.235737800E-12, 5.426198400E+04, 1.167587000E+01 + + + + 5.894636200E+00, 3.989595900E-03, -1.598238000E-06, 2.924939500E-10, + -2.009468600E-14, 5.345294100E+04, -5.103050200E+00 + + + + nonlinear + 150.000 + 2.500 + 0.000 + 0.000 + 1.000 + + + + + + H:1 C:1 O:1 N:1 + BDEA94 + + + + 2.647279890E+00, 1.275053420E-02, -1.047942360E-05, 4.414328360E-09, + -7.575214660E-13, 1.929902520E+04, 1.073329720E+01 + + + + 6.598604560E+00, 3.027786260E-03, -1.077043460E-06, 1.716665280E-10, + -1.014393910E-14, 1.796613390E+04, -1.033065990E+01 + + + + nonlinear + 232.400 + 3.828 + 0.000 + 0.000 + 1.000 + + + + + + H:1 C:1 O:1 N:1 + BDEA94 + + + + 3.786049520E+00, 6.886679220E-03, -3.214878640E-06, 5.171957670E-10, + 1.193607880E-14, -2.826984000E+03, 5.632921620E+00 + + + + 5.897848850E+00, 3.167893930E-03, -1.118010640E-06, 1.772431440E-10, + -1.043391770E-14, -3.706533310E+03, -6.181678250E+00 + + + + nonlinear + 232.400 + 3.828 + 0.000 + 0.000 + 1.000 + + + + + + H:1 C:1 O:1 N:1 + BDEA94 + + + + 3.630963170E+00, 7.302823570E-03, -2.280500030E-06, -6.612712980E-10, + 3.622357520E-13, -1.558736360E+04, 6.194577270E+00 + + + + 6.223951340E+00, 3.178640040E-03, -1.093787550E-06, 1.707351630E-10, + -9.950219550E-15, -1.665993440E+04, -8.382247410E+00 + + + + nonlinear + 232.400 + 3.828 + 0.000 + 0.000 + 1.000 + + + + + + C:1 O:1 N:1 + EA 93 + + + + 2.826930800E+00, 8.805168800E-03, -8.386613400E-06, 4.801696400E-09, + -1.331359500E-12, 1.468247700E+04, 9.550464600E+00 + + + + 5.152184500E+00, 2.305176100E-03, -8.803315300E-07, 1.478909800E-10, + -9.097799600E-15, 1.400412300E+04, -2.544266000E+00 + + + + linear + 232.400 + 3.828 + 0.000 + 0.000 + 1.000 + + + + + + N:2 + 121286 + + + + 3.298677000E+00, 1.408240400E-03, -3.963222000E-06, 5.641515000E-09, + -2.444854000E-12, -1.020899900E+03, 3.950372000E+00 + + + + 2.926640000E+00, 1.487976800E-03, -5.684760000E-07, 1.009703800E-10, + -6.753351000E-15, -9.227977000E+02, 5.980528000E+00 + + + + linear + 97.530 + 3.621 + 0.000 + 1.760 + 4.000 + + + + + + Ar:1 + 120186 + + + + 2.500000000E+00, 0.000000000E+00, 0.000000000E+00, 0.000000000E+00, + 0.000000000E+00, -7.453750000E+02, 4.366000000E+00 + + + + 2.500000000E+00, 0.000000000E+00, 0.000000000E+00, 0.000000000E+00, + 0.000000000E+00, -7.453750000E+02, 4.366000000E+00 + + + + atom + 136.500 + 3.330 + 0.000 + 0.000 + 0.000 + + + + + + + + 2 O + M [=] O2 + M + + + 1.200000E+11 + -1 + 0.000000 + + AR:0.83 C2H6:3 CH4:2 CO:1.75 CO2:3.6 H2:2.4 H2O:15.4 + + O:2.0 + O2:1.0 + + + + + O + H + M [=] OH + M + + + 5.000000E+11 + -1 + 0.000000 + + AR:0.7 C2H6:3 CH4:2 CO:1.5 CO2:2 H2:2 H2O:6 + + H:1 O:1.0 + OH:1.0 + + + + + O + H2 [=] H + OH + + + 5.000000E+01 + 2.67 + 6290.000000 + + + H2:1 O:1.0 + H:1.0 OH:1 + + + + + O + HO2 [=] OH + O2 + + + 2.000000E+10 + 0 + 0.000000 + + + HO2:1 O:1.0 + O2:1 OH:1.0 + + + + + O + H2O2 [=] OH + HO2 + + + 9.630000E+03 + 2 + 4000.000000 + + + H2O2:1 O:1.0 + HO2:1 OH:1.0 + + + + + O + CH [=] H + CO + + + 5.700000E+10 + 0 + 0.000000 + + + CH:1 O:1.0 + H:1.0 CO:1 + + + + + O + CH2 [=] H + HCO + + + 8.000000E+10 + 0 + 0.000000 + + + CH2:1 O:1.0 + H:1.0 HCO:1 + + + + + O + CH2(S) [=] H2 + CO + + + 1.500000E+10 + 0 + 0.000000 + + + CH2(S):1 O:1.0 + H2:1.0 CO:1 + + + + + O + CH2(S) [=] H + HCO + + + 1.500000E+10 + 0 + 0.000000 + + + CH2(S):1 O:1.0 + H:1.0 HCO:1 + + + + + O + CH3 [=] H + CH2O + + + 8.430000E+10 + 0 + 0.000000 + + + CH3:1 O:1.0 + CH2O:1 H:1.0 + + + + + O + CH4 [=] OH + CH3 + + + 1.020000E+06 + 1.5 + 8600.000000 + + + CH4:1 O:1.0 + CH3:1 OH:1.0 + + + + + O + CO + M [=] CO2 + M + + + 6.020000E+08 + 0 + 3000.000000 + + AR:0.5 C2H6:3 CH4:2 CO:1.5 CO2:3.5 H2:2 H2O:6 O2:6 + + CO:1 O:1.0 + CO2:1.0 + + + + + O + HCO [=] OH + CO + + + 3.000000E+10 + 0 + 0.000000 + + + HCO:1 O:1.0 + CO:1 OH:1.0 + + + + + O + HCO [=] H + CO2 + + + 3.000000E+10 + 0 + 0.000000 + + + HCO:1 O:1.0 + H:1.0 CO2:1 + + + + + O + CH2O [=] OH + HCO + + + 3.900000E+10 + 0 + 3540.000000 + + + CH2O:1 O:1.0 + HCO:1 OH:1.0 + + + + + O + CH2OH [=] OH + CH2O + + + 1.000000E+10 + 0 + 0.000000 + + + CH2OH:1 O:1.0 + CH2O:1 OH:1.0 + + + + + O + CH3O [=] OH + CH2O + + + 1.000000E+10 + 0 + 0.000000 + + + CH3O:1 O:1.0 + CH2O:1 OH:1.0 + + + + + O + CH3OH [=] OH + CH2OH + + + 3.880000E+02 + 2.5 + 3100.000000 + + + CH3OH:1 O:1.0 + CH2OH:1 OH:1.0 + + + + + O + CH3OH [=] OH + CH3O + + + 1.300000E+02 + 2.5 + 5000.000000 + + + CH3OH:1 O:1.0 + CH3O:1 OH:1.0 + + + + + O + C2H [=] CH + CO + + + 5.000000E+10 + 0 + 0.000000 + + + C2H:1 O:1.0 + CH:1.0 CO:1 + + + + + O + C2H2 [=] H + HCCO + + + 1.020000E+04 + 2 + 1900.000000 + + + C2H2:1 O:1.0 + H:1.0 HCCO:1 + + + + + O + C2H2 [=] OH + C2H + + + 4.600000E+16 + -1.41 + 28950.000000 + + + C2H2:1 O:1.0 + C2H:1 OH:1.0 + + + + + O + C2H2 [=] CO + CH2 + + + 1.020000E+04 + 2 + 1900.000000 + + + C2H2:1 O:1.0 + CH2:1 CO:1.0 + + + + + O + C2H3 [=] H + CH2CO + + + 3.000000E+10 + 0 + 0.000000 + + + C2H3:1 O:1.0 + H:1.0 CH2CO:1 + + + + + O + C2H4 [=] CH3 + HCO + + + 1.920000E+04 + 1.83 + 220.000000 + + + C2H4:1 O:1.0 + CH3:1.0 HCO:1 + + + + + O + C2H5 [=] CH3 + CH2O + + + 1.320000E+11 + 0 + 0.000000 + + + C2H5:1 O:1.0 + CH2O:1 CH3:1.0 + + + + + O + C2H6 [=] OH + C2H5 + + + 8.980000E+04 + 1.92 + 5690.000000 + + + C2H6:1 O:1.0 + C2H5:1 OH:1.0 + + + + + O + HCCO [=] H + 2 CO + + + 1.000000E+11 + 0 + 0.000000 + + + HCCO:1 O:1.0 + H:1.0 CO:2.0 + + + + + O + CH2CO [=] OH + HCCO + + + 1.000000E+10 + 0 + 8000.000000 + + + CH2CO:1 O:1.0 + HCCO:1 OH:1.0 + + + + + O + CH2CO [=] CH2 + CO2 + + + 1.750000E+09 + 0 + 1350.000000 + + + CH2CO:1 O:1.0 + CH2:1.0 CO2:1 + + + + + O2 + CO [=] O + CO2 + + + 2.500000E+09 + 0 + 47800.000000 + + + CO:1 O2:1.0 + CO2:1 O:1.0 + + + + + O2 + CH2O [=] HO2 + HCO + + + 1.000000E+11 + 0 + 40000.000000 + + + CH2O:1 O2:1.0 + HO2:1.0 HCO:1 + + + + + H + O2 + M [=] HO2 + M + + + 2.800000E+12 + -0.86 + 0.000000 + + AR:0 C2H6:1.5 CO:0.75 CO2:1.5 H2O:0 N2:0 O2:0 + + H:1.0 O2:1 + HO2:1.0 + + + + + H + 2 O2 [=] HO2 + O2 + + + 3.000000E+14 + -1.72 + 0.000000 + + + H:1.0 O2:2.0 + HO2:1.0 O2:1 + + + + + H + O2 + H2O [=] HO2 + H2O + + + 9.380000E+12 + -0.76 + 0.000000 + + + H:1.0 H2O:1 O2:1 + H2O:1 HO2:1.0 + + + + + H + O2 + N2 [=] HO2 + N2 + + + 3.750000E+14 + -1.72 + 0.000000 + + + H:1.0 N2:1 O2:1 + N2:1 HO2:1.0 + + + + + H + O2 + AR [=] HO2 + AR + + + 7.000000E+11 + -0.8 + 0.000000 + + + H:1.0 AR:1 O2:1 + AR:1 HO2:1.0 + + + + + H + O2 [=] O + OH + + + 8.300000E+10 + 0 + 14413.000000 + + + H:1.0 O2:1 + O:1.0 OH:1 + + + + + 2 H + M [=] H2 + M + + + 1.000000E+12 + -1 + 0.000000 + + AR:0.63 C2H6:3 CH4:2 CO2:0 H2:0 H2O:0 + + H:2.0 + H2:1.0 + + + + + 2 H + H2 [=] 2 H2 + + + 9.000000E+10 + -0.6 + 0.000000 + + + H2:1 H:2.0 + H2:2.0 + + + + + 2 H + H2O [=] H2 + H2O + + + 6.000000E+13 + -1.25 + 0.000000 + + + H:2.0 H2O:1 + H2:1.0 H2O:1 + + + + + 2 H + CO2 [=] H2 + CO2 + + + 5.500000E+14 + -2 + 0.000000 + + + H:2.0 CO2:1 + H2:1.0 CO2:1 + + + + + H + OH + M [=] H2O + M + + + 2.200000E+16 + -2 + 0.000000 + + AR:0.38 C2H6:3 CH4:2 H2:0.73 H2O:3.65 + + H:1.0 OH:1 + H2O:1.0 + + + + + H + HO2 [=] O + H2O + + + 3.970000E+09 + 0 + 671.000000 + + + H:1.0 HO2:1 + H2O:1 O:1.0 + + + + + H + HO2 [=] O2 + H2 + + + 2.800000E+10 + 0 + 1068.000000 + + + H:1.0 HO2:1 + H2:1 O2:1.0 + + + + + H + HO2 [=] 2 OH + + + 1.340000E+11 + 0 + 635.000000 + + + H:1.0 HO2:1 + OH:2.0 + + + + + H + H2O2 [=] HO2 + H2 + + + 1.210000E+04 + 2 + 5200.000000 + + + H:1.0 H2O2:1 + H2:1 HO2:1.0 + + + + + H + H2O2 [=] OH + H2O + + + 1.000000E+10 + 0 + 3600.000000 + + + H:1.0 H2O2:1 + H2O:1 OH:1.0 + + + + + H + CH [=] C + H2 + + + 1.100000E+11 + 0 + 0.000000 + + + H:1.0 CH:1 + H2:1 C:1.0 + + + + + H + CH2 (+ M) [=] CH3 (+ M) + + + 2.500000E+13 + -0.8 + 0.000000 + + + 3.200000E+21 + -3.14 + 1230.000000 + + AR:0.7 C2H6:3 CH4:2 CO:1.5 CO2:2 H2:2 H2O:6 + 0.68 78 1995 5590 + + H:1.0 CH2:1 + CH3:1.0 + + + + + H + CH2(S) [=] CH + H2 + + + 3.000000E+10 + 0 + 0.000000 + + + H:1.0 CH2(S):1 + H2:1 CH:1.0 + + + + + H + CH3 (+ M) [=] CH4 (+ M) + + + 1.270000E+13 + -0.63 + 383.000000 + + + 2.477000E+27 + -4.76 + 2440.000000 + + AR:0.7 C2H6:3 CH4:2 CO:1.5 CO2:2 H2:2 H2O:6 + 0.783 74 2941 6964 + + H:1.0 CH3:1 + CH4:1.0 + + + + + H + CH4 [=] CH3 + H2 + + + 6.600000E+05 + 1.62 + 10840.000000 + + + H:1.0 CH4:1 + H2:1 CH3:1.0 + + + + + H + HCO (+ M) [=] CH2O (+ M) + + + 1.090000E+09 + 0.48 + -260.000000 + + + 1.350000E+18 + -2.57 + 1425.000000 + + AR:0.7 C2H6:3 CH4:2 CO:1.5 CO2:2 H2:2 H2O:6 + 0.7824 271 2755 6570 + + H:1.0 HCO:1 + CH2O:1.0 + + + + + H + HCO [=] H2 + CO + + + 7.340000E+10 + 0 + 0.000000 + + + H:1.0 HCO:1 + H2:1.0 CO:1 + + + + + H + CH2O (+ M) [=] CH2OH (+ M) + + + 5.400000E+08 + 0.454 + 3600.000000 + + + 1.270000E+26 + -4.82 + 6530.000000 + + C2H6:3 CH4:2 CO:1.5 CO2:2 H2:2 H2O:6 + 0.7187 103 1291 4160 + + CH2O:1 H:1.0 + CH2OH:1.0 + + + + + H + CH2O (+ M) [=] CH3O (+ M) + + + 5.400000E+08 + 0.454 + 2600.000000 + + + 2.200000E+24 + -4.8 + 5560.000000 + + C2H6:3 CH4:2 CO:1.5 CO2:2 H2:2 H2O:6 + 0.758 94 1555 4200 + + CH2O:1 H:1.0 + CH3O:1.0 + + + + + H + CH2O [=] HCO + H2 + + + 2.300000E+07 + 1.05 + 3275.000000 + + + CH2O:1 H:1.0 + H2:1 HCO:1.0 + + + + + H + CH2OH (+ M) [=] CH3OH (+ M) + + + 1.800000E+10 + 0 + 0.000000 + + + 3.000000E+25 + -4.8 + 3300.000000 + + C2H6:3 CH4:2 CO:1.5 CO2:2 H2:2 H2O:6 + 0.7679 338 1812 5081 + + H:1.0 CH2OH:1 + CH3OH:1.0 + + + + + H + CH2OH [=] H2 + CH2O + + + 2.000000E+10 + 0 + 0.000000 + + + H:1.0 CH2OH:1 + H2:1.0 CH2O:1 + + + + + H + CH2OH [=] OH + CH3 + + + 1.200000E+10 + 0 + 0.000000 + + + H:1.0 CH2OH:1 + CH3:1 OH:1.0 + + + + + H + CH2OH [=] CH2(S) + H2O + + + 6.000000E+09 + 0 + 0.000000 + + + H:1.0 CH2OH:1 + CH2(S):1.0 H2O:1 + + + + + H + CH3O (+ M) [=] CH3OH (+ M) + + + 5.000000E+10 + 0 + 0.000000 + + + 8.600000E+22 + -4 + 3025.000000 + + C2H6:3 CH4:2 CO:1.5 CO2:2 H2:2 H2O:6 + 0.8902 144 2838 45569 + + H:1.0 CH3O:1 + CH3OH:1.0 + + + + + H + CH3O [=] H + CH2OH + + + 3.400000E+03 + 1.6 + 0.000000 + + + H:1.0 CH3O:1 + H:1.0 CH2OH:1 + + + + + H + CH3O [=] H2 + CH2O + + + 2.000000E+10 + 0 + 0.000000 + + + H:1.0 CH3O:1 + H2:1.0 CH2O:1 + + + + + H + CH3O [=] OH + CH3 + + + 3.200000E+10 + 0 + 0.000000 + + + H:1.0 CH3O:1 + CH3:1 OH:1.0 + + + + + H + CH3O [=] CH2(S) + H2O + + + 1.600000E+10 + 0 + 0.000000 + + + H:1.0 CH3O:1 + CH2(S):1.0 H2O:1 + + + + + H + CH3OH [=] CH2OH + H2 + + + 1.700000E+04 + 2.1 + 4870.000000 + + + CH3OH:1 H:1.0 + H2:1 CH2OH:1.0 + + + + + H + CH3OH [=] CH3O + H2 + + + 4.200000E+03 + 2.1 + 4870.000000 + + + CH3OH:1 H:1.0 + H2:1 CH3O:1.0 + + + + + H + C2H (+ M) [=] C2H2 (+ M) + + + 1.000000E+14 + -1 + 0.000000 + + + 3.750000E+27 + -4.8 + 1900.000000 + + AR:0.7 C2H6:3 CH4:2 CO:1.5 CO2:2 H2:2 H2O:6 + 0.6464 132 1315 5566 + + H:1.0 C2H:1 + C2H2:1.0 + + + + + H + C2H2 (+ M) [=] C2H3 (+ M) + + + 5.600000E+09 + 0 + 2400.000000 + + + 3.800000E+34 + -7.27 + 7220.000000 + + AR:0.7 C2H6:3 CH4:2 CO:1.5 CO2:2 H2:2 H2O:6 + 0.7507 98.5 1302 4167 + + H:1.0 C2H2:1 + C2H3:1.0 + + + + + H + C2H3 (+ M) [=] C2H4 (+ M) + + + 6.080000E+09 + 0.27 + 280.000000 + + + 1.400000E+24 + -3.86 + 3320.000000 + + AR:0.7 C2H6:3 CH4:2 CO:1.5 CO2:2 H2:2 H2O:6 + 0.782 207.5 2663 6095 + + H:1.0 C2H3:1 + C2H4:1.0 + + + + + H + C2H3 [=] H2 + C2H2 + + + 3.000000E+10 + 0 + 0.000000 + + + H:1.0 C2H3:1 + H2:1.0 C2H2:1 + + + + + H + C2H4 (+ M) [=] C2H5 (+ M) + + + 1.080000E+09 + 0.454 + 1820.000000 + + + 1.200000E+36 + -7.62 + 6970.000000 + + AR:0.7 C2H6:3 CH4:2 CO:1.5 CO2:2 H2:2 H2O:6 + 0.9753 210 984 4374 + + H:1.0 C2H4:1 + C2H5:1.0 + + + + + H + C2H4 [=] C2H3 + H2 + + + 1.325000E+03 + 2.53 + 12240.000000 + + + H:1.0 C2H4:1 + H2:1 C2H3:1.0 + + + + + H + C2H5 (+ M) [=] C2H6 (+ M) + + + 5.210000E+14 + -0.99 + 1580.000000 + + + 1.990000E+35 + -7.08 + 6685.000000 + + AR:0.7 C2H6:3 CH4:2 CO:1.5 CO2:2 H2:2 H2O:6 + 0.8422 125 2219 6882 + + H:1.0 C2H5:1 + C2H6:1.0 + + + + + H + C2H5 [=] H2 + C2H4 + + + 2.000000E+09 + 0 + 0.000000 + + + H:1.0 C2H5:1 + H2:1.0 C2H4:1 + + + + + H + C2H6 [=] C2H5 + H2 + + + 1.150000E+05 + 1.9 + 7530.000000 + + + H:1.0 C2H6:1 + H2:1 C2H5:1.0 + + + + + H + HCCO [=] CH2(S) + CO + + + 1.000000E+11 + 0 + 0.000000 + + + H:1.0 HCCO:1 + CH2(S):1.0 CO:1 + + + + + H + CH2CO [=] HCCO + H2 + + + 5.000000E+10 + 0 + 8000.000000 + + + H:1.0 CH2CO:1 + H2:1 HCCO:1.0 + + + + + H + CH2CO [=] CH3 + CO + + + 1.130000E+10 + 0 + 3428.000000 + + + H:1.0 CH2CO:1 + CH3:1.0 CO:1 + + + + + H + HCCOH [=] H + CH2CO + + + 1.000000E+10 + 0 + 0.000000 + + + H:1.0 HCCOH:1 + H:1.0 CH2CO:1 + + + + + H2 + CO (+ M) [=] CH2O (+ M) + + + 4.300000E+04 + 1.5 + 79600.000000 + + + 5.070000E+21 + -3.42 + 84350.000000 + + AR:0.7 C2H6:3 CH4:2 CO:1.5 CO2:2 H2:2 H2O:6 + 0.932 197 1540 10300 + + H2:1.0 CO:1 + CH2O:1.0 + + + + + OH + H2 [=] H + H2O + + + 2.160000E+05 + 1.51 + 3430.000000 + + + H2:1 OH:1.0 + H:1.0 H2O:1 + + + + + 2 OH (+ M) [=] H2O2 (+ M) + + + 7.400000E+10 + -0.37 + 0.000000 + + + 2.300000E+12 + -0.9 + -1700.000000 + + AR:0.7 C2H6:3 CH4:2 CO:1.5 CO2:2 H2:2 H2O:6 + 0.7346 94 1756 5182 + + OH:2.0 + H2O2:1.0 + + + + + 2 OH [=] O + H2O + + + 3.570000E+01 + 2.4 + -2110.000000 + + + OH:2.0 + H2O:1 O:1.0 + + + + + OH + HO2 [=] O2 + H2O + + + 2.900000E+10 + 0 + -500.000000 + + + HO2:1 OH:1.0 + H2O:1 O2:1.0 + + + + + OH + H2O2 [=] HO2 + H2O + + + 1.750000E+09 + 0 + 320.000000 + + + H2O2:1 OH:1.0 + H2O:1 HO2:1.0 + + + + + OH + H2O2 [=] HO2 + H2O + + + 5.800000E+11 + 0 + 9560.000000 + + + H2O2:1 OH:1.0 + H2O:1 HO2:1.0 + + + + + OH + C [=] H + CO + + + 5.000000E+10 + 0 + 0.000000 + + + C:1 OH:1.0 + H:1.0 CO:1 + + + + + OH + CH [=] H + HCO + + + 3.000000E+10 + 0 + 0.000000 + + + CH:1 OH:1.0 + H:1.0 HCO:1 + + + + + OH + CH2 [=] H + CH2O + + + 2.000000E+10 + 0 + 0.000000 + + + CH2:1 OH:1.0 + CH2O:1 H:1.0 + + + + + OH + CH2 [=] CH + H2O + + + 1.130000E+04 + 2 + 3000.000000 + + + CH2:1 OH:1.0 + H2O:1 CH:1.0 + + + + + OH + CH2(S) [=] H + CH2O + + + 3.000000E+10 + 0 + 0.000000 + + + CH2(S):1 OH:1.0 + CH2O:1 H:1.0 + + + + + OH + CH3 (+ M) [=] CH3OH (+ M) + + + 6.300000E+10 + 0 + 0.000000 + + + 2.700000E+32 + -6.3 + 3100.000000 + + C2H6:3 CH4:2 CO:1.5 CO2:2 H2:2 H2O:6 + 0.2105 83.5 5398 8370 + + CH3:1 OH:1.0 + CH3OH:1.0 + + + + + OH + CH3 [=] CH2 + H2O + + + 5.600000E+04 + 1.6 + 5420.000000 + + + CH3:1 OH:1.0 + CH2:1.0 H2O:1 + + + + + OH + CH3 [=] CH2(S) + H2O + + + 2.501000E+10 + 0 + 0.000000 + + + CH3:1 OH:1.0 + CH2(S):1.0 H2O:1 + + + + + OH + CH4 [=] CH3 + H2O + + + 1.000000E+05 + 1.6 + 3120.000000 + + + CH4:1 OH:1.0 + H2O:1 CH3:1.0 + + + + + OH + CO [=] H + CO2 + + + 4.760000E+04 + 1.228 + 70.000000 + + + CO:1 OH:1.0 + H:1.0 CO2:1 + + + + + OH + HCO [=] H2O + CO + + + 5.000000E+10 + 0 + 0.000000 + + + HCO:1 OH:1.0 + H2O:1.0 CO:1 + + + + + OH + CH2O [=] HCO + H2O + + + 3.430000E+06 + 1.18 + -447.000000 + + + CH2O:1 OH:1.0 + H2O:1 HCO:1.0 + + + + + OH + CH2OH [=] H2O + CH2O + + + 5.000000E+09 + 0 + 0.000000 + + + CH2OH:1 OH:1.0 + CH2O:1 H2O:1.0 + + + + + OH + CH3O [=] H2O + CH2O + + + 5.000000E+09 + 0 + 0.000000 + + + CH3O:1 OH:1.0 + CH2O:1 H2O:1.0 + + + + + OH + CH3OH [=] CH2OH + H2O + + + 1.440000E+03 + 2 + -840.000000 + + + CH3OH:1 OH:1.0 + CH2OH:1.0 H2O:1 + + + + + OH + CH3OH [=] CH3O + H2O + + + 6.300000E+03 + 2 + 1500.000000 + + + CH3OH:1 OH:1.0 + H2O:1 CH3O:1.0 + + + + + OH + C2H [=] H + HCCO + + + 2.000000E+10 + 0 + 0.000000 + + + C2H:1 OH:1.0 + H:1.0 HCCO:1 + + + + + OH + C2H2 [=] H + CH2CO + + + 2.180000E-07 + 4.5 + -1000.000000 + + + C2H2:1 OH:1.0 + H:1.0 CH2CO:1 + + + + + OH + C2H2 [=] H + HCCOH + + + 5.040000E+02 + 2.3 + 13500.000000 + + + C2H2:1 OH:1.0 + H:1.0 HCCOH:1 + + + + + OH + C2H2 [=] C2H + H2O + + + 3.370000E+04 + 2 + 14000.000000 + + + C2H2:1 OH:1.0 + C2H:1.0 H2O:1 + + + + + OH + C2H2 [=] CH3 + CO + + + 4.830000E-07 + 4 + -2000.000000 + + + C2H2:1 OH:1.0 + CH3:1.0 CO:1 + + + + + OH + C2H3 [=] H2O + C2H2 + + + 5.000000E+09 + 0 + 0.000000 + + + C2H3:1 OH:1.0 + H2O:1.0 C2H2:1 + + + + + OH + C2H4 [=] C2H3 + H2O + + + 3.600000E+03 + 2 + 2500.000000 + + + C2H4:1 OH:1.0 + H2O:1 C2H3:1.0 + + + + + OH + C2H6 [=] C2H5 + H2O + + + 3.540000E+03 + 2.12 + 870.000000 + + + C2H6:1 OH:1.0 + C2H5:1.0 H2O:1 + + + + + OH + CH2CO [=] HCCO + H2O + + + 7.500000E+09 + 0 + 2000.000000 + + + CH2CO:1 OH:1.0 + H2O:1 HCCO:1.0 + + + + + 2 HO2 [=] O2 + H2O2 + + + 1.300000E+08 + 0 + -1630.000000 + + + HO2:2.0 + O2:1.0 H2O2:1 + + + + + 2 HO2 [=] O2 + H2O2 + + + 4.200000E+11 + 0 + 12000.000000 + + + HO2:2.0 + O2:1.0 H2O2:1 + + + + + HO2 + CH2 [=] OH + CH2O + + + 2.000000E+10 + 0 + 0.000000 + + + CH2:1 HO2:1.0 + CH2O:1 OH:1.0 + + + + + HO2 + CH3 [=] O2 + CH4 + + + 1.000000E+09 + 0 + 0.000000 + + + CH3:1 HO2:1.0 + CH4:1 O2:1.0 + + + + + HO2 + CH3 [=] OH + CH3O + + + 2.000000E+10 + 0 + 0.000000 + + + CH3:1 HO2:1.0 + CH3O:1 OH:1.0 + + + + + HO2 + CO [=] OH + CO2 + + + 1.500000E+11 + 0 + 23600.000000 + + + CO:1 HO2:1.0 + CO2:1 OH:1.0 + + + + + HO2 + CH2O [=] HCO + H2O2 + + + 1.000000E+09 + 0 + 8000.000000 + + + CH2O:1 HO2:1.0 + HCO:1.0 H2O2:1 + + + + + C + O2 [=] O + CO + + + 5.800000E+10 + 0 + 576.000000 + + + C:1.0 O2:1 + CO:1 O:1.0 + + + + + C + CH2 [=] H + C2H + + + 5.000000E+10 + 0 + 0.000000 + + + C:1.0 CH2:1 + H:1.0 C2H:1 + + + + + C + CH3 [=] H + C2H2 + + + 5.000000E+10 + 0 + 0.000000 + + + C:1.0 CH3:1 + H:1.0 C2H2:1 + + + + + CH + O2 [=] O + HCO + + + 3.300000E+10 + 0 + 0.000000 + + + CH:1.0 O2:1 + HCO:1 O:1.0 + + + + + CH + H2 [=] H + CH2 + + + 1.107000E+05 + 1.79 + 1670.000000 + + + H2:1 CH:1.0 + H:1.0 CH2:1 + + + + + CH + H2O [=] H + CH2O + + + 1.713000E+10 + 0 + -755.000000 + + + H2O:1 CH:1.0 + CH2O:1 H:1.0 + + + + + CH + CH2 [=] H + C2H2 + + + 4.000000E+10 + 0 + 0.000000 + + + CH2:1 CH:1.0 + H:1.0 C2H2:1 + + + + + CH + CH3 [=] H + C2H3 + + + 3.000000E+10 + 0 + 0.000000 + + + CH3:1 CH:1.0 + H:1.0 C2H3:1 + + + + + CH + CH4 [=] H + C2H4 + + + 6.000000E+10 + 0 + 0.000000 + + + CH:1.0 CH4:1 + H:1.0 C2H4:1 + + + + + CH + CO (+ M) [=] HCCO (+ M) + + + 5.000000E+10 + 0 + 0.000000 + + + 2.690000E+22 + -3.74 + 1936.000000 + + AR:0.7 C2H6:3 CH4:2 CO:1.5 CO2:2 H2:2 H2O:6 + 0.5757 237 1652 5069 + + CH:1.0 CO:1 + HCCO:1.0 + + + + + CH + CO2 [=] HCO + CO + + + 3.400000E+09 + 0 + 690.000000 + + + CH:1.0 CO2:1 + CO:1 HCO:1.0 + + + + + CH + CH2O [=] H + CH2CO + + + 9.460000E+10 + 0 + -515.000000 + + + CH2O:1 CH:1.0 + H:1.0 CH2CO:1 + + + + + CH + HCCO [=] CO + C2H2 + + + 5.000000E+10 + 0 + 0.000000 + + + CH:1.0 HCCO:1 + CO:1.0 C2H2:1 + + + + + CH2 + O2 [=] OH + HCO + + + 1.320000E+10 + 0 + 1500.000000 + + + CH2:1.0 O2:1 + HCO:1 OH:1.0 + + + + + CH2 + H2 [=] H + CH3 + + + 5.000000E+02 + 2 + 7230.000000 + + + H2:1 CH2:1.0 + H:1.0 CH3:1 + + + + + 2 CH2 [=] H2 + C2H2 + + + 3.200000E+10 + 0 + 0.000000 + + + CH2:2.0 + H2:1.0 C2H2:1 + + + + + CH2 + CH3 [=] H + C2H4 + + + 4.000000E+10 + 0 + 0.000000 + + + CH2:1.0 CH3:1 + H:1.0 C2H4:1 + + + + + CH2 + CH4 [=] 2 CH3 + + + 2.460000E+03 + 2 + 8270.000000 + + + CH2:1.0 CH4:1 + CH3:2.0 + + + + + CH2 + CO (+ M) [=] CH2CO (+ M) + + + 8.100000E+08 + 0.5 + 4510.000000 + + + 2.690000E+27 + -5.11 + 7095.000000 + + AR:0.7 C2H6:3 CH4:2 CO:1.5 CO2:2 H2:2 H2O:6 + 0.5907 275 1226 5185 + + CH2:1.0 CO:1 + CH2CO:1.0 + + + + + CH2 + HCCO [=] C2H3 + CO + + + 3.000000E+10 + 0 + 0.000000 + + + CH2:1.0 HCCO:1 + CO:1 C2H3:1.0 + + + + + CH2(S) + N2 [=] CH2 + N2 + + + 1.500000E+10 + 0 + 600.000000 + + + CH2(S):1.0 N2:1 + CH2:1.0 N2:1 + + + + + CH2(S) + AR [=] CH2 + AR + + + 9.000000E+09 + 0 + 600.000000 + + + CH2(S):1.0 AR:1 + CH2:1.0 AR:1 + + + + + CH2(S) + O2 [=] H + OH + CO + + + 2.800000E+10 + 0 + 0.000000 + + + CH2(S):1.0 O2:1 + H:1.0 CO:1 OH:1 + + + + + CH2(S) + O2 [=] CO + H2O + + + 1.200000E+10 + 0 + 0.000000 + + + CH2(S):1.0 O2:1 + H2O:1 CO:1.0 + + + + + CH2(S) + H2 [=] CH3 + H + + + 7.000000E+10 + 0 + 0.000000 + + + H2:1 CH2(S):1.0 + H:1 CH3:1.0 + + + + + CH2(S) + H2O (+ M) [=] CH3OH (+ M) + + + 2.000000E+10 + 0 + 0.000000 + + + 2.700000E+32 + -6.3 + 3100.000000 + + C2H6:3 CH4:2 CO:1.5 CO2:2 H2:2 H2O:6 + 0.1507 134 2383 7265 + + CH2(S):1.0 H2O:1 + CH3OH:1.0 + + + + + CH2(S) + H2O [=] CH2 + H2O + + + 3.000000E+10 + 0 + 0.000000 + + + CH2(S):1.0 H2O:1 + CH2:1.0 H2O:1 + + + + + CH2(S) + CH3 [=] H + C2H4 + + + 1.200000E+10 + 0 + -570.000000 + + + CH2(S):1.0 CH3:1 + H:1.0 C2H4:1 + + + + + CH2(S) + CH4 [=] 2 CH3 + + + 1.600000E+10 + 0 + -570.000000 + + + CH2(S):1.0 CH4:1 + CH3:2.0 + + + + + CH2(S) + CO [=] CH2 + CO + + + 9.000000E+09 + 0 + 0.000000 + + + CH2(S):1.0 CO:1 + CH2:1.0 CO:1 + + + + + CH2(S) + CO2 [=] CH2 + CO2 + + + 7.000000E+09 + 0 + 0.000000 + + + CH2(S):1.0 CO2:1 + CH2:1.0 CO2:1 + + + + + CH2(S) + CO2 [=] CO + CH2O + + + 1.400000E+10 + 0 + 0.000000 + + + CH2(S):1.0 CO2:1 + CH2O:1 CO:1.0 + + + + + CH2(S) + C2H6 [=] CH3 + C2H5 + + + 4.000000E+10 + 0 + -550.000000 + + + CH2(S):1.0 C2H6:1 + C2H5:1 CH3:1.0 + + + + + CH3 + O2 [=] O + CH3O + + + 2.675000E+10 + 0 + 28800.000000 + + + CH3:1.0 O2:1 + CH3O:1 O:1.0 + + + + + CH3 + O2 [=] OH + CH2O + + + 3.600000E+07 + 0 + 8940.000000 + + + CH3:1.0 O2:1 + CH2O:1 OH:1.0 + + + + + CH3 + H2O2 [=] HO2 + CH4 + + + 2.450000E+01 + 2.47 + 5180.000000 + + + CH3:1.0 H2O2:1 + CH4:1 HO2:1.0 + + + + + 2 CH3 (+ M) [=] C2H6 (+ M) + + + 2.120000E+13 + -0.97 + 620.000000 + + + 1.770000E+44 + -9.67 + 6220.000000 + + AR:0.7 C2H6:3 CH4:2 CO:1.5 CO2:2 H2:2 H2O:6 + 0.5325 151 1038 4970 + + CH3:2.0 + C2H6:1.0 + + + + + 2 CH3 [=] H + C2H5 + + + 4.990000E+09 + 0.1 + 10600.000000 + + + CH3:2.0 + H:1.0 C2H5:1 + + + + + CH3 + HCO [=] CH4 + CO + + + 2.648000E+10 + 0 + 0.000000 + + + CH3:1.0 HCO:1 + CO:1 CH4:1.0 + + + + + CH3 + CH2O [=] HCO + CH4 + + + 3.320000E+00 + 2.81 + 5860.000000 + + + CH2O:1 CH3:1.0 + CH4:1 HCO:1.0 + + + + + CH3 + CH3OH [=] CH2OH + CH4 + + + 3.000000E+04 + 1.5 + 9940.000000 + + + CH3OH:1 CH3:1.0 + CH2OH:1.0 CH4:1 + + + + + CH3 + CH3OH [=] CH3O + CH4 + + + 1.000000E+04 + 1.5 + 9940.000000 + + + CH3OH:1 CH3:1.0 + CH3O:1.0 CH4:1 + + + + + CH3 + C2H4 [=] C2H3 + CH4 + + + 2.270000E+02 + 2 + 9200.000000 + + + CH3:1.0 C2H4:1 + CH4:1 C2H3:1.0 + + + + + CH3 + C2H6 [=] C2H5 + CH4 + + + 6.140000E+03 + 1.74 + 10450.000000 + + + C2H6:1 CH3:1.0 + C2H5:1.0 CH4:1 + + + + + HCO + H2O [=] H + CO + H2O + + + 2.244000E+15 + -1 + 17000.000000 + + + H2O:1 HCO:1.0 + H:1.0 H2O:1 CO:1 + + + + + HCO + M [=] H + CO + M + + + 1.870000E+14 + -1 + 17000.000000 + + C2H6:3 CH4:2 CO:1.5 CO2:2 H2:2 H2O:0 + + HCO:1.0 + H:1.0 CO:1 + + + + + HCO + O2 [=] HO2 + CO + + + 7.600000E+09 + 0 + 400.000000 + + + HCO:1.0 O2:1 + CO:1 HO2:1.0 + + + + + CH2OH + O2 [=] HO2 + CH2O + + + 1.800000E+10 + 0 + 900.000000 + + + CH2OH:1.0 O2:1 + CH2O:1 HO2:1.0 + + + + + CH3O + O2 [=] HO2 + CH2O + + + 4.280000E-16 + 7.6 + -3530.000000 + + + CH3O:1.0 O2:1 + CH2O:1 HO2:1.0 + + + + + C2H + O2 [=] HCO + CO + + + 5.000000E+10 + 0 + 1500.000000 + + + C2H:1.0 O2:1 + CO:1 HCO:1.0 + + + + + C2H + H2 [=] H + C2H2 + + + 4.070000E+02 + 2.4 + 200.000000 + + + H2:1 C2H:1.0 + H:1.0 C2H2:1 + + + + + C2H3 + O2 [=] HCO + CH2O + + + 3.980000E+09 + 0 + -240.000000 + + + C2H3:1.0 O2:1 + CH2O:1 HCO:1.0 + + + + + C2H4 (+ M) [=] H2 + C2H2 (+ M) + + + 8.000000E+12 + 0.44 + 88770.000000 + + + 7.000000E+47 + -9.31 + 99860.000000 + + AR:0.7 C2H6:3 CH4:2 CO:1.5 CO2:2 H2:2 H2O:6 + 0.7345 180 1035 5417 + + C2H4:1.0 + H2:1.0 C2H2:1 + + + + + C2H5 + O2 [=] HO2 + C2H4 + + + 8.400000E+08 + 0 + 3875.000000 + + + C2H5:1.0 O2:1 + C2H4:1 HO2:1.0 + + + + + HCCO + O2 [=] OH + 2 CO + + + 1.600000E+09 + 0 + 854.000000 + + + HCCO:1.0 O2:1 + CO:2.0 OH:1.0 + + + + + 2 HCCO [=] 2 CO + C2H2 + + + 1.000000E+10 + 0 + 0.000000 + + + HCCO:2.0 + CO:2.0 C2H2:1 + + + + + N + NO [=] N2 + O + + + 3.500000E+10 + 0 + 330.000000 + + + NO:1 N:1.0 + N2:1.0 O:1 + + + + + N + O2 [=] NO + O + + + 2.650000E+09 + 0 + 6400.000000 + + + O2:1 N:1.0 + O:1 NO:1.0 + + + + + N + OH [=] NO + H + + + 7.333000E+10 + 0 + 1120.000000 + + + OH:1 N:1.0 + H:1 NO:1.0 + + + + + N2O + O [=] N2 + O2 + + + 1.400000E+09 + 0 + 10810.000000 + + + N2O:1.0 O:1 + N2:1.0 O2:1 + + + + + N2O + O [=] 2 NO + + + 2.900000E+10 + 0 + 23150.000000 + + + N2O:1.0 O:1 + NO:2.0 + + + + + N2O + H [=] N2 + OH + + + 4.400000E+11 + 0 + 18880.000000 + + + H:1 N2O:1.0 + N2:1.0 OH:1 + + + + + N2O + OH [=] N2 + HO2 + + + 2.000000E+09 + 0 + 21060.000000 + + + N2O:1.0 OH:1 + N2:1.0 HO2:1 + + + + + N2O (+ M) [=] N2 + O (+ M) + + + 1.300000E+11 + 0 + 59620.000000 + + + 6.200000E+11 + 0 + 56100.000000 + + AR:0.7 C2H6:3 CH4:2 CO:1.5 CO2:2 H2:2 H2O:6 + + + N2O:1.0 + N2:1.0 O:1 + + + + + HO2 + NO [=] NO2 + OH + + + 2.110000E+09 + 0 + -480.000000 + + + HO2:1.0 NO:1 + NO2:1.0 OH:1 + + + + + NO + O + M [=] NO2 + M + + + 1.060000E+14 + -1.41 + 0.000000 + + AR:0.7 C2H6:3 CH4:2 CO:1.5 CO2:2 H2:2 H2O:6 + + O:1 NO:1.0 + NO2:1.0 + + + + + NO2 + O [=] NO + O2 + + + 3.900000E+09 + 0 + -240.000000 + + + O:1 NO2:1.0 + O2:1 NO:1.0 + + + + + NO2 + H [=] NO + OH + + + 1.320000E+11 + 0 + 360.000000 + + + H:1 NO2:1.0 + OH:1 NO:1.0 + + + + + NH + O [=] NO + H + + + 5.000000E+10 + 0 + 0.000000 + + + NH:1.0 O:1 + H:1 NO:1.0 + + + + + NH + H [=] N + H2 + + + 3.200000E+10 + 0 + 330.000000 + + + NH:1.0 H:1 + H2:1 N:1.0 + + + + + NH + OH [=] HNO + H + + + 2.000000E+10 + 0 + 0.000000 + + + NH:1.0 OH:1 + H:1 HNO:1.0 + + + + + NH + OH [=] N + H2O + + + 2.000000E+06 + 1.2 + 0.000000 + + + NH:1.0 OH:1 + H2O:1 N:1.0 + + + + + NH + O2 [=] HNO + O + + + 4.610000E+02 + 2 + 6500.000000 + + + NH:1.0 O2:1 + O:1 HNO:1.0 + + + + + NH + O2 [=] NO + OH + + + 1.280000E+03 + 1.5 + 100.000000 + + + NH:1.0 O2:1 + OH:1 NO:1.0 + + + + + NH + N [=] N2 + H + + + 1.500000E+10 + 0 + 0.000000 + + + NH:1.0 N:1 + H:1 N2:1.0 + + + + + NH + H2O [=] HNO + H2 + + + 2.000000E+10 + 0 + 13850.000000 + + + NH:1.0 H2O:1 + H2:1 HNO:1.0 + + + + + NH + NO [=] N2 + OH + + + 2.160000E+10 + -0.23 + 0.000000 + + + NH:1.0 NO:1 + N2:1.0 OH:1 + + + + + NH + NO [=] N2O + H + + + 4.160000E+11 + -0.45 + 0.000000 + + + NH:1.0 NO:1 + H:1 N2O:1.0 + + + + + NH2 + O [=] OH + NH + + + 7.000000E+09 + 0 + 0.000000 + + + O:1 NH2:1.0 + NH:1 OH:1.0 + + + + + NH2 + O [=] H + HNO + + + 4.600000E+10 + 0 + 0.000000 + + + O:1 NH2:1.0 + H:1.0 HNO:1 + + + + + NH2 + H [=] NH + H2 + + + 4.000000E+10 + 0 + 3650.000000 + + + H:1 NH2:1.0 + NH:1.0 H2:1 + + + + + NH2 + OH [=] NH + H2O + + + 9.000000E+04 + 1.5 + -460.000000 + + + OH:1 NH2:1.0 + NH:1.0 H2O:1 + + + + + NNH [=] N2 + H + + + 3.300000E+08 + 0 + 0.000000 + + + NNH:1.0 + H:1 N2:1.0 + + + + + NNH + M [=] N2 + H + M + + + 1.300000E+11 + -0.11 + 4980.000000 + + AR:0.7 C2H6:3 CH4:2 CO:1.5 CO2:2 H2:2 H2O:6 + + NNH:1.0 + H:1 N2:1.0 + + + + + NNH + O2 [=] HO2 + N2 + + + 5.000000E+09 + 0 + 0.000000 + + + O2:1 NNH:1.0 + N2:1 HO2:1.0 + + + + + NNH + O [=] OH + N2 + + + 2.500000E+10 + 0 + 0.000000 + + + O:1 NNH:1.0 + N2:1 OH:1.0 + + + + + NNH + O [=] NH + NO + + + 7.000000E+10 + 0 + 0.000000 + + + O:1 NNH:1.0 + NH:1.0 NO:1 + + + + + NNH + H [=] H2 + N2 + + + 5.000000E+10 + 0 + 0.000000 + + + H:1 NNH:1.0 + H2:1.0 N2:1 + + + + + NNH + OH [=] H2O + N2 + + + 2.000000E+10 + 0 + 0.000000 + + + OH:1 NNH:1.0 + H2O:1.0 N2:1 + + + + + NNH + CH3 [=] CH4 + N2 + + + 2.500000E+10 + 0 + 0.000000 + + + CH3:1 NNH:1.0 + N2:1 CH4:1.0 + + + + + H + NO + M [=] HNO + M + + + 8.950000E+13 + -1.32 + 740.000000 + + AR:0.7 C2H6:3 CH4:2 CO:1.5 CO2:2 H2:2 H2O:6 + + H:1.0 NO:1 + HNO:1.0 + + + + + HNO + O [=] NO + OH + + + 2.500000E+10 + 0 + 0.000000 + + + O:1 HNO:1.0 + OH:1 NO:1.0 + + + + + HNO + H [=] H2 + NO + + + 4.500000E+08 + 0.72 + 660.000000 + + + H:1 HNO:1.0 + H2:1.0 NO:1 + + + + + HNO + OH [=] NO + H2O + + + 1.300000E+04 + 1.9 + -950.000000 + + + HNO:1.0 OH:1 + H2O:1 NO:1.0 + + + + + HNO + O2 [=] HO2 + NO + + + 1.000000E+10 + 0 + 13000.000000 + + + O2:1 HNO:1.0 + HO2:1.0 NO:1 + + + + + CN + O [=] CO + N + + + 7.700000E+10 + 0 + 0.000000 + + + CN:1.0 O:1 + CO:1.0 N:1 + + + + + CN + OH [=] NCO + H + + + 4.000000E+10 + 0 + 0.000000 + + + CN:1.0 OH:1 + H:1 NCO:1.0 + + + + + CN + H2O [=] HCN + OH + + + 8.000000E+09 + 0 + 7460.000000 + + + H2O:1 CN:1.0 + HCN:1.0 OH:1 + + + + + CN + O2 [=] NCO + O + + + 6.140000E+09 + 0 + -440.000000 + + + CN:1.0 O2:1 + O:1 NCO:1.0 + + + + + CN + H2 [=] HCN + H + + + 2.100000E+10 + 0 + 4710.000000 + + + H2:1 CN:1.0 + H:1 HCN:1.0 + + + + + NCO + O [=] NO + CO + + + 2.350000E+10 + 0 + 0.000000 + + + O:1 NCO:1.0 + CO:1 NO:1.0 + + + + + NCO + H [=] NH + CO + + + 5.400000E+10 + 0 + 0.000000 + + + H:1 NCO:1.0 + NH:1.0 CO:1 + + + + + NCO + OH [=] NO + H + CO + + + 2.500000E+09 + 0 + 0.000000 + + + OH:1 NCO:1.0 + H:1 CO:1 NO:1.0 + + + + + NCO + N [=] N2 + CO + + + 2.000000E+10 + 0 + 0.000000 + + + N:1 NCO:1.0 + N2:1.0 CO:1 + + + + + NCO + O2 [=] NO + CO2 + + + 2.000000E+09 + 0 + 20000.000000 + + + O2:1 NCO:1.0 + CO2:1 NO:1.0 + + + + + NCO + M [=] N + CO + M + + + 8.800000E+13 + -0.5 + 48000.000000 + + AR:0.7 C2H6:3 CH4:2 CO:1.5 CO2:2 H2:2 H2O:6 + + NCO:1.0 + CO:1 N:1.0 + + + + + NCO + NO [=] N2O + CO + + + 2.850000E+14 + -1.52 + 740.000000 + + + NO:1 NCO:1.0 + CO:1 N2O:1.0 + + + + + NCO + NO [=] N2 + CO2 + + + 5.700000E+15 + -2 + 800.000000 + + + NO:1 NCO:1.0 + N2:1.0 CO2:1 + + + + + HCN + M [=] H + CN + M + + + 1.040000E+26 + -3.3 + 126600.000000 + + AR:0.7 C2H6:3 CH4:2 CO:1.5 CO2:2 H2:2 H2O:6 + + HCN:1.0 + H:1.0 CN:1 + + + + + HCN + O [=] NCO + H + + + 1.107000E+01 + 2.64 + 4980.000000 + + + HCN:1.0 O:1 + H:1 NCO:1.0 + + + + + HCN + O [=] NH + CO + + + 2.767000E+00 + 2.64 + 4980.000000 + + + HCN:1.0 O:1 + NH:1.0 CO:1 + + + + + HCN + O [=] CN + OH + + + 2.134000E+06 + 1.58 + 26600.000000 + + + HCN:1.0 O:1 + CN:1.0 OH:1 + + + + + HCN + OH [=] HOCN + H + + + 1.100000E+03 + 2.03 + 13370.000000 + + + HCN:1.0 OH:1 + HOCN:1.0 H:1 + + + + + HCN + OH [=] HNCO + H + + + 4.400000E+00 + 2.26 + 6400.000000 + + + HCN:1.0 OH:1 + HNCO:1.0 H:1 + + + + + HCN + OH [=] NH2 + CO + + + 1.600000E-01 + 2.56 + 9000.000000 + + + HCN:1.0 OH:1 + CO:1 NH2:1.0 + + + + + H + HCN + M [=] H2CN + M + + + 1.400000E+20 + -3.4 + 1900.000000 + + AR:0.7 C2H6:3 CH4:2 CO:1.5 CO2:2 H2:2 H2O:6 + + H:1.0 HCN:1 + H2CN:1.0 + + + + + H2CN + N [=] N2 + CH2 + + + 6.000000E+10 + 0 + 400.000000 + + + H2CN:1.0 N:1 + N2:1.0 CH2:1 + + + + + C + N2 [=] CN + N + + + 6.300000E+10 + 0 + 46020.000000 + + + C:1.0 N2:1 + CN:1.0 N:1 + + + + + CH + N2 [=] HCN + N + + + 2.857000E+05 + 1.1 + 20400.000000 + + + N2:1 CH:1.0 + HCN:1.0 N:1 + + + + + CH + N2 (+ M) [=] HCNN (+ M) + + + 3.100000E+09 + 0.15 + 0.000000 + + + 1.300000E+19 + -3.16 + 740.000000 + + AR:0.7 C2H6:3 CH4:2 CO:1.5 CO2:2 H2:2 H2O:6 + 0.667 235 2117 4536 + + N2:1 CH:1.0 + HCNN:1.0 + + + + + CH2 + N2 [=] HCN + NH + + + 1.000000E+10 + 0 + 74000.000000 + + + CH2:1.0 N2:1 + NH:1 HCN:1.0 + + + + + CH2(S) + N2 [=] NH + HCN + + + 1.000000E+08 + 0 + 65000.000000 + + + CH2(S):1.0 N2:1 + NH:1.0 HCN:1 + + + + + C + NO [=] CN + O + + + 1.900000E+10 + 0 + 0.000000 + + + C:1.0 NO:1 + CN:1.0 O:1 + + + + + C + NO [=] CO + N + + + 2.900000E+10 + 0 + 0.000000 + + + C:1.0 NO:1 + CO:1.0 N:1 + + + + + CH + NO [=] HCN + O + + + 5.000000E+10 + 0 + 0.000000 + + + CH:1.0 NO:1 + HCN:1.0 O:1 + + + + + CH + NO [=] H + NCO + + + 2.000000E+10 + 0 + 0.000000 + + + CH:1.0 NO:1 + H:1.0 NCO:1 + + + + + CH + NO [=] N + HCO + + + 3.000000E+10 + 0 + 0.000000 + + + CH:1.0 NO:1 + HCO:1 N:1.0 + + + + + CH2 + NO [=] H + HNCO + + + 3.100000E+14 + -1.38 + 1270.000000 + + + CH2:1.0 NO:1 + HNCO:1 H:1.0 + + + + + CH2 + NO [=] OH + HCN + + + 2.900000E+11 + -0.69 + 760.000000 + + + CH2:1.0 NO:1 + HCN:1 OH:1.0 + + + + + CH2 + NO [=] H + HCNO + + + 3.800000E+10 + -0.36 + 580.000000 + + + CH2:1.0 NO:1 + H:1.0 HCNO:1 + + + + + CH2(S) + NO [=] H + HNCO + + + 3.100000E+14 + -1.38 + 1270.000000 + + + CH2(S):1.0 NO:1 + HNCO:1 H:1.0 + + + + + CH2(S) + NO [=] OH + HCN + + + 2.900000E+11 + -0.69 + 760.000000 + + + CH2(S):1.0 NO:1 + HCN:1 OH:1.0 + + + + + CH2(S) + NO [=] H + HCNO + + + 3.800000E+10 + -0.36 + 580.000000 + + + CH2(S):1.0 NO:1 + H:1.0 HCNO:1 + + + + + CH3 + NO [=] HCN + H2O + + + 9.600000E+10 + 0 + 28800.000000 + + + CH3:1.0 NO:1 + H2O:1 HCN:1.0 + + + + + CH3 + NO [=] H2CN + OH + + + 1.000000E+09 + 0 + 21750.000000 + + + CH3:1.0 NO:1 + H2CN:1.0 OH:1 + + + + + HCNN + O [=] CO + H + N2 + + + 2.200000E+10 + 0 + 0.000000 + + + O:1 HCNN:1.0 + H:1 N2:1 CO:1.0 + + + + + HCNN + O [=] HCN + NO + + + 2.000000E+09 + 0 + 0.000000 + + + O:1 HCNN:1.0 + HCN:1.0 NO:1 + + + + + HCNN + O2 [=] O + HCO + N2 + + + 1.200000E+10 + 0 + 0.000000 + + + O2:1 HCNN:1.0 + N2:1 HCO:1 O:1.0 + + + + + HCNN + OH [=] H + HCO + N2 + + + 1.200000E+10 + 0 + 0.000000 + + + OH:1 HCNN:1.0 + H:1.0 N2:1 HCO:1 + + + + + HCNN + H [=] CH2 + N2 + + + 1.000000E+11 + 0 + 0.000000 + + + H:1 HCNN:1.0 + CH2:1.0 N2:1 + + + + + HNCO + O [=] NH + CO2 + + + 9.800000E+04 + 1.41 + 8500.000000 + + + HNCO:1.0 O:1 + NH:1.0 CO2:1 + + + + + HNCO + O [=] HNO + CO + + + 1.500000E+05 + 1.57 + 44000.000000 + + + HNCO:1.0 O:1 + CO:1 HNO:1.0 + + + + + HNCO + O [=] NCO + OH + + + 2.200000E+03 + 2.11 + 11400.000000 + + + HNCO:1.0 O:1 + OH:1 NCO:1.0 + + + + + HNCO + H [=] NH2 + CO + + + 2.250000E+04 + 1.7 + 3800.000000 + + + HNCO:1.0 H:1 + CO:1 NH2:1.0 + + + + + HNCO + H [=] H2 + NCO + + + 1.050000E+02 + 2.5 + 13300.000000 + + + HNCO:1.0 H:1 + H2:1.0 NCO:1 + + + + + HNCO + OH [=] NCO + H2O + + + 4.650000E+09 + 0 + 6850.000000 + + + HNCO:1.0 OH:1 + H2O:1 NCO:1.0 + + + + + HNCO + OH [=] NH2 + CO2 + + + 1.550000E+09 + 0 + 6850.000000 + + + HNCO:1.0 OH:1 + CO2:1 NH2:1.0 + + + + + HNCO + M [=] NH + CO + M + + + 1.180000E+13 + 0 + 84720.000000 + + AR:0.7 C2H6:3 CH4:2 CO:1.5 CO2:2 H2:2 H2O:6 + + HNCO:1.0 + NH:1.0 CO:1 + + + + + HCNO + H [=] H + HNCO + + + 2.100000E+12 + -0.69 + 2850.000000 + + + H:1 HCNO:1.0 + HNCO:1 H:1.0 + + + + + HCNO + H [=] OH + HCN + + + 2.700000E+08 + 0.18 + 2120.000000 + + + H:1 HCNO:1.0 + HCN:1 OH:1.0 + + + + + HCNO + H [=] NH2 + CO + + + 1.700000E+11 + -0.75 + 2890.000000 + + + H:1 HCNO:1.0 + CO:1 NH2:1.0 + + + + + HOCN + H [=] H + HNCO + + + 2.000000E+04 + 2 + 2000.000000 + + + HOCN:1.0 H:1 + HNCO:1 H:1.0 + + + + + HCCO + NO [=] HCNO + CO + + + 2.350000E+10 + 0 + 0.000000 + + + HCCO:1.0 NO:1 + CO:1 HCNO:1.0 + + + + + CH3 + N [=] H2CN + H + + + 6.100000E+11 + -0.31 + 290.000000 + + + CH3:1.0 N:1 + H:1 H2CN:1.0 + + + + + CH3 + N [=] HCN + H2 + + + 3.700000E+09 + 0.15 + -90.000000 + + + CH3:1.0 N:1 + H2:1 HCN:1.0 + + + + + NH3 + H [=] NH2 + H2 + + + 5.400000E+02 + 2.4 + 9915.000000 + + + H:1 NH3:1.0 + H2:1 NH2:1.0 + + + + + NH3 + OH [=] NH2 + H2O + + + 5.000000E+04 + 1.6 + 955.000000 + + + NH3:1.0 OH:1 + H2O:1 NH2:1.0 + + + + + NH3 + O [=] NH2 + OH + + + 9.400000E+03 + 1.94 + 6460.000000 + + + O:1 NH3:1.0 + OH:1 NH2:1.0 + + + diff --git a/demos/PFR/Gas/Gas_PFR.yaml b/demos/PFR/Gas/Gas_PFR.yaml new file mode 100644 index 0000000..4e30a7f --- /dev/null +++ b/demos/PFR/Gas/Gas_PFR.yaml @@ -0,0 +1,36 @@ +Cantera: + GroupName: h2-burke + InputFile: h2-burke.xml +ReactionInGas: True +InitialConditions: +- value: 1000 + variable: T +- value: 101325 + variable: p +- value: 0.295774648 + variable: X_H2 +- value: 0.147887324 + variable: X_O2 +- value: 0.556338028 + variable: X_N2 +- value: 0.5 + variable: u +Output: + dualtime_interval: 1 + time_interval: 1 + Fields: + - name: ds + - name: p +TimeIntegrator: + dsInitial: 1e-10 + GESAT_Max: 1e2 + GESAT_Ramp: 1.1 + GESAT_Safety: 0.1 + end_time: 8e-4 + timestep: 1e-7 + tolerance: 1e-5 +ReactorParameters: + ReactorType: PFR + ReactorShape: Cylinder + Radius: 0.001 + Height: 0.001 diff --git a/demos/PFR/Gas/h2-burke.xml b/demos/PFR/Gas/h2-burke.xml new file mode 100644 index 0000000..f0622bd --- /dev/null +++ b/demos/PFR/Gas/h2-burke.xml @@ -0,0 +1,708 @@ + + + + + + + H O N Ar He C + + H H2 O OH H2O O2 HO2 H2O2 N2 AR + HE + + + 300.0 + 101325.0 + + + + + + + + + + + + H:1 + 120186 + + + + 2.500000000E+00, 0.000000000E+00, 0.000000000E+00, 0.000000000E+00, + 0.000000000E+00, 2.547163000E+04, -4.601176000E-01 + + + + 2.500000000E+00, 0.000000000E+00, 0.000000000E+00, 0.000000000E+00, + 0.000000000E+00, 2.547163000E+04, -4.601176000E-01 + + + + atom + 145.000 + 2.050 + 0.000 + 0.000 + 0.000 + + + + + + H:2 + 121286 + + + + 3.298124000E+00, 8.249442000E-04, -8.143015000E-07, -9.475434000E-11, + 4.134872000E-13, -1.012521000E+03, -3.294094000E+00 + + + + 2.991423000E+00, 7.000644000E-04, -5.633829000E-08, -9.231578000E-12, + 1.582752000E-15, -8.350340000E+02, -1.355110000E+00 + + + + linear + 38.000 + 2.920 + 0.000 + 0.790 + 280.000 + + + + + + O:1 + 120186 + + + + 2.946429000E+00, -1.638166000E-03, 2.421032000E-06, -1.602843000E-09, + 3.890696000E-13, 2.914764000E+04, 2.963995000E+00 + + + + 2.542060000E+00, -2.755062000E-05, -3.102803000E-09, 4.551067000E-12, + -4.368052000E-16, 2.923080000E+04, 4.920308000E+00 + + + + atom + 80.000 + 2.750 + 0.000 + 0.000 + 0.000 + + + + + + H:1 O:1 + S 9/01 + + + + 4.125305610E+00, -3.225449390E-03, 6.527646910E-06, -5.798536430E-09, + 2.062373790E-12, 3.346309130E+03, -6.904329600E-01 + + + + 2.864728860E+00, 1.056504480E-03, -2.590827580E-07, 3.052186740E-11, + -1.331958760E-15, 3.683628750E+03, 5.701640730E+00 + + + + linear + 80.000 + 2.750 + 0.000 + 0.000 + 0.000 + + + + + + H:2 O:1 + 20387 + + + + 3.386842000E+00, 3.474982000E-03, -6.354696000E-06, 6.968581000E-09, + -2.506588000E-12, -3.020811000E+04, 2.590233000E+00 + + + + 2.672146000E+00, 3.056293000E-03, -8.730260000E-07, 1.200996000E-10, + -6.391618000E-15, -2.989921000E+04, 6.862817000E+00 + + + + nonlinear + 572.400 + 2.605 + 1.844 + 0.000 + 4.000 + + + + + + O:2 + 121386 + + + + 3.212936000E+00, 1.127486000E-03, -5.756150000E-07, 1.313877000E-09, + -8.768554000E-13, -1.005249000E+03, 6.034738000E+00 + + + + 3.697578000E+00, 6.135197000E-04, -1.258842000E-07, 1.775281000E-11, + -1.136435000E-15, -1.233930000E+03, 3.189166000E+00 + + + + linear + 107.400 + 3.458 + 0.000 + 1.600 + 3.800 + + + + + + H:1 O:2 + L 5/89 + + + + 4.301798010E+00, -4.749120510E-03, 2.115828910E-05, -2.427638940E-08, + 9.292251240E-12, 2.948080400E+02, 3.716662450E+00 + + + + 4.017210900E+00, 2.239820130E-03, -6.336581500E-07, 1.142463700E-10, + -1.079085350E-14, 1.118567130E+02, 3.785102150E+00 + + + + nonlinear + 107.400 + 3.458 + 0.000 + 0.000 + 1.000 + + + + + + H:2 O:2 + 120186 + + + + 3.388754000E+00, 6.569226000E-03, -1.485013000E-07, -4.625806000E-09, + 2.471515000E-12, -1.766315000E+04, 6.785363000E+00 + + + + 4.573167000E+00, 4.336136000E-03, -1.474689000E-06, 2.348904000E-10, + -1.431654000E-14, -1.800696000E+04, 5.011370000E-01 + + + + nonlinear + 107.400 + 3.458 + 0.000 + 0.000 + 3.800 + + + + + + N:2 + 121286 + + + + 3.298677000E+00, 1.408240000E-03, -3.963222000E-06, 5.641515000E-09, + -2.444855000E-12, -1.020900000E+03, 3.950372000E+00 + + + + 2.926640000E+00, 1.487977000E-03, -5.684761000E-07, 1.009704000E-10, + -6.753351000E-15, -9.227977000E+02, 5.980528000E+00 + + + + linear + 97.530 + 3.621 + 0.000 + 1.760 + 4.000 + + + + + + Ar:1 + 120186 + + + + 2.500000000E+00, 0.000000000E+00, 0.000000000E+00, 0.000000000E+00, + 0.000000000E+00, -7.453750000E+02, 4.366001000E+00 + + + + 2.500000000E+00, 0.000000000E+00, 0.000000000E+00, 0.000000000E+00, + 0.000000000E+00, -7.453750000E+02, 4.366001000E+00 + + + + atom + 136.500 + 3.330 + 0.000 + 0.000 + 0.000 + + + + + + He:1 + 120186 + + + + 2.500000000E+00, 0.000000000E+00, 0.000000000E+00, 0.000000000E+00, + 0.000000000E+00, -7.453750000E+02, 9.153488000E-01 + + + + 2.500000000E+00, 0.000000000E+00, 0.000000000E+00, 0.000000000E+00, + 0.000000000E+00, -7.453750000E+02, 9.153489000E-01 + + + + atom + 10.200 + 2.576 + 0.000 + 0.000 + 0.000 + + + + + + + + H + O2 [=] O + OH + + + 1.040000E+11 + 0 + 15286.000000 + + + H:1.0 O2:1 + O:1.0 OH:1 + + + + + O + H2 [=] H + OH + + + 3.818000E+09 + 0 + 7948.000000 + + + H2:1 O:1.0 + H:1.0 OH:1 + + + + + O + H2 [=] H + OH + + + 8.792000E+11 + 0 + 19170.000000 + + + H2:1 O:1.0 + H:1.0 OH:1 + + + + + H2 + OH [=] H2O + H + + + 2.160000E+05 + 1.51 + 3430.000000 + + + H2:1.0 OH:1 + H:1 H2O:1.0 + + + + + OH + OH [=] O + H2O + + + 3.340000E+01 + 2.42 + -1930.000000 + + + OH:2.0 + H2O:1 O:1.0 + + + + + H2 + M [=] H + H + M + + + 4.577000E+16 + -1.4 + 104380.000000 + + AR:0 H2:2.5 H2O:12 HE:0 + + H2:1.0 + H:2.0 + + + + + H2 + AR [=] H + H + AR + + + 5.840000E+15 + -1.1 + 104380.000000 + + + H2:1.0 AR:1 + H:2.0 AR:1 + + + + + H2 + HE [=] H + H + HE + + + 5.840000E+15 + -1.1 + 104380.000000 + + + H2:1.0 HE:1 + H:2.0 HE:1 + + + + + O + O + M [=] O2 + M + + + 6.165000E+09 + -0.5 + 0.000000 + + AR:0 H2:2.5 H2O:12 HE:0 + + O:2.0 + O2:1.0 + + + + + O + O + AR [=] O2 + AR + + + 1.886000E+07 + 0 + -1788.000000 + + + AR:1 O:2.0 + AR:1 O2:1.0 + + + + + O + O + HE [=] O2 + HE + + + 1.886000E+07 + 0 + -1788.000000 + + + O:2.0 HE:1 + O2:1.0 HE:1 + + + + + O + H + M [=] OH + M + + + 4.714000E+12 + -1 + 0.000000 + + AR:0.75 H2:2.5 H2O:12 HE:0.75 + + H:1 O:1.0 + OH:1.0 + + + + + H2O + M [=] H + OH + M + + + 6.064000E+24 + -3.322 + 120790.000000 + + H2:3 H2O:0 HE:1.1 N2:2 O2:1.5 + + H2O:1.0 + H:1.0 OH:1 + + + + + H2O + H2O [=] H + OH + H2O + + + 1.006000E+23 + -2.44 + 120180.000000 + + + H2O:2.0 + H:1.0 H2O:1 OH:1 + + + + + H + O2 (+ M) [=] HO2 (+ M) + + + 4.650840E+09 + 0.44 + 0.000000 + + + 6.366000E+14 + -1.72 + 524.800000 + + AR:0.67 H2:2 H2O:14 HE:0.8 O2:0.78 + 0.5 1e-30 1e+30 + + H:1.0 O2:1 + HO2:1.0 + + + + + HO2 + H [=] H2 + O2 + + + 2.750000E+03 + 2.09 + -1451.000000 + + + H:1 HO2:1.0 + H2:1.0 O2:1 + + + + + HO2 + H [=] OH + OH + + + 7.079000E+10 + 0 + 295.000000 + + + H:1 HO2:1.0 + OH:2.0 + + + + + HO2 + O [=] O2 + OH + + + 2.850000E+07 + 1 + -723.930000 + + + HO2:1.0 O:1 + O2:1.0 OH:1 + + + + + HO2 + OH [=] H2O + O2 + + + 2.890000E+10 + 0 + -497.000000 + + + HO2:1.0 OH:1 + H2O:1.0 O2:1 + + + + + HO2 + HO2 [=] H2O2 + O2 + + + 4.200000E+11 + 0 + 11982.000000 + + + HO2:2.0 + H2O2:1.0 O2:1 + + + + + HO2 + HO2 [=] H2O2 + O2 + + + 1.300000E+08 + 0 + -1629.300000 + + + HO2:2.0 + H2O2:1.0 O2:1 + + + + + H2O2 (+ M) [=] OH + OH (+ M) + + + 2.000000E+12 + 0.9 + 48749.000000 + + + 2.490000E+21 + -2.3 + 48749.000000 + + H2:3.7 H2O:7.5 H2O2:7.7 HE:0.65 N2:1.5 O2:1.2 + 0.43 1e-30 1e+30 + + H2O2:1.0 + OH:2.0 + + + + + H2O2 + H [=] H2O + OH + + + 2.410000E+10 + 0 + 3970.000000 + + + H:1 H2O2:1.0 + H2O:1.0 OH:1 + + + + + H2O2 + H [=] HO2 + H2 + + + 4.820000E+10 + 0 + 7950.000000 + + + H:1 H2O2:1.0 + H2:1 HO2:1.0 + + + + + H2O2 + O [=] OH + HO2 + + + 9.550000E+03 + 2 + 3970.000000 + + + H2O2:1.0 O:1 + HO2:1 OH:1.0 + + + + + H2O2 + OH [=] HO2 + H2O + + + 1.740000E+09 + 0 + 318.000000 + + + H2O2:1.0 OH:1 + H2O:1 HO2:1.0 + + + + + H2O2 + OH [=] HO2 + H2O + + + 7.590000E+10 + 0 + 7270.000000 + + + H2O2:1.0 OH:1 + H2O:1 HO2:1.0 + + + diff --git a/demos/ParticleHeatUp/ParticleHeatUp.yaml b/demos/ParticleHeatUp/ParticleHeatUp.yaml index 0734fab..dd62339 100644 --- a/demos/ParticleHeatUp/ParticleHeatUp.yaml +++ b/demos/ParticleHeatUp/ParticleHeatUp.yaml @@ -38,7 +38,7 @@ TimeIntegrator: # timestep: 1e-6 tolerance: 1e-8 ReactorParameters: - ReactorType: ConstantPressure + ReactorType: PSRConstantPressure Radius: 0.1 Particles: ParticleType: Solid @@ -49,27 +49,20 @@ Particles: variable: rho_part_init - value: 4200 variable: cp_part_init -# - value: 0 -# variable: moist_mass_coal_init InflowConditions: - value: 1000 variable: T_part_inflow - value: 1000 variable: rho_part_inflow - NumberOfParticles: 6 - NumberOfParticlesInflow: 12 + ParticleLoading: 6 + ParticleLoadingInflow: 12 Size: Distribution: Uniform Upper: 10e-5 Lower: 5e-5 -# Distribution: Identity -# Value: 1e-4 -# Distribution: UserDefinedList -# Values: [1e-4, 1e-5] -# Numbers: [1, 2] ParticleParameters: RadiationWithWall: OFF EmissivityPart: 0.01 RadiationTemperature: 1200 FlowParameters: - KolmogorovScale: 1e-7 + ReynoldsNumber: 2e4 diff --git a/demos/diff_mechanisms/methane.yaml b/demos/diff_mechanisms/methane.yaml index aa782ca..ab8672b 100644 --- a/demos/diff_mechanisms/methane.yaml +++ b/demos/diff_mechanisms/methane.yaml @@ -36,4 +36,4 @@ Output: - name: p_inflow Restart: False ReactorParameters: - ReactorType: ConstantVolume + ReactorType: PSRConstantVolume diff --git a/demos/diff_mechanisms/syngas.yaml b/demos/diff_mechanisms/syngas.yaml index 3ad3724..4ebd2c9 100644 --- a/demos/diff_mechanisms/syngas.yaml +++ b/demos/diff_mechanisms/syngas.yaml @@ -40,4 +40,4 @@ Output: - name: p_inflow Restart: False ReactorParameters: - ReactorType: ConstantVolume + ReactorType: PSRConstantVolume diff --git a/rtests/inputs/steady_cp_ad_closed__1pt.yaml b/rtests/inputs/steady_cp_ad_closed__1pt.yaml index ff7f6a0..0312c21 100644 --- a/rtests/inputs/steady_cp_ad_closed__1pt.yaml +++ b/rtests/inputs/steady_cp_ad_closed__1pt.yaml @@ -49,5 +49,5 @@ TimeIntegrator: tolerance: 1.e-12 ReactorParameters: - ReactorType: ConstantPressure + ReactorType: PSRConstantPressure diff --git a/rtests/inputs/steady_cp_ad_open__1pt.yaml b/rtests/inputs/steady_cp_ad_open__1pt.yaml index e58b21e..0bb4a45 100644 --- a/rtests/inputs/steady_cp_ad_open__1pt.yaml +++ b/rtests/inputs/steady_cp_ad_open__1pt.yaml @@ -33,4 +33,4 @@ TimeIntegrator: tolerance: 1.e-12 ReactorParameters: - ReactorType: ConstantPressure \ No newline at end of file + ReactorType: PSRConstantPressure \ No newline at end of file diff --git a/rtests/inputs/steady_cp_conv_open__1pt.yaml b/rtests/inputs/steady_cp_conv_open__1pt.yaml index 6dfcf88..7aa87c9 100644 --- a/rtests/inputs/steady_cp_conv_open__1pt.yaml +++ b/rtests/inputs/steady_cp_conv_open__1pt.yaml @@ -24,7 +24,7 @@ InflowConditions: variable: X_N2_inflow ReactorParameters: - ReactorType: ConstantPressure + ReactorType: PSRConstantPressure Radius: 1.e-3 HeatTransferParameter: HeatTransferCoefficient: 1.e1 diff --git a/rtests/inputs/steady_cp_conv_open__Tsurroundvar.yaml b/rtests/inputs/steady_cp_conv_open__Tsurroundvar.yaml index a9dc406..8f08179 100644 --- a/rtests/inputs/steady_cp_conv_open__Tsurroundvar.yaml +++ b/rtests/inputs/steady_cp_conv_open__Tsurroundvar.yaml @@ -24,7 +24,7 @@ InflowConditions: variable: X_N2_inflow ReactorParameters: - ReactorType: ConstantPressure + ReactorType: PSRConstantPressure Radius: 1.e-3 HeatTransferParameter: HeatTransferCoefficient: 1.e1 diff --git a/rtests/inputs/steady_cp_conv_open__hConvecvar.yaml b/rtests/inputs/steady_cp_conv_open__hConvecvar.yaml index db05578..e6ce2be 100644 --- a/rtests/inputs/steady_cp_conv_open__hConvecvar.yaml +++ b/rtests/inputs/steady_cp_conv_open__hConvecvar.yaml @@ -24,7 +24,7 @@ InflowConditions: variable: X_N2_inflow ReactorParameters: - ReactorType: ConstantPressure + ReactorType: PSRConstantPressure Radius: 1.e-3 HeatTransferParameter: HeatTransferCoefficient: diff --git a/rtests/inputs/steady_cv_ad_closed__1pt.yaml b/rtests/inputs/steady_cv_ad_closed__1pt.yaml index 8f47c0e..5df550d 100644 --- a/rtests/inputs/steady_cv_ad_closed__1pt.yaml +++ b/rtests/inputs/steady_cv_ad_closed__1pt.yaml @@ -51,5 +51,5 @@ TimeIntegrator: tolerance: 1.e-12 ReactorParameters: - ReactorType: ConstantVolume + ReactorType: PSRConstantVolume diff --git a/rtests/inputs/steady_cv_ad_closed__Tpzvar.yaml b/rtests/inputs/steady_cv_ad_closed__Tpzvar.yaml index 2e2dd43..5a46ca4 100644 --- a/rtests/inputs/steady_cv_ad_closed__Tpzvar.yaml +++ b/rtests/inputs/steady_cv_ad_closed__Tpzvar.yaml @@ -44,4 +44,4 @@ TimeIntegrator: tolerance: 1.e-9 ReactorParameters: - ReactorType: ConstantVolume \ No newline at end of file + ReactorType: PSRConstantVolume \ No newline at end of file diff --git a/rtests/inputs/steady_cv_ad_closed__Tvar.yaml b/rtests/inputs/steady_cv_ad_closed__Tvar.yaml index 2f516a5..916ba22 100644 --- a/rtests/inputs/steady_cv_ad_closed__Tvar.yaml +++ b/rtests/inputs/steady_cv_ad_closed__Tvar.yaml @@ -38,4 +38,4 @@ TimeIntegrator: tolerance: 1.e-12 ReactorParameters: - ReactorType: ConstantVolume \ No newline at end of file + ReactorType: PSRConstantVolume \ No newline at end of file diff --git a/rtests/inputs/steady_cv_ad_closed__pvar.yaml b/rtests/inputs/steady_cv_ad_closed__pvar.yaml index ae2f38f..ad80256 100644 --- a/rtests/inputs/steady_cv_ad_closed__pvar.yaml +++ b/rtests/inputs/steady_cv_ad_closed__pvar.yaml @@ -38,5 +38,5 @@ TimeIntegrator: tolerance: 1.e-12 ReactorParameters: - ReactorType: ConstantVolume + ReactorType: PSRConstantVolume diff --git a/rtests/inputs/steady_cv_ad_closed__zvar.yaml b/rtests/inputs/steady_cv_ad_closed__zvar.yaml index 63441b9..689139c 100644 --- a/rtests/inputs/steady_cv_ad_closed__zvar.yaml +++ b/rtests/inputs/steady_cv_ad_closed__zvar.yaml @@ -38,4 +38,4 @@ TimeIntegrator: tolerance: 1.e-12 ReactorParameters: - ReactorType: ConstantVolume \ No newline at end of file + ReactorType: PSRConstantVolume \ No newline at end of file diff --git a/rtests/inputs/steady_cv_ad_open__1pt.yaml b/rtests/inputs/steady_cv_ad_open__1pt.yaml index 786e555..8c21577 100644 --- a/rtests/inputs/steady_cv_ad_open__1pt.yaml +++ b/rtests/inputs/steady_cv_ad_open__1pt.yaml @@ -35,4 +35,4 @@ TimeIntegrator: tolerance: 1.e-12 ReactorParameters: - ReactorType: ConstantVolume \ No newline at end of file + ReactorType: PSRConstantVolume \ No newline at end of file diff --git a/rtests/inputs/steady_cv_ad_open__Tpzvar.yaml b/rtests/inputs/steady_cv_ad_open__Tpzvar.yaml index c640d25..afae1eb 100644 --- a/rtests/inputs/steady_cv_ad_open__Tpzvar.yaml +++ b/rtests/inputs/steady_cv_ad_open__Tpzvar.yaml @@ -44,4 +44,4 @@ TimeIntegrator: tolerance: 1.e-12 ReactorParameters: - ReactorType: ConstantVolume \ No newline at end of file + ReactorType: PSRConstantVolume \ No newline at end of file diff --git a/rtests/inputs/steady_cv_ad_open__Tvar.yaml b/rtests/inputs/steady_cv_ad_open__Tvar.yaml index 365f456..57a65fc 100644 --- a/rtests/inputs/steady_cv_ad_open__Tvar.yaml +++ b/rtests/inputs/steady_cv_ad_open__Tvar.yaml @@ -38,4 +38,4 @@ TimeIntegrator: tolerance: 1.e-12 ReactorParameters: - ReactorType: ConstantVolume \ No newline at end of file + ReactorType: PSRConstantVolume \ No newline at end of file diff --git a/rtests/inputs/steady_cv_ad_open__pvar.yaml b/rtests/inputs/steady_cv_ad_open__pvar.yaml index 68555ed..f986953 100644 --- a/rtests/inputs/steady_cv_ad_open__pvar.yaml +++ b/rtests/inputs/steady_cv_ad_open__pvar.yaml @@ -38,4 +38,4 @@ TimeIntegrator: tolerance: 1.e-12 ReactorParameters: - ReactorType: ConstantVolume \ No newline at end of file + ReactorType: PSRConstantVolume \ No newline at end of file diff --git a/rtests/inputs/steady_cv_ad_open__zvar.yaml b/rtests/inputs/steady_cv_ad_open__zvar.yaml index fb4a068..616aaaa 100644 --- a/rtests/inputs/steady_cv_ad_open__zvar.yaml +++ b/rtests/inputs/steady_cv_ad_open__zvar.yaml @@ -38,4 +38,4 @@ TimeIntegrator: tolerance: 1.e-12 ReactorParameters: - ReactorType: ConstantVolume \ No newline at end of file + ReactorType: PSRConstantVolume \ No newline at end of file diff --git a/rtests/inputs/steady_cv_conv_open__1pt.yaml b/rtests/inputs/steady_cv_conv_open__1pt.yaml index 4aaea5d..a389505 100644 --- a/rtests/inputs/steady_cv_conv_open__1pt.yaml +++ b/rtests/inputs/steady_cv_conv_open__1pt.yaml @@ -24,7 +24,7 @@ InflowConditions: variable: X_N2_inflow ReactorParameters: - ReactorType: ConstantVolume + ReactorType: PSRConstantVolume Radius: 1.e-3 HeatTransferParameter: HeatTransferCoefficient: 1.e1 diff --git a/rtests/inputs/steady_cv_conv_open__Tpzvar.yaml b/rtests/inputs/steady_cv_conv_open__Tpzvar.yaml index 542d0a2..50d6ed2 100644 --- a/rtests/inputs/steady_cv_conv_open__Tpzvar.yaml +++ b/rtests/inputs/steady_cv_conv_open__Tpzvar.yaml @@ -33,7 +33,7 @@ InflowConditions: composition: unreacted ReactorParameters: - ReactorType: ConstantVolume + ReactorType: PSRConstantVolume Radius: 1.e-3 HeatTransferParameter: HeatTransferCoefficient: 1.e1 diff --git a/rtests/inputs/steady_cv_conv_open__Tsurroundvar.yaml b/rtests/inputs/steady_cv_conv_open__Tsurroundvar.yaml index 65cdf3c..a7f0ba4 100644 --- a/rtests/inputs/steady_cv_conv_open__Tsurroundvar.yaml +++ b/rtests/inputs/steady_cv_conv_open__Tsurroundvar.yaml @@ -24,7 +24,7 @@ InflowConditions: variable: X_N2_inflow ReactorParameters: - ReactorType: ConstantVolume + ReactorType: PSRConstantVolume Radius: 1.e-3 HeatTransferParameter: HeatTransferCoefficient: 1.e1 diff --git a/rtests/inputs/steady_cv_conv_open__Tvar.yaml b/rtests/inputs/steady_cv_conv_open__Tvar.yaml index bb1ef29..a071a5d 100644 --- a/rtests/inputs/steady_cv_conv_open__Tvar.yaml +++ b/rtests/inputs/steady_cv_conv_open__Tvar.yaml @@ -27,7 +27,7 @@ InflowConditions: variable: X_N2_inflow ReactorParameters: - ReactorType: ConstantVolume + ReactorType: PSRConstantVolume Radius: 1.e-3 HeatTransferParameter: HeatTransferCoefficient: 1.e1 diff --git a/rtests/inputs/steady_cv_conv_open__hConvecvar.yaml b/rtests/inputs/steady_cv_conv_open__hConvecvar.yaml index 5c1540d..d2bb122 100644 --- a/rtests/inputs/steady_cv_conv_open__hConvecvar.yaml +++ b/rtests/inputs/steady_cv_conv_open__hConvecvar.yaml @@ -24,7 +24,7 @@ InflowConditions: variable: X_N2_inflow ReactorParameters: - ReactorType: ConstantVolume + ReactorType: PSRConstantVolume Radius: 1.e-3 HeatTransferParameter: HeatTransferCoefficient: diff --git a/rtests/inputs/steady_cv_conv_open__pvar.yaml b/rtests/inputs/steady_cv_conv_open__pvar.yaml index b44b8da..0ea1b42 100644 --- a/rtests/inputs/steady_cv_conv_open__pvar.yaml +++ b/rtests/inputs/steady_cv_conv_open__pvar.yaml @@ -27,7 +27,7 @@ InflowConditions: variable: X_N2_inflow ReactorParameters: - ReactorType: ConstantVolume + ReactorType: PSRConstantVolume Radius: 1.e-3 HeatTransferParameter: HeatTransferCoefficient: 1.e1 diff --git a/rtests/inputs/steady_cv_conv_open__zvar.yaml b/rtests/inputs/steady_cv_conv_open__zvar.yaml index 3109cdf..75c9808 100644 --- a/rtests/inputs/steady_cv_conv_open__zvar.yaml +++ b/rtests/inputs/steady_cv_conv_open__zvar.yaml @@ -27,7 +27,7 @@ InflowConditions: composition: unreacted ReactorParameters: - ReactorType: ConstantVolume + ReactorType: PSRConstantVolume Radius: 1.e-3 HeatTransferParameter: HeatTransferCoefficient: 1.e1 diff --git a/rtests/inputs/transient_cp_ad_closed__1pt.yaml b/rtests/inputs/transient_cp_ad_closed__1pt.yaml index ce74677..c77283b 100644 --- a/rtests/inputs/transient_cp_ad_closed__1pt.yaml +++ b/rtests/inputs/transient_cp_ad_closed__1pt.yaml @@ -51,4 +51,4 @@ TimeIntegrator: end_time: 1.e-4 ReactorParameters: - ReactorType: ConstantPressure \ No newline at end of file + ReactorType: PSRConstantPressure \ No newline at end of file diff --git a/rtests/inputs/transient_cp_ad_open__1pt.yaml b/rtests/inputs/transient_cp_ad_open__1pt.yaml index 4c582fc..c894099 100644 --- a/rtests/inputs/transient_cp_ad_open__1pt.yaml +++ b/rtests/inputs/transient_cp_ad_open__1pt.yaml @@ -51,4 +51,4 @@ TimeIntegrator: end_time: 1.e-2 ReactorParameters: - ReactorType: ConstantPressure \ No newline at end of file + ReactorType: PSRConstantPressure \ No newline at end of file diff --git a/rtests/inputs/transient_cp_conv_open__1pt.yaml b/rtests/inputs/transient_cp_conv_open__1pt.yaml index 8a61459..8b701b3 100644 --- a/rtests/inputs/transient_cp_conv_open__1pt.yaml +++ b/rtests/inputs/transient_cp_conv_open__1pt.yaml @@ -40,7 +40,7 @@ InitialConditions: variable: X_N2 ReactorParameters: - ReactorType: ConstantPressure + ReactorType: PSRConstantPressure Radius: 1.e-3 HeatTransferParameter: HeatTransferCoefficient: 1.e1 diff --git a/rtests/inputs/transient_cp_conv_open__Tsurroundvar.yaml b/rtests/inputs/transient_cp_conv_open__Tsurroundvar.yaml index d0f2598..e321862 100644 --- a/rtests/inputs/transient_cp_conv_open__Tsurroundvar.yaml +++ b/rtests/inputs/transient_cp_conv_open__Tsurroundvar.yaml @@ -40,7 +40,7 @@ InitialConditions: variable: X_N2 ReactorParameters: - ReactorType: ConstantPressure + ReactorType: PSRConstantPressure Radius: 1.e-3 HeatTransferParameter: HeatTransferCoefficient: 1.e1 diff --git a/rtests/inputs/transient_cp_conv_open__hConvecvar.yaml b/rtests/inputs/transient_cp_conv_open__hConvecvar.yaml index 9594694..8f1af3a 100644 --- a/rtests/inputs/transient_cp_conv_open__hConvecvar.yaml +++ b/rtests/inputs/transient_cp_conv_open__hConvecvar.yaml @@ -40,7 +40,7 @@ InitialConditions: variable: X_N2 ReactorParameters: - ReactorType: ConstantPressure + ReactorType: PSRConstantPressure Radius: 1.e-3 HeatTransferParameter: HeatTransferCoefficient: diff --git a/rtests/inputs/transient_cp_liquid_particle.yaml b/rtests/inputs/transient_cp_liquid_particle.yaml index 316c6f5..5e350fd 100644 --- a/rtests/inputs/transient_cp_liquid_particle.yaml +++ b/rtests/inputs/transient_cp_liquid_particle.yaml @@ -28,7 +28,7 @@ TimeIntegrator: timestep: 1e-4 tolerance: 1e-8 ReactorParameters: - ReactorType: ConstantPressure + ReactorType: PSRConstantPressure Radius: 0.1 Particles: ParticleType: Liquid diff --git a/rtests/inputs/transient_cp_particle_heatup.yaml b/rtests/inputs/transient_cp_particle_heatup.yaml index 6e90594..86fc92a 100644 --- a/rtests/inputs/transient_cp_particle_heatup.yaml +++ b/rtests/inputs/transient_cp_particle_heatup.yaml @@ -28,7 +28,7 @@ TimeIntegrator: timestep: 8e-4 tolerance: 1e-8 ReactorParameters: - ReactorType: ConstantPressure + ReactorType: PSRConstantPressure Radius: 0.1 Particles: ParticleType: Solid diff --git a/rtests/inputs/transient_cv_ad_closed__1pt.yaml b/rtests/inputs/transient_cv_ad_closed__1pt.yaml index 754a4e5..ea7cbd0 100644 --- a/rtests/inputs/transient_cv_ad_closed__1pt.yaml +++ b/rtests/inputs/transient_cv_ad_closed__1pt.yaml @@ -53,4 +53,4 @@ TimeIntegrator: end_time: 1.e-4 ReactorParameters: - ReactorType: ConstantVolume \ No newline at end of file + ReactorType: PSRConstantVolume \ No newline at end of file diff --git a/rtests/inputs/transient_cv_ad_closed__Tpzvar.yaml b/rtests/inputs/transient_cv_ad_closed__Tpzvar.yaml index d02855b..6975da2 100644 --- a/rtests/inputs/transient_cv_ad_closed__Tpzvar.yaml +++ b/rtests/inputs/transient_cv_ad_closed__Tpzvar.yaml @@ -46,4 +46,4 @@ TimeIntegrator: end_time: 1.e-4 ReactorParameters: - ReactorType: ConstantVolume \ No newline at end of file + ReactorType: PSRConstantVolume \ No newline at end of file diff --git a/rtests/inputs/transient_cv_ad_closed__Tvar.yaml b/rtests/inputs/transient_cv_ad_closed__Tvar.yaml index 553136a..43a89d3 100644 --- a/rtests/inputs/transient_cv_ad_closed__Tvar.yaml +++ b/rtests/inputs/transient_cv_ad_closed__Tvar.yaml @@ -40,4 +40,4 @@ TimeIntegrator: end_time: 1.e-4 ReactorParameters: - ReactorType: ConstantVolume \ No newline at end of file + ReactorType: PSRConstantVolume \ No newline at end of file diff --git a/rtests/inputs/transient_cv_ad_closed__pvar.yaml b/rtests/inputs/transient_cv_ad_closed__pvar.yaml index ccbefa0..6ff5496 100644 --- a/rtests/inputs/transient_cv_ad_closed__pvar.yaml +++ b/rtests/inputs/transient_cv_ad_closed__pvar.yaml @@ -40,4 +40,4 @@ TimeIntegrator: end_time: 1.e-4 ReactorParameters: - ReactorType: ConstantVolume \ No newline at end of file + ReactorType: PSRConstantVolume \ No newline at end of file diff --git a/rtests/inputs/transient_cv_ad_closed__zvar.yaml b/rtests/inputs/transient_cv_ad_closed__zvar.yaml index cde6292..6d82cb6 100644 --- a/rtests/inputs/transient_cv_ad_closed__zvar.yaml +++ b/rtests/inputs/transient_cv_ad_closed__zvar.yaml @@ -40,4 +40,4 @@ TimeIntegrator: end_time: 1.e-4 ReactorParameters: - ReactorType: ConstantVolume \ No newline at end of file + ReactorType: PSRConstantVolume \ No newline at end of file diff --git a/rtests/inputs/transient_cv_ad_open__1pt.yaml b/rtests/inputs/transient_cv_ad_open__1pt.yaml index 52f878d..285ccae 100644 --- a/rtests/inputs/transient_cv_ad_open__1pt.yaml +++ b/rtests/inputs/transient_cv_ad_open__1pt.yaml @@ -53,4 +53,4 @@ TimeIntegrator: end_time: 1.e-2 ReactorParameters: - ReactorType: ConstantVolume \ No newline at end of file + ReactorType: PSRConstantVolume \ No newline at end of file diff --git a/rtests/inputs/transient_cv_ad_open__Tpzvar.yaml b/rtests/inputs/transient_cv_ad_open__Tpzvar.yaml index be62a82..74fccec 100644 --- a/rtests/inputs/transient_cv_ad_open__Tpzvar.yaml +++ b/rtests/inputs/transient_cv_ad_open__Tpzvar.yaml @@ -46,4 +46,4 @@ TimeIntegrator: end_time: 1.e-2 ReactorParameters: - ReactorType: ConstantVolume \ No newline at end of file + ReactorType: PSRConstantVolume \ No newline at end of file diff --git a/rtests/inputs/transient_cv_ad_open__Tvar.yaml b/rtests/inputs/transient_cv_ad_open__Tvar.yaml index 3acdcbc..a628582 100644 --- a/rtests/inputs/transient_cv_ad_open__Tvar.yaml +++ b/rtests/inputs/transient_cv_ad_open__Tvar.yaml @@ -40,4 +40,4 @@ TimeIntegrator: end_time: 1.e-2 ReactorParameters: - ReactorType: ConstantVolume \ No newline at end of file + ReactorType: PSRConstantVolume \ No newline at end of file diff --git a/rtests/inputs/transient_cv_ad_open__pvar.yaml b/rtests/inputs/transient_cv_ad_open__pvar.yaml index d238894..32fc461 100644 --- a/rtests/inputs/transient_cv_ad_open__pvar.yaml +++ b/rtests/inputs/transient_cv_ad_open__pvar.yaml @@ -40,4 +40,4 @@ TimeIntegrator: end_time: 1.e-2 ReactorParameters: - ReactorType: ConstantVolume \ No newline at end of file + ReactorType: PSRConstantVolume \ No newline at end of file diff --git a/rtests/inputs/transient_cv_ad_open__zvar.yaml b/rtests/inputs/transient_cv_ad_open__zvar.yaml index 5a0702f..9b8035f 100644 --- a/rtests/inputs/transient_cv_ad_open__zvar.yaml +++ b/rtests/inputs/transient_cv_ad_open__zvar.yaml @@ -40,4 +40,4 @@ TimeIntegrator: end_time: 1.e-2 ReactorParameters: - ReactorType: ConstantVolume \ No newline at end of file + ReactorType: PSRConstantVolume \ No newline at end of file diff --git a/rtests/inputs/transient_cv_conv_open__1pt.yaml b/rtests/inputs/transient_cv_conv_open__1pt.yaml index bab3037..75d83ce 100644 --- a/rtests/inputs/transient_cv_conv_open__1pt.yaml +++ b/rtests/inputs/transient_cv_conv_open__1pt.yaml @@ -40,7 +40,7 @@ InitialConditions: variable: X_N2 ReactorParameters: - ReactorType: ConstantVolume + ReactorType: PSRConstantVolume Radius: 1.e-3 HeatTransferParameter: HeatTransferCoefficient: 1.e1 diff --git a/rtests/inputs/transient_cv_conv_open__Tpzvar.yaml b/rtests/inputs/transient_cv_conv_open__Tpzvar.yaml index d775792..4b78f51 100644 --- a/rtests/inputs/transient_cv_conv_open__Tpzvar.yaml +++ b/rtests/inputs/transient_cv_conv_open__Tpzvar.yaml @@ -33,7 +33,7 @@ InflowConditions: composition: unreacted ReactorParameters: - ReactorType: ConstantVolume + ReactorType: PSRConstantVolume Radius: 1.e-3 HeatTransferParameter: HeatTransferCoefficient: 1.e1 diff --git a/rtests/inputs/transient_cv_conv_open__Tsurroundvar.yaml b/rtests/inputs/transient_cv_conv_open__Tsurroundvar.yaml index a1cef5a..80ce187 100644 --- a/rtests/inputs/transient_cv_conv_open__Tsurroundvar.yaml +++ b/rtests/inputs/transient_cv_conv_open__Tsurroundvar.yaml @@ -40,7 +40,7 @@ InitialConditions: variable: X_N2 ReactorParameters: - ReactorType: ConstantVolume + ReactorType: PSRConstantVolume Radius: 1.e-3 HeatTransferParameter: HeatTransferCoefficient: 1.e1 diff --git a/rtests/inputs/transient_cv_conv_open__Tvar.yaml b/rtests/inputs/transient_cv_conv_open__Tvar.yaml index 061ce1e..febff51 100644 --- a/rtests/inputs/transient_cv_conv_open__Tvar.yaml +++ b/rtests/inputs/transient_cv_conv_open__Tvar.yaml @@ -27,7 +27,7 @@ InflowConditions: variable: X_N2_inflow ReactorParameters: - ReactorType: ConstantVolume + ReactorType: PSRConstantVolume Radius: 1.e-3 HeatTransferParameter: HeatTransferCoefficient: 1.e1 diff --git a/rtests/inputs/transient_cv_conv_open__hConvecvar.yaml b/rtests/inputs/transient_cv_conv_open__hConvecvar.yaml index 28865f0..ecfc905 100644 --- a/rtests/inputs/transient_cv_conv_open__hConvecvar.yaml +++ b/rtests/inputs/transient_cv_conv_open__hConvecvar.yaml @@ -40,7 +40,7 @@ InitialConditions: variable: X_N2 ReactorParameters: - ReactorType: ConstantVolume + ReactorType: PSRConstantVolume Radius: 1.e-3 HeatTransferParameter: HeatTransferCoefficient: diff --git a/rtests/inputs/transient_cv_conv_open__pvar.yaml b/rtests/inputs/transient_cv_conv_open__pvar.yaml index a6b6ef4..a68d909 100644 --- a/rtests/inputs/transient_cv_conv_open__pvar.yaml +++ b/rtests/inputs/transient_cv_conv_open__pvar.yaml @@ -27,7 +27,7 @@ InflowConditions: variable: X_N2_inflow ReactorParameters: - ReactorType: ConstantVolume + ReactorType: PSRConstantVolume Radius: 1.e-3 HeatTransferParameter: HeatTransferCoefficient: 1.e1 diff --git a/rtests/inputs/transient_cv_conv_open__zvar.yaml b/rtests/inputs/transient_cv_conv_open__zvar.yaml index 346b58e..f4eb778 100644 --- a/rtests/inputs/transient_cv_conv_open__zvar.yaml +++ b/rtests/inputs/transient_cv_conv_open__zvar.yaml @@ -27,7 +27,7 @@ InflowConditions: composition: unreacted ReactorParameters: - ReactorType: ConstantVolume + ReactorType: PSRConstantVolume Radius: 1.e-3 HeatTransferParameter: HeatTransferCoefficient: 1.e1 diff --git a/rtests/inputs/transient_cv_liquid_particle.yaml b/rtests/inputs/transient_cv_liquid_particle.yaml index 002eaa0..ef071b2 100644 --- a/rtests/inputs/transient_cv_liquid_particle.yaml +++ b/rtests/inputs/transient_cv_liquid_particle.yaml @@ -28,7 +28,7 @@ TimeIntegrator: timestep: 1e-4 tolerance: 1e-8 ReactorParameters: - ReactorType: ConstantVolume + ReactorType: PSRConstantVolume Radius: 0.1 Particles: ParticleType: Liquid diff --git a/rtests/inputs/transient_cv_particle_heatup.yaml b/rtests/inputs/transient_cv_particle_heatup.yaml index 2c64046..bf20c08 100644 --- a/rtests/inputs/transient_cv_particle_heatup.yaml +++ b/rtests/inputs/transient_cv_particle_heatup.yaml @@ -28,7 +28,7 @@ TimeIntegrator: timestep: 8e-4 tolerance: 1e-8 ReactorParameters: - ReactorType: ConstantVolume + ReactorType: PSRConstantVolume Radius: 0.1 Particles: ParticleType: Solid diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 43aa9af..108c49e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,6 @@ add_subdirectory( parser ) add_subdirectory( particles ) +add_subdirectory( PlugFlowReactor ) set( TPL_INCLUDES ${TPL_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR}/parser/yaml/include ) set( TPL_LIBRARIES ${TPL_LIBRARIES} yaml-cpp ) diff --git a/src/ConvectiveHeatTransferRate.h b/src/ConvectiveHeatTransferRate.h index c6b90f5..ff991d7 100644 --- a/src/ConvectiveHeatTransferRate.h +++ b/src/ConvectiveHeatTransferRate.h @@ -50,7 +50,7 @@ namespace ReactorEnsembleUtil{ * \f$ T_{\inf} \f$ is the surroundings temperature. * \f$ \frac{A}{V}\f$ is the area/volume ratio of the reactor. * For spherical reactor, \f$ \frac{A}{V}=\frac{3}{r}\f$, with \f$r\f$ represents the reacotr radius. - * For cylinder reactor, \f$ \frac{A}{V}=\frac{2(r+h)}{rh}\f$, + * For cylinder reactor, \f$ \frac{A}{V}=\frac{2}{r}\f$, (only surrounding surface is considered) * with \f$r\f$ and \f$h\f$ represent radius of the circular end of the cylinder and height of the cylinder. * * The sensitivity is given as @@ -139,7 +139,7 @@ namespace ReactorEnsembleUtil{ * \f$ T_{\inf} \f$ is the surroundings temperature. * \f$ \frac{A}{V}\f$ is the area/volume ratio of the reactor. * For spherical reactor, \f$ \frac{A}{V}=\frac{3}{r}\f$, with \f$r\f$ represents the reacotr radius. - * For cylinder reactor, \f$ \frac{A}{V}=\frac{2(r+h)}{rh}\f$, + * For cylinder reactor, \f$ \frac{A}{V}=\frac{2}{r}\f$, (only surrounding surface is considered) * with \f$r\f$ and \f$h\f$ represent radius of the circular end of the cylinder and height of the cylinder. * * The sensitivity is given as @@ -227,6 +227,120 @@ namespace ReactorEnsembleUtil{ } }; + + /** + * @class ConvectionHeatRatePFR + * @ingroup ReactorEnsembleUtil + * @brief Getting the convective heat transfer term between gas phase and surroundings + * in gas phase enthalpy equation for plug flow reactor + * @author Hang + * + * The convective heat transfer term in enthalpy equation for plug flow reactor is give as + * \f[ + * Q_{cov} = k \frac{A}{\rho V u} (T_{\inf} - T) + * \f] + * Here, \f$ k \f$ is the convective coefficient between gas phase and surroundings, + * \f$ T_{\inf} \f$ is the surroundings temperature. + * \f$ \frac{A}{V}\f$ is the area/volume ratio of the reactor. + * \f$ u\f$ is the gas phase velocity in the reactor. + * For spherical reactor, \f$ \frac{A}{V}=\frac{3}{r}\f$, with \f$r\f$ represents the reacotr radius. + * For cylinder reactor, \f$ \frac{A}{V}=\frac{2}{r}\f$, (only surrounding surface is considered) + * with \f$r\f$ represents radius of the circular end of the cylinder. + * + * The sensitivity is given as + * \f[ + * \frac{\partial Q_{cov}}{\partial \phi} = \frac{A}{V} (\frac{\partial k}{\partial \phi}\frac{T_{\inf}-T}{\rho u} + * + \frac{k}{\rho u}(\frac{\partial T_{\inf}}{\partial \phi}-\frac{\partial T}{\partial \phi}) + * - \frac{k}{\rho^2 u}\frac{\partial \rho}{\partial \phi}(T_{\inf}-T) + * - \frac{k}{\rho u^2}\frac{\partial u}{\partial \phi}(T_{\inf}-T)) + * \f] + */ + template + class ConvectionHeatRatePFR : public Expr::Expression { + const double surfaceAreaPerVolume_; + DECLARE_FIELDS( FieldT, temp_, rho_, convCoeff_, convTemp_, u_); + + ConvectionHeatRatePFR( const Expr::Tag tempTag, + const Expr::Tag rhoTag, + const Expr::Tag convectionCoeffTag, + const Expr::Tag convectionTempTag, + const Expr::Tag uTag, + const double surfaceAreaPerVolume) + : Expr::Expression(), + surfaceAreaPerVolume_( surfaceAreaPerVolume){ + this->set_gpu_runnable( true ); + temp_ = this->template create_field_request( tempTag ); + rho_ = this->template create_field_request( rhoTag ); + convCoeff_ = this->template create_field_request( convectionCoeffTag ); + convTemp_ = this->template create_field_request( convectionTempTag ); + u_ = this->template create_field_request( uTag ); + } + + public: + class Builder : public Expr::ExpressionBuilder { + const Expr::Tag tempTag_, rhoTag_, convectionCoeffTag_, convectionTempTag_, uTag_; + const double surfaceAreaPerVolume_; + public: + /** + * @brief The mechanism for building a ConvectionHeatRateCP object + * @tparam FieldT + * @param heatRateTag Convective heat transfer term in gas phase enthalpy equation under constant pressure condition + * @param tempTag Gas phase temperature + * @param rhoTag Gas phase density + * @param convectionCoeffTag Convective heat transfer coefficient between gas phase and surroundings + * @param convectionTempTag Surroundings temperature + * @param uTag Velocity of gas phase + * @param surfaceAreaPerVolume Ratio between surface area and volume of reactor + */ + Builder( const Expr::Tag heatRateTag, + const Expr::Tag tempTag, + const Expr::Tag rhoTag, + const Expr::Tag convectionCoeffTag, + const Expr::Tag convectionTempTag, + const Expr::Tag uTag, + const double surfaceAreaPerVolume) + : Expr::ExpressionBuilder( heatRateTag ), + tempTag_( tempTag ), + rhoTag_( rhoTag ), + convectionCoeffTag_( convectionCoeffTag ), + convectionTempTag_( convectionTempTag ), + uTag_( uTag ), + surfaceAreaPerVolume_( surfaceAreaPerVolume ){} + + ~Builder(){} + + Expr::ExpressionBase* build() const{ + return new ConvectionHeatRatePFR( tempTag_, rhoTag_, convectionCoeffTag_, convectionTempTag_, uTag_, surfaceAreaPerVolume_ ); + } + }; + + void evaluate(){ + using namespace SpatialOps; + const FieldT& temp = temp_->field_ref(); + const FieldT& rho = rho_->field_ref(); + const FieldT& convCoeff = convCoeff_->field_ref(); + const FieldT& convTemp = convTemp_->field_ref(); + const FieldT& u = u_->field_ref(); + this->value() <<= convCoeff * surfaceAreaPerVolume_ /rho/u * (convTemp - temp); + } + + void sensitivity( const Expr::Tag& sensVarTag ){ + FieldT & dfdv = this->sensitivity_result( sensVarTag ); + const FieldT& temp = temp_->field_ref(); + const FieldT& rho = rho_->field_ref(); + const FieldT& convCoeff = convCoeff_->field_ref(); + const FieldT& convTemp = convTemp_->field_ref(); + const FieldT& u = u_->field_ref(); + const FieldT& dTdv = temp_->sens_field_ref( sensVarTag ); + const FieldT& drhodv = rho_->sens_field_ref( sensVarTag ); + const FieldT& dconvCoeffdv = convCoeff_->sens_field_ref( sensVarTag ); + const FieldT& dconvTempdv = convTemp_->sens_field_ref( sensVarTag ); + const FieldT& dudv = u_->sens_field_ref( sensVarTag ); + dfdv <<= surfaceAreaPerVolume_ * ((dconvCoeffdv/rho/u-convCoeff/square(rho)/u*drhodv-convCoeff/square(u)/rho*dudv) * (convTemp - temp) + + convCoeff/rho/u * (dconvTempdv-dTdv)); + } + }; + } // namespace ReactorEnsembleUtil #endif /* CONVECTIVEHEATTRANSFERRATE_H_ */ diff --git a/src/Main.cpp b/src/Main.cpp index 676e6c1..b3be40d 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -53,6 +53,7 @@ namespace po = boost::program_options; #include "TransformationMatrixExpressions.h" #include "RestartFieldWriter.h" +#include #define ASSEMBLER(MatrixT, FieldT, name) \ boost::shared_ptr > name = boost::make_shared >( #name ); @@ -152,7 +153,9 @@ int main( int iarg, char* carg[] ) Expr::ExpressionFactory initFactory; std::set initRoots; - const bool isRestart = parser["restart"]; + const bool isRestart = parser["Restart"]; + const std::string reactorType = parser["ReactorParameters"]["ReactorType"].as(); + int EquIndex = 0; const GridPtr grid = parse_initial_inflow_conditions( parser, initFactory, initRoots, isRestart ); @@ -164,6 +167,7 @@ int main( int iarg, char* carg[] ) const ReactorEnsembleUtil::ReactorEnsembleTags tagsE( Expr::STATE_NONE ); const ReactorEnsembleUtil::ReactorEnsembleTags tagsN( Expr::STATE_N ); + const PlugFlowReactorInterface::PlugFlowReactorTags tagsEpfr( Expr::STATE_NONE ); typedef pokitt::ChemicalSourceJacobian ChemJacT; @@ -173,6 +177,9 @@ int main( int iarg, char* carg[] ) typedef SingleValueField SVFT; Expr::TagList primitiveTags, kinRhsTags; + if(reactorType=="PFR"){ + primitiveTags.push_back( tagsEpfr.uTag ); + } primitiveTags.push_back( tagsE.rhoTag ); primitiveTags.push_back( tagsE.tempTag ); for( size_t i=0; ifactory() ); - if( parser["ReactorParameters"]["ReactorType"].as() == "ConstantVolume" ){ + if( reactorType == "PSRConstantVolume" ){ kinRhsTags.push_back( tagsE.rhoKinRhsTag ); kinRhsTags.push_back( tagsE.rhoEgyKinRhsTag ); for( size_t i = 0;i < nspec - 1;++i ){ @@ -198,10 +205,10 @@ int main( int iarg, char* carg[] ) if(!isRestart){ ReactorEnsembleUtil::setup_cv( initRoots, initFactory, parser); } - ReactorEnsembleUtil::build_equation_system_cv( integrator, csj, parser ); + ReactorEnsembleUtil::build_equation_system_cv( integrator, csj, parser, EquIndex ); } - if( parser["ReactorParameters"]["ReactorType"].as() == "ConstantPressure" ){ + if( reactorType == "PSRConstantPressure" ){ kinRhsTags.push_back( tagsE.presKinRhsTag ); kinRhsTags.push_back( tagsE.enthKinRhsTag ); for( size_t i = 0;i < nspec - 1;++i ){ @@ -211,11 +218,24 @@ int main( int iarg, char* carg[] ) if(!isRestart){ ReactorEnsembleUtil::setup_cp( initRoots, initFactory, parser); } - ReactorEnsembleUtil::build_equation_system_cp( integrator, csj, parser); + ReactorEnsembleUtil::build_equation_system_cp( integrator, csj, parser, EquIndex); + } + + if( reactorType == "PFR" ){ + kinRhsTags.push_back( tagsEpfr.uFullRhsTag ); + kinRhsTags.push_back( tagsE.rhoFullRhsTag ); + kinRhsTags.push_back( tagsE.enthFullRhsTag ); + for( size_t i = 0;i < nspec - 1;++i ){ + kinRhsTags.push_back( tagsE.yFullRhsTags[i] ); + } + + if(!isRestart){ + PlugFlowReactorInterface::setup_pfr( initRoots, initFactory, parser); + } + PlugFlowReactorInterface::build_equation_system_pfr( integrator, csj, parser, EquIndex); } std::vector particleNumArray; - int EquIndex = nspec; Particles::ParticleSetup* particleSetup; if(parser["Particles"]){ particleSetup = new Particles::ParticleSetup(particleNumArray, parser, initRoots, initFactory, integrator, primitiveTags, kinRhsTags, EquIndex, isRestart); @@ -237,7 +257,7 @@ int main( int iarg, char* carg[] ) std::map primVarIdxMap; std::map kinRhsIdxMap; // kinetic rhs indices - if( parser["ReactorParameters"]["ReactorType"].as() == "ConstantVolume" ){ + if( reactorType == "PSRConstantVolume" ){ primConsMap[tagsE.rhoTag] = tagsE.rhoTag; primConsMap[tagsE.tempTag] = tagsE.rhoEgyTag; for( size_t i=0; i() == "ConstantPressure" ){ + if( reactorType == "PSRConstantPressure" ){ primConsMap[tagsE.rhoTag] = tagsE.presTag; primConsMap[tagsE.tempTag] = tagsE.enthTag; @@ -512,6 +532,99 @@ int main( int iarg, char* carg[] ) ReactorEnsembleUtil::initialize_cp( integrator, fml, patch, initTree, tagsE.dsTag, dsInit, dt, isRestart ); } + if( reactorType == "PFR" ){ + primConsMap[tagsEpfr.uTag] = tagsEpfr.uTag; + primConsMap[tagsE.rhoTag] = tagsE.rhoTag; + primConsMap[tagsE.tempTag] = tagsE.enthTag; + for( size_t i = 0;i < nspec - 1;++i ){ + primConsMap[tagsE.massTags[i]] = tagsE.massTags[i]; + } + for( const auto& pc : primConsMap ){ + primVarIdxMap[pc.first] = consVarIdxMap.at( pc.second ); + } + + kinRhsIdxMap[tagsEpfr.uFullRhsTag] = rhsIdxMap.at( tagsEpfr.uFullRhsTag ); + kinRhsIdxMap[tagsE.rhoFullRhsTag] = rhsIdxMap.at( tagsE.rhoFullRhsTag ); + kinRhsIdxMap[tagsE.enthFullRhsTag] = rhsIdxMap.at( tagsE.enthFullRhsTag ); + for( auto i = 0;i < nspec - 1;++i ){ + kinRhsIdxMap[tagsE.yFullRhsTags[i]] = rhsIdxMap.at( tagsE.yFullRhsTags[i] ); + } + + // state transformation matrix + auto make_state_transform = [&]() + { + ASSEMBLER( Expr::matrix::SparseMatrix, FT, dVdU ) + // make some new tags in local scope to make things clearer + const Expr::Tag& u = tagsEpfr.uTag; + const Expr::Tag& T = tagsE.tempTag; + const Expr::Tag& rho = tagsE.rhoTag; + const Expr::Tag& h = tagsE.enthTag; + const Expr::TagList& Y = tagsE.massTags; + + const auto& uPrimIdx = primVarIdxMap.at( u ); + const auto& tempPrimIdx = primVarIdxMap.at( T ); + const auto& rhoPrimIdx = primVarIdxMap.at( rho ); + const auto& uConsIdx = consVarIdxMap.at( u ); + const auto& rhoConsIdx = consVarIdxMap.at( rho ); + const auto& enthConsIdx = consVarIdxMap.at( h ); + dVdU->element( uPrimIdx, uConsIdx ) = 1.0; + dVdU->element( rhoPrimIdx, rhoConsIdx ) = 1.0; + dVdU->element( tempPrimIdx, enthConsIdx ) = tagsE.invCpTag; + for( auto i = 0;i < nspec - 1;++i ){ + dVdU->element( primVarIdxMap.at( Y[i] ), + consVarIdxMap.at( Y[i] )) = 1.0; + dVdU->element( primVarIdxMap.at( T ), + consVarIdxMap.at( Y[i] )) = tagsE.enthOffsetTags[i]; + } + dVdU->finalize(); + return dVdU; + }; + + auto make_kinetics_jacobian = [&]() + { + ASSEMBLER( Expr::matrix::DenseSubMatrix, FT, dKdV ) + for( const auto& K : kinRhsTags ){ + for( const auto& V : primitiveTags ){ + dKdV->element( kinRhsIdxMap.at( K ), primVarIdxMap.at( V )) = sensitivity( K, V ); + } + } + dKdV->finalize(); + return dKdV; + }; + + boost::shared_ptr > jacobian; + if(parser["Particles"]){ + particleSetup->modify_idxmap(primVarIdxMap, consVarIdxMap, kinRhsIdxMap, rhsIdxMap); + + integrator->set_jacobian( make_kinetics_jacobian() * (make_state_transform() + particleSetup->dvdu_part(primVarIdxMap, consVarIdxMap)) ); + + jacobian = make_kinetics_jacobian() * (make_state_transform() + particleSetup->dvdu_part(primVarIdxMap, consVarIdxMap)); + } + else{ + jacobian = make_kinetics_jacobian() * make_state_transform(); + integrator->set_jacobian( make_kinetics_jacobian() * make_state_transform() ); + } + + typedef Expr::EigenvalueExpression::Builder ExplosiveEigT; + integrator->factory().register_expression( new ExplosiveEigT( tagsE.expEigTag, + jacobian, + EquIndex+1, + ExplosiveEigT::MOST_POS_REAL_PART )); + typedef ReactorEnsembleUtil::EigenvalueModifier::Builder GesatEigT; + integrator->factory().register_expression( new GesatEigT( tagsE.gesatEigTag, + tagsE.expEigTag, + dt )); + + integrator->register_root_expression( new ExplosiveEigT( tagsE.reactEigTag, + make_kinetics_jacobian() * make_state_transform(), + EquIndex+1, + ExplosiveEigT::MOST_NEG_REAL_PART )); + + integrator->register_root_expression( new pokitt::MassToMoleFracs::Builder( tagsE.moleTags, tagsE.massTags, tagsE.mmwTag )); + const double dsInit = parser["TimeIntegrator"]["dsInitial"].as(integratorParams.gesatMax); + PlugFlowReactorInterface::initialize_pfr( integrator, fml, patch, initTree, tagsE.dsTag, dsInit, dt, isRestart ); + } + if(parser["Particles"]){ particleSetup->initialize_particle(); } @@ -533,16 +646,20 @@ int main( int iarg, char* carg[] ) std::vector restartVars; for( const auto& c : consVarIdxMap ){ restartVars.push_back(c.first.name()); - restartVars.push_back(c.first.name() + "_inflow"); + if(reactorType != "PFR"){ + restartVars.push_back( c.first.name() + "_inflow" ); + } } restartVars.push_back(tagsE.tempTag.name()); - restartVars.push_back(tagsE.tempInflowTag.name()); - restartVars.push_back(tagsE.tauMixTag.name()); restartVars.push_back(tagsE.convecTempTag.name()); restartVars.push_back(tagsE.convecCoeffTag.name()); - if(parser["ReactorParameters"]["ReactorType"].as() == "ConstantPressure"){ + if(reactorType == "PSRConstantPressure"){ restartVars.push_back(tagsE.rhoInflowTag.name()); } + if(reactorType != "PFR"){ + restartVars.push_back(tagsE.tauMixTag.name()); + restartVars.push_back(tagsE.tempInflowTag.name()); + } if(parser["Particles"]){ particleSetup->restart_var_particle(restartVars); } @@ -605,7 +722,7 @@ int main( int iarg, char* carg[] ) int restartStep; std::string restartFile = "converged"; if( isRestart ){ - restartStep = parser["restart"]["step"].as(); + restartStep = parser["Restart"]["Step"].as(); //transient simulation restarts from certain physical time step if(parser["TimeIntegrator"]["end_time"]){ stepCount = restartStep; @@ -637,11 +754,11 @@ int main( int iarg, char* carg[] ) restartDatabase->set_fields_from_file(); } // rename the database based on ` restart_prefix` in the input file - if(parser["restart"]["restart_prefix"].as(stepPrefix) == stepPrefix){ + if(parser["Restart"]["Restart_prefix"].as(stepPrefix) == stepPrefix){ std::cout << "OVERWRITE previous database during restart!" << std::endl; } else{ - stepPrefix = parser["restart"]["restart_prefix"].as(stepPrefix); + stepPrefix = parser["Restart"]["Restart_prefix"].as(stepPrefix); } if(parser["TimeIntegrator"]["end_time"]){ @@ -694,13 +811,21 @@ int main( int iarg, char* carg[] ) << ", min ds: " << std::scientific << std::setprecision( 1 ) << SpatialOps::nebo_min( fml.field_ref( tagsE.dsTag )) << ", max ds: " << std::scientific << std::setprecision( 1 ) << SpatialOps::nebo_max( fml.field_ref( tagsE.dsTag )) << std::endl; + if(reactorType == "PFR"){ + const Particles::ParticleEnsembleTags tagsEpart( Expr::STATE_NONE, particleNumArray ); + const PlugFlowReactorInterface::PlugFlowReactorTags tagsEpfr( Expr::STATE_NONE); + std::cout << ", u: " << std::scientific << std::setprecision( 1 ) << SpatialOps::nebo_max( fml.field_ref( tagsEpfr.uTag )) + << ", dpdx: " << std::scientific << std::setprecision( 1 ) << SpatialOps::nebo_max( fml.field_ref( tagsEpfr.dpdxTag )) + << std::endl; + } if( parser["Particles"] ){ const Particles::ParticleEnsembleTags tagsEpart( Expr::STATE_NONE, particleNumArray ); std::cout << ", max Re: " << std::scientific << std::setprecision( 5 ) << SpatialOps::nebo_max( fml.field_ref( tagsEpart.reynoldsNumberTags[0] )) << ", max cppart: " << std::scientific << std::setprecision( 5 ) << SpatialOps::nebo_max( fml.field_ref( tagsEpart.partCpTags[0] )) << ", max Tpart: " << std::scientific << std::setprecision( 5 ) << SpatialOps::nebo_max( fml.field_ref( tagsEpart.partTempTags[0] )) << ", max massEachPart: " << std::scientific << std::setprecision( 7 ) << SpatialOps::nebo_max( fml.field_ref( tagsEpart.massEachPartTags[0] )) - << ", max numPart: " << std::scientific << std::setprecision( 7 ) << SpatialOps::nebo_max( fml.field_ref( tagsEpart.partNumTags[0] )) + << ", max massFracPart: " << std::scientific << std::setprecision( 7 ) << SpatialOps::nebo_max( fml.field_ref( tagsEpart.partMassFracTags[0] )) + << ", max numFracPart: " << std::scientific << std::setprecision( 7 ) << SpatialOps::nebo_max( fml.field_ref( tagsEpart.partNumFracTags[0] )) << std::endl; if( parser["Particles"]["ParticleType"].as() == "Coal" ){ const Coal::CoalEnsembleTags tagsEcoal( Expr::STATE_NONE, particleNumArray ); diff --git a/src/PlugFlowReactor/CMakeLists.txt b/src/PlugFlowReactor/CMakeLists.txt new file mode 100755 index 0000000..f956a58 --- /dev/null +++ b/src/PlugFlowReactor/CMakeLists.txt @@ -0,0 +1,10 @@ +set( src + PlugFlowReactorInterface.cpp + ) + +# advertise this upward, appending the path information... +get_filename_component( dir ${CMAKE_CURRENT_LIST_FILE} PATH ) +foreach( file ${src} ) + list( APPEND SRCS ${dir}/${file} ) +endforeach() +set( PARSER_SRC ${PARSER_SRC} ${SRCS} PARENT_SCOPE ) diff --git a/src/PlugFlowReactor/DpDx.h b/src/PlugFlowReactor/DpDx.h new file mode 100644 index 0000000..746e7d6 --- /dev/null +++ b/src/PlugFlowReactor/DpDx.h @@ -0,0 +1,205 @@ +/* + * The MIT License + * + * Copyright (c) 2016-2017 The University of Utah + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/** + * @file DpDx.h + * @par Getting `Dp/Dx` term in continuity and momentum equation for plug flow reactor + * @authors Hang + */ + +#ifndef DpDx_H_ +#define DpDx_H_ + +#include + +namespace PFR{ + + /** + * @class DpDx + * @ingroup PFR + * @brief Getting `Dp/Dx` term in continuity and momentum equation for plug flow reactor + * @author Hang + * + * Ideal Gas EOS is used to get \f$\frac{Dp}{Dx}$\f. From ideal gas EOS, we can get \f$p=\frac{\rho RT}{M}\f$. + * \f[ + * \frac{Dp}{Dx} = \frac{RT}{M}\frac{D\rho}{Dx}+\frac{\rho R}{M}\frac{DT}{Dx}-\frac{\rho R T}{M^2}\frac{DM}{Dx} + * \f] + * Also, + * \f[ + * \frac{DT}{Dx} = \frac{1}{cp}\left(\frac{Dh}{Dx}-\sum_{i=1}^{n_s-1}(h_i-h_{n_s})\frac{DY_i}{Dx}\right) + * \f] + * \f[ + * \frac{DM}{Dx} = -M^2 \sum_{i=1}^{n_s-1}(\frac{1}{M_i}-\frac{1}{M_{n_s}})\frac{DY_i}{Dx} + * \f] + * From continuity equation, + * \f[ + * \frac{D\rho}{Dx}=\frac{1}{u^2}\frac{Dp}{Dx}+\frac{2S_m}{u} + * \f] + * From enthalpy equation, + * \f[ + * \frac{Dh}{Dx}=\frac{Q+S_h-hS_m}{\rho u}+\frac{\frac{Dp}{Dx}}{\rho} + * \f] + * Substitute \f$\frac{DT}{Dx}\f$, \f$\frac{DM}{Dx}\f$, \f$\frac{D\rho}{Dx}\f$ and \f$\frac{Dp}{Dx}\f$ into \f$\frac{Dp}{Dx}\f$, + * \f[ + * \frac{Dp}{Dx} = \frac{\frac{2S_mT}{u}+\frac{Q+S_h-hS_m}{ucp}-\sum_{i=1}^{n_s-1}\left(\frac{\rho}{cp}(h_i-h_{n_s})-\rho MT(\frac{1}{M_i}-\frac{1}{M_{n_s}})\right)\frac{DY_i}{Dx}}{\frac{M}{R}-\frac{T}{u^2}-\frac{1}{cp}} + * \f] + * Here, \f$n_s\f$ is the number of species. + * \f$\rho\f$, \f$u\f$, \f$T\f$ and \f$cp\f$ are the density, velocity, temperature and heat capacity of gas phase. + * \f$Q\f$ is the heat transfer term in enthalpy equation (J/m^3/s), including heat transfer between gas and surroundings and between particles and gas. + * \f$S_m\f$ and \f$S_h\f$ are the mass and energy source terms from particle to gas. They are not added here. + * They are added using `attach_dependency_to_expression` in each sub-models of particle reactions. + */ + template< typename FieldT > + class DpDx : public Expr::Expression + { + const double gasConstant_; + const int nspec_; + DECLARE_FIELDS( FieldT, temp_, mmw_, rho_, cp_, u_, enthHeatRhs_ ); + DECLARE_VECTOR_OF_FIELDS(FieldT, yiRhs_); + DECLARE_VECTOR_OF_FIELDS(FieldT, specEnth_); + DECLARE_VECTOR_OF_FIELDS(FieldT, specMw_); + + DpDx( const Expr::Tag& uTag, + const Expr::Tag& tempTag, + const Expr::Tag& rhoTag, + const Expr::Tag& mmwTag, + const Expr::Tag& cpTag, + const Expr::Tag& enthHeatRhsTag, + const Expr::TagList& yiRhsTags, + const Expr::TagList& specEnthTags, + const Expr::TagList& specMwTags) + : Expr::Expression(), + gasConstant_( CanteraObjects::gas_constant() ), + nspec_(yiRhsTags.size()) + { + this->set_gpu_runnable(true); + u_ = this->template create_field_request( uTag ); + temp_ = this->template create_field_request( tempTag ); + rho_ = this->template create_field_request( rhoTag ); + mmw_ = this->template create_field_request( mmwTag ); + cp_ = this->template create_field_request( cpTag ); + enthHeatRhs_ = this->template create_field_request( enthHeatRhsTag ); + this->template create_field_vector_request( yiRhsTags, yiRhs_ ); + this->template create_field_vector_request( specEnthTags, specEnth_ ); + this->template create_field_vector_request( specMwTags, specMw_ ); + } + + public: + class Builder : public Expr::ExpressionBuilder + { + const Expr::Tag tempTag_, mmwTag_, rhoTag_, cpTag_, uTag_, enthHeatRhsTag_ ; + const Expr::TagList yiRhsTags_, specEnthTags_, specMwTags_; + public: + /** + * @brief The mechanism for building a ConvectionHeatRateCV object + * @tparam FieldT + * @param dpdxTag Dp/Dx` term in continuity and momentum equation for plug flow reactor + * @param uTag Gas phase velocity + * @param tempTag Gas phase temperature + * @param rhoTag Gas phase density + * @param mmwTag Mixture molecular weight of gas phase + * @param cpTag Specific heat capacity of gas phase + * @param enthHeatRhsTag Heat RHS in enthalpy equation (has been divided by \f$\rho u\f$) + * @param yiRhsTags Full RHS of species equations + * @param specEnthTags species specific enthalpy + * @param specMwTags molecular weight of species + */ + Builder( const Expr::Tag& dpdxTag, + const Expr::Tag& uTag, + const Expr::Tag& tempTag, + const Expr::Tag& rhoTag, + const Expr::Tag& mmwTag, + const Expr::Tag& cpTag, + const Expr::Tag& enthHeatRhsTag, + const Expr::TagList& yiRhsTags, + const Expr::TagList& specEnthTags, + const Expr::TagList& specMwTags) + : Expr::ExpressionBuilder( dpdxTag ), + uTag_( uTag ), + tempTag_( tempTag ), + rhoTag_( rhoTag ), + mmwTag_( mmwTag ), + cpTag_( cpTag ), + enthHeatRhsTag_( enthHeatRhsTag ), + yiRhsTags_( yiRhsTags ), + specEnthTags_( specEnthTags ), + specMwTags_( specMwTags ) + {} + ~Builder(){} + Expr::ExpressionBase* build() const{ + return new DpDx( uTag_, tempTag_, rhoTag_, mmwTag_, cpTag_, enthHeatRhsTag_, yiRhsTags_, specEnthTags_, specMwTags_ ); + } + }; + + + void evaluate() + { + using namespace SpatialOps; + FieldT& result = this->value(); + const FieldT& u = u_ ->field_ref(); + const FieldT& temp = temp_ ->field_ref(); + const FieldT& rho = rho_ ->field_ref(); + const FieldT& mmw = mmw_ ->field_ref(); + const FieldT& cp = cp_ ->field_ref(); + const FieldT& enthHeat = enthHeatRhs_ ->field_ref(); + const FieldT& hn = specEnth_[nspec_-1]->field_ref(); + const FieldT& mwn = specMw_[nspec_-1] ->field_ref(); + result <<= enthHeat*rho/cp; + for( size_t i=0; ifield_ref(); + const FieldT& hi = specEnth_[i]->field_ref(); + const FieldT& mwi = specMw_[i] ->field_ref(); + result <<= result - (rho/cp*(hi-hn)-rho*mmw*temp*(1/mwi-1/mwn))*yiRhs; + } + result <<= result / (mmw/gasConstant_-temp/square(u)-1/cp); + } + + void sensitivity( const Expr::Tag& sensVarTag ) + { + FieldT& dfdv = this->sensitivity_result( sensVarTag ); + FieldT& result = this->value(); + const FieldT& u = u_ ->field_ref(); const FieldT& dudv = u_ ->sens_field_ref(sensVarTag); + const FieldT& temp = temp_ ->field_ref(); const FieldT& dtempdv = temp_ ->sens_field_ref(sensVarTag); + const FieldT& rho = rho_ ->field_ref(); const FieldT& drhodv = rho_ ->sens_field_ref(sensVarTag); + const FieldT& mmw = mmw_ ->field_ref(); const FieldT& dmmwdv = mmw_ ->sens_field_ref(sensVarTag); + const FieldT& cp = cp_ ->field_ref(); const FieldT& dcpdv = cp_ ->sens_field_ref(sensVarTag); + const FieldT& enthHeat = enthHeatRhs_ ->field_ref(); const FieldT& denthHeatdv = enthHeatRhs_ ->sens_field_ref(sensVarTag); + const FieldT& hn = specEnth_[nspec_-1]->field_ref(); const FieldT& dhndv = specEnth_[nspec_-1]->sens_field_ref(sensVarTag); + const FieldT& mwn = specMw_[nspec_-1] ->field_ref(); const FieldT& dmwndv = specMw_[nspec_-1] ->sens_field_ref(sensVarTag); + dfdv <<= denthHeatdv*rho/cp + enthHeat*drhodv/cp - enthHeat*rho/square(cp)*dcpdv; + for( size_t i=0; ifield_ref(); const FieldT& dyiRhsdv = yiRhs_[i] ->sens_field_ref(sensVarTag); + const FieldT& hi = specEnth_[i]->field_ref(); const FieldT& dhidv = specEnth_[i]->sens_field_ref(sensVarTag); + const FieldT& mwi = specMw_[i] ->field_ref(); const FieldT& dmwidv = specMw_[i] ->sens_field_ref(sensVarTag); + dfdv <<= dfdv - (drhodv/cp*(hi-hn)-rho/square(cp)*dcpdv*(hi-hn)+rho/cp*(dhidv-dhndv) - (drhodv*mmw*temp+rho*dmmwdv*temp+rho*mmw*dtempdv)*(1/mwi-1/mwn)) *yiRhs + - (rho/cp*(hi-hn)-rho*mmw*temp*(1/mwi-1/mwn))*dyiRhsdv; + } + dfdv <<= dfdv / (mmw/gasConstant_-temp/square(u)-1/cp) + - result/(mmw/gasConstant_-temp/square(u)-1/cp)*(dmmwdv/gasConstant_-dtempdv/square(u)+2*temp/cube(u)*dudv+dcpdv/square(cp)); + } + }; + +} // namespace PFR + +#endif /* DpDx_H_ */ diff --git a/src/PlugFlowReactor/PFRTransformationMatrixExpressions.h b/src/PlugFlowReactor/PFRTransformationMatrixExpressions.h new file mode 100644 index 0000000..9972d14 --- /dev/null +++ b/src/PlugFlowReactor/PFRTransformationMatrixExpressions.h @@ -0,0 +1,126 @@ +/* + * The MIT License + * + * Copyright (c) 2016-2017 The University of Utah + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/** + * \file PFRTransformationMatrixExpressions.h + * \par Getting the expressions needed to build transformation matrix for plug flow reactor + * \authors Hang + */ + +#ifndef PFRTRANSFORMATIONMATRIXEXPRESSIONS_H_ +#define PFRTRANSFORMATIONMATRIXEXPRESSIONS_H_ + +#include + +namespace PFR{ + + /** + * @class SourceOverRhoU + * @ingroup PFR + * @brief Calculate the ratio between volumetric source term and (density * velocity). + * It is needed for the source term for plug flow reactor. + * @author Hang + * + * The result is given as + * \f[ + * K = c \frac{\omega_i}{\rho u} + * \f] + * + * The sensitivity of this term \f$ \frac{\partial K}{\partial V} \f$ is + * \f[ + * \frac{\partial K}{\partial \phi} = c \left(\frac{1}{\rho u} \frac{\partial \omega_i}{\partial \phi} + * - \frac{\omega_i}{\rho^2 u }\frac{\partial \rho}{\partial \phi} + * - \frac{\omega_i}{\rho u^2 }\frac{\partial u}{\partial \phi} \right) + * \f] + */ + + template + class SourceOverRhoU : public Expr::Expression { + DECLARE_FIELDS( FieldT, rho_, source_, u_); + const double coeff_; + + SourceOverRhoU( const Expr::Tag sourceTag, + const Expr::Tag rhoTag, + const Expr::Tag uTag, + const double coefficient) + : Expr::Expression(), + coeff_(coefficient){ + this->set_gpu_runnable( true ); + rho_ = this->template create_field_request( rhoTag ); + source_ = this->template create_field_request( sourceTag ); + u_ = this->template create_field_request( uTag ); + } + + public: + class Builder : public Expr::ExpressionBuilder { + const Expr::Tag sourceTag_, rhoTag_, uTag_; + const double coeff_; + public: + /** + * @brief The mechanism for building a RatePFR object + * @tparam FieldT + * @param resultTag Result of RatePFR + * @param sourceTag volumetric source term + * @param rhoTag Density of gas phase + * @param uTag Velocity of gas phase + * @param coefficient coefficient in the expression. It is 1 or -1 for present case + */ + Builder( const Expr::Tag resultTag, + const Expr::Tag sourceTag, + const Expr::Tag rhoTag, + const Expr::Tag uTag, + const double coefficient): + Expr::ExpressionBuilder( resultTag ), + sourceTag_( sourceTag ), + rhoTag_( rhoTag ), + uTag_( uTag ), + coeff_( coefficient ){} + + ~Builder(){} + + Expr::ExpressionBase* build() const{ + return new SourceOverRhoU( sourceTag_, rhoTag_, uTag_, coeff_ ); + } + }; + + void evaluate(){ + using namespace SpatialOps; + this->value() <<= coeff_ * source_->field_ref() / rho_->field_ref() / u_->field_ref(); + } + + void sensitivity( const Expr::Tag& sensVarTag ){ + FieldT & dfdv = this->sensitivity_result( sensVarTag ); + const FieldT& source = source_->field_ref(); + const FieldT& rho = rho_->field_ref(); + const FieldT& u = u_->field_ref(); + const FieldT& dsourcedv = source_->sens_field_ref( sensVarTag ); + const FieldT& drhodv = rho_->sens_field_ref( sensVarTag ); + const FieldT& dudv = u_->sens_field_ref( sensVarTag ); + dfdv <<= coeff_ * (dsourcedv/rho/u - source/square(rho)/u*drhodv - source/rho/square(u)*dudv); + } + }; +} + + +#endif /* PFRTRANSFORMATIONMATRIXEXPRESSIONS_H_ */ diff --git a/src/PlugFlowReactor/PlugFlowReactorInterface.cpp b/src/PlugFlowReactor/PlugFlowReactorInterface.cpp new file mode 100644 index 0000000..1ccbad9 --- /dev/null +++ b/src/PlugFlowReactor/PlugFlowReactorInterface.cpp @@ -0,0 +1,235 @@ +/* + * The MIT License + * + * Copyright (c) 2016-2017 The University of Utah + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +#include "ReactorEnsembleUtil.h" + +#include + +#include + +// PoKiTT +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "TransformationMatrixExpressions.h" +#include "PFRTransformationMatrixExpressions.h" +#include "PlugFlowReactorInterface.h" +#include "DpDx.h" + +namespace PlugFlowReactorInterface{ + + typedef Expr::PlaceHolder ::Builder PlaceHolderT; + typedef Expr::LinearFunction::Builder LinearFunctionT; + typedef Expr::ConstantExpr ::Builder ConstantT; + + typedef pokitt::SpeciesEnthalpy ::Builder SpecEnthT; + typedef pokitt::HeatCapacity_Cp ::Builder HeatCpT; + typedef pokitt::MixtureMolWeight ::Builder MixtureMWT; + typedef pokitt::Temperature ::Builder TemperatureT; + typedef pokitt::ReactionRates ::Builder RatesT; + typedef pokitt::Enthalpy ::Builder EnthalpyT; + typedef pokitt::SpeciesN ::Builder SpeciesNT; + typedef pokitt::Pressure ::Builder PressureT; + typedef pokitt::Density ::Builder DensityT; + + typedef ReactorEnsembleUtil::DivisionExpression ::Builder DivideT; + typedef ReactorEnsembleUtil::YNRHS ::Builder YNRHST; + typedef ReactorEnsembleUtil::InverseExpression ::Builder InverseT; + typedef ReactorEnsembleUtil::SpeciesEnthOffsets ::Builder SpcEnthOffsetsT; + + typedef PFR::SourceOverRhoU ::Builder SourceOverRhoUT; + typedef PFR::DpDx ::Builder DpDxT; + + //--------------------------------------------------------------------------- + + PlugFlowReactorTags:: + PlugFlowReactorTags( const Expr::Context& state ) + : uTag ( Expr::Tag( "u" , state ) ), + dpdxTag ( Expr::Tag( "dpdx" , state ) ), + uFullRhsTag ( Expr::Tag( "u_full_rhs" , state ) ){} + + //--------------------------------------------------------------------------- + + void setup_pfr( std::set& initRoots, + Expr::ExpressionFactory& initFactory, + const YAML::Node& parser ){ + + const ReactorEnsembleUtil::ReactorEnsembleTags tags( Expr::STATE_N ); + const PlugFlowReactorInterface::PlugFlowReactorTags tagsPFR( Expr::STATE_N ); + + // initial state + initRoots.insert( initFactory.register_expression( new EnthalpyT( tags.enthTag, tags.tempTag, tags.massTags ))); + initRoots.insert( initFactory.register_expression( new DensityT( tags.rhoTag, tags.tempTag, tags.presTag, tags.mmwTag ))); + + const int ns = CanteraObjects::number_species(); + for( size_t i = 0;i < ns;++i ){ + initRoots.insert( initFactory.register_expression( new SpecEnthT( tags.specEnthTags[i], tags.tempTag, i ))); + } + } + + //--------------------------------------------------------------------------- + + void build_equation_system_pfr( Expr::DualTime::BlockImplicitBDFDualTimeIntegrator * integrator, + const boost::shared_ptr csj, + const YAML::Node& parser, + int& equIndex, + const double tempTolerance, + const double maximumTemp, + const double maxTempIter ){ + const ReactorEnsembleUtil::ReactorEnsembleTags tagsE( Expr::STATE_NONE ); + const PlugFlowReactorInterface::PlugFlowReactorTags tagsEpfr( Expr::STATE_NONE ); + + const int ns = CanteraObjects::number_species(); + + Expr::ExpressionFactory& execFactory = integrator->factory(); + + integrator->register_root_expression( new PlaceHolderT( tagsE.timeTag )); + execFactory.register_expression( new PlaceHolderT( tagsE.convecCoeffTag ) ); + execFactory.register_expression( new PlaceHolderT( tagsE.convecTempTag ) ); + integrator->register_root_expression( new PressureT( tagsE.presTag, tagsE.tempTag, tagsE.rhoTag, tagsE.mmwTag)); + + execFactory.register_expression( new SpeciesNT( tagsE.massTags[ns - 1], tagsE.massTags, pokitt::CLIPSPECN )); + + execFactory.register_expression( new TemperatureT( tagsE.tempTag, tagsE.massTags, tagsE.enthTag, + Expr::Tag(), tempTolerance, maximumTemp, maxTempIter )); + execFactory.register_expression( new MixtureMWT( tagsE.mmwTag, tagsE.massTags, pokitt::FractionType::MASS )); + + const std::vector& SpecMW = CanteraObjects::molecular_weights(); + for( size_t i = 0;i < ns;++i ){ + execFactory.register_expression( new SpecEnthT( tagsE.specEnthTags[i], tagsE.tempTag, i )); + execFactory.register_expression( new ConstantT( tagsE.molarWeightTags[i], SpecMW[i] )); + } + + execFactory.register_expression( new HeatCpT( tagsE.cpTag, tagsE.tempTag, tagsE.massTags )); + + // the rhs + if ((!parser["ReactionInGas"]) or (parser["ReactionInGas"].as() == "True") or (parser["ReactionInGas"].as() == "true") ){ + execFactory.register_expression( new RatesT( tagsE.rateTags, tagsE.tempTag, tagsE.rhoTag, tagsE.massTags, tagsE.mmwTag, csj )); + for( size_t i = 0;i < ns - 1;++i ){ + execFactory.register_expression( new SourceOverRhoUT( tagsE.yFullRhsTags[i], tagsE.rateTags[i], tagsE.rhoTag, tagsEpfr.uTag, 1.0 )); } + } + else{ + for( size_t i = 0;i < ns - 1;++i ){ + execFactory.register_expression( new ConstantT( tagsE.yFullRhsTags[i], 0 )); } + } + execFactory.register_expression( new DpDxT( tagsEpfr.dpdxTag, tagsEpfr.uTag, tagsE.tempTag, tagsE.rhoTag, tagsE.mmwTag, tagsE.cpTag, + tagsE.enthHeatRhsTag, tagsE.yFullRhsTags, tagsE.specEnthTags, tagsE.molarWeightTags)); + // the full rhs + execFactory.register_expression( new SourceOverRhoUT(tagsEpfr.uFullRhsTag, tagsEpfr.dpdxTag, tagsE.rhoTag, tagsEpfr.uTag, -1.0)); + execFactory.register_expression( new SourceOverRhoUT(tagsE.rhoFullRhsTag, tagsEpfr.dpdxTag, tagsEpfr.uTag, tagsEpfr.uTag, 1.0)); + + execFactory.register_expression( new DivideT(tagsE.enthFullRhsTag, tagsEpfr.dpdxTag, tagsE.rhoTag)); + execFactory.attach_dependency_to_expression(tagsE.enthHeatRhsTag, tagsE.enthFullRhsTag, Expr::ADD_SOURCE_EXPRESSION); + + execFactory.register_expression( new YNRHST( tagsE.yFullRhsTags[ns-1], tagsE.yFullRhsTags)); + // matrix transformation fields + execFactory.register_expression( new SpcEnthOffsetsT( tagsE.enthOffsetTags, tagsE.cpTag, tagsE.specEnthTags )); + execFactory.register_expression( new InverseT( tagsE.invCpTag, tagsE.cpTag )); + + // add variables to the integrator + integrator->add_variable( tagsEpfr.uTag.name(), tagsEpfr.uFullRhsTag, equIndex, equIndex); + equIndex += 1; + integrator->add_variable( tagsE.rhoTag.name(), tagsE.rhoFullRhsTag, equIndex, equIndex ); + equIndex += 1; + integrator->add_variable( tagsE.enthTag.name(), tagsE.enthFullRhsTag, equIndex, equIndex ); + equIndex += 1; + for( size_t i = 0;i < ns - 1;++i ){ + integrator->add_variable( tagsE.massTags[i].name(), tagsE.yFullRhsTags[i], i + 3, i + 3 ); + } + equIndex += ns-2; + } + + //--------------------------------------------------------------------------- + + void initialize_pfr( Expr::DualTime::BlockImplicitBDFDualTimeIntegrator * integrator, + Expr::FieldManagerList& fml, + const Expr::ExprPatch& patch, + Expr::ExpressionTree& initTree, + const Expr::Tag dsTag, + const double gesatMax, + const double timeStep, + const bool isRestart){ + const ReactorEnsembleUtil::ReactorEnsembleTags tagsE( Expr::STATE_NONE ); + const ReactorEnsembleUtil::ReactorEnsembleTags tagsN( Expr::STATE_N ); + const PlugFlowReactorInterface::PlugFlowReactorTags tagsEpfr( Expr::STATE_NONE ); + + const int ns = CanteraObjects::number_species(); + + if(!isRestart){ + initTree.register_fields( fml ); + initTree.bind_fields( fml ); + initTree.lock_fields( fml ); + std::ofstream initOut( "init-tree-reactor-ensemble.dot" ); + initTree.write_tree( initOut ); + } + + SpatialOps::OperatorDatabase sodb; + integrator->prepare_for_integration( fml, sodb, patch.field_info()); + + { + std::ofstream execOut( "exec-tree-reactor-ensemble.dot" ); + integrator->get_tree().write_tree( execOut ); + } + + fml.allocate_fields( patch.field_info()); + if(!isRestart){ + initTree.execute_tree(); + + // copy the residence time from STATE_N as initialized to STATE_NONE as used in mixing time expressions + integrator->copy_from_initial_condition_to_execution( tagsE.convecCoeffTag.name()); + integrator->copy_from_initial_condition_to_execution( tagsE.convecTempTag.name()); + + // copy the temperature because we need it for the initial guess in the T solve + integrator->copy_from_initial_condition_to_execution( tagsE.tempTag.name()); + + } + + // initialize the simulation time and time step + // The time step must be initialized here because we need to update t -> t + dt + // before the dual time execution tree runs. + fml.field_ref( tagsE.timeTag ) <<= 0.; + fml.field_ref( tagsE.dtTag ) <<= timeStep; + + // initialize the dual time step + fml.field_ref( dsTag ) <<= gesatMax; + + // jcs why are we locking these fields? Can this be done automatically? + integrator->lock_field( tagsE.dsTag ); + integrator->lock_field( tagsE.convecCoeffTag ); + integrator->lock_field( tagsE.convecTempTag ); + integrator->lock_field( tagsE.timeTag ); + integrator->lock_field( tagsE.dtTag ); + integrator->lock_field( tagsE.tempTag ); + integrator->lock_field( tagsE.gesatEigTag ); + } + //--------------------------------------------------------------------------- + +} // namespace PlugFlowReactorInterface diff --git a/src/PlugFlowReactor/PlugFlowReactorInterface.h b/src/PlugFlowReactor/PlugFlowReactorInterface.h new file mode 100644 index 0000000..7c822b0 --- /dev/null +++ b/src/PlugFlowReactor/PlugFlowReactorInterface.h @@ -0,0 +1,64 @@ +/** + * \file PlugFlowReactorInterface.h + * \date July, 2020 + * \author Hang + */ + +#ifndef PLUGFLOWREACTORINTERFACE_H_ +#define PLUGFLOWREACTORINTERFACE_H_ + +#include + +#include +#include + +#include +#include + +#include +#include + +#include + +namespace PlugFlowReactorInterface{ + + struct PlugFlowReactorTags + { + const Expr::Tag uTag, ///< velocity + dpdxTag, ///< Dp/Dx in continuity and momentum equation + uFullRhsTag; ///< full RHS for velocity equation + PlugFlowReactorTags( const Expr::Context& state ); + }; + /** + * @brief Set the initial conditions for plug flow reactor + */ + void setup_pfr( std::set& initRoots, + Expr::ExpressionFactory& initFactory, + const YAML::Node& parser); + /** + * @brief Register all expressions required for plug flow reactor and add equation into the time integrator + */ + void build_equation_system_pfr( Expr::DualTime::BlockImplicitBDFDualTimeIntegrator* integrator, + const boost::shared_ptr csj, + const YAML::Node& parser, + int& equIndex, + const double tempTolerance = 1e-3, + const double maximumTemp = 5000, + const double maxTempIter = 1000 ); + + /** + * @brief Initialize the reactor system for plug flow reactor + */ + void initialize_pfr( Expr::DualTime::BlockImplicitBDFDualTimeIntegrator* integrator, + Expr::FieldManagerList& fml, + const Expr::ExprPatch& patch, + Expr::ExpressionTree& initTree, + const Expr::Tag dsTag, + const double gesatMax, + const double timeStep, + const bool isRestart); + +} // namespace PlugFlowReactorInterface + + +#endif /* PLUGFLOWREACTORINTERFACE_H_ */ diff --git a/src/ReactorEnsembleUtil.cpp b/src/ReactorEnsembleUtil.cpp index 2bf819c..e6a5361 100644 --- a/src/ReactorEnsembleUtil.cpp +++ b/src/ReactorEnsembleUtil.cpp @@ -214,6 +214,7 @@ namespace ReactorEnsembleUtil{ void build_equation_system_cv( Expr::DualTime::BlockImplicitBDFDualTimeIntegrator* integrator, const boost::shared_ptr csj, const YAML::Node& parser, + int& equIndex, const double tempTolerance, const double maximumTemp, const double maxTempIter ) @@ -299,11 +300,14 @@ namespace ReactorEnsembleUtil{ execFactory.register_expression( new InverseT( tagsE.invrhoTag, tagsE.rhoTag ) ); // add variables to the integrator - integrator->add_variable( tagsE.rhoTag.name(), tagsE.rhoFullRhsTag, 0, 0 ); - integrator->add_variable( tagsE.rhoEgyTag.name(), tagsE.rhoEgyFullRhsTag, 1, 1 ); + integrator->add_variable( tagsE.rhoTag.name(), tagsE.rhoFullRhsTag, equIndex, equIndex ); + equIndex += 1; + integrator->add_variable( tagsE.rhoEgyTag.name(), tagsE.rhoEgyFullRhsTag, equIndex, equIndex ); + equIndex += 1; for( size_t i=0; iadd_variable( tagsE.rhoYTags[i].name(), tagsE.rhoYFullRhsTags[i], i + 2, i + 2 ); + integrator->add_variable( tagsE.rhoYTags[i].name(), tagsE.rhoYFullRhsTags[i], i + equIndex, i + equIndex ); } + equIndex += ns-2; } //--------------------------------------------------------------------------- @@ -421,6 +425,7 @@ namespace ReactorEnsembleUtil{ void build_equation_system_cp( Expr::DualTime::BlockImplicitBDFDualTimeIntegrator * integrator, const boost::shared_ptr csj, const YAML::Node& parser, + int& equIndex, const double tempTolerance, const double maximumTemp, const double maxTempIter ){ @@ -506,11 +511,14 @@ namespace ReactorEnsembleUtil{ execFactory.register_expression( new HmixPartialYT( tagsE.hMixPartialYTags, tagsE.rhoTag, tagsE.rhoInflowTag, tagsE.tauMixTag, tagsE.specEnthTags )); // add variables to the integrator - integrator->add_variable( tagsE.presTag.name(), tagsE.presFullRhsTag, 0, 0 ); - integrator->add_variable( tagsE.enthTag.name(), tagsE.enthFullRhsTag, 1, 1 ); + integrator->add_variable( tagsE.presTag.name(), tagsE.presFullRhsTag, equIndex, equIndex ); + equIndex += 1; + integrator->add_variable( tagsE.enthTag.name(), tagsE.enthFullRhsTag, equIndex, equIndex ); + equIndex += 1; for( size_t i = 0;i < ns - 1;++i ){ - integrator->add_variable( tagsE.massTags[i].name(), tagsE.yFullRhsTags[i], i + 2, i + 2 ); + integrator->add_variable( tagsE.massTags[i].name(), tagsE.yFullRhsTags[i], i + equIndex, i + equIndex ); } + equIndex += ns-2; } //--------------------------------------------------------------------------- diff --git a/src/ReactorEnsembleUtil.h b/src/ReactorEnsembleUtil.h index 701a913..36eddaf 100644 --- a/src/ReactorEnsembleUtil.h +++ b/src/ReactorEnsembleUtil.h @@ -142,6 +142,7 @@ namespace ReactorEnsembleUtil{ void build_equation_system_cv( Expr::DualTime::BlockImplicitBDFDualTimeIntegrator* integrator, const boost::shared_ptr csj, const YAML::Node& parser, + int& equIndex, const double tempTolerance = 1e-3, const double maximumTemp = 5000, const double maxTempIter = 1000 ); @@ -169,6 +170,7 @@ namespace ReactorEnsembleUtil{ void build_equation_system_cp( Expr::DualTime::BlockImplicitBDFDualTimeIntegrator * integrator, const boost::shared_ptr csj, const YAML::Node& parser, + int& equIndex, const double tempTolerance = 1e-3, const double maximumTemp = 5000, const double maxTempIter = 1000 ); diff --git a/src/TransformationMatrixExpressions.h b/src/TransformationMatrixExpressions.h index 6b4d2ea..e30c9d0 100644 --- a/src/TransformationMatrixExpressions.h +++ b/src/TransformationMatrixExpressions.h @@ -215,6 +215,11 @@ namespace ReactorEnsembleUtil{ using namespace SpatialOps; this->value() <<= numerator_->field_ref() / denominator_->field_ref(); } + void sensitivity( const Expr::Tag& sensVarTag ){ + FieldT & dfdv = this->sensitivity_result( sensVarTag ); + dfdv <<= numerator_->sens_field_ref( sensVarTag ) / denominator_->field_ref() + - numerator_->field_ref() / square( denominator_->field_ref()) * denominator_->sens_field_ref(sensVarTag); + } }; /** diff --git a/src/parser/ParseInputFile.cpp b/src/parser/ParseInputFile.cpp index f085ffc..b93400b 100644 --- a/src/parser/ParseInputFile.cpp +++ b/src/parser/ParseInputFile.cpp @@ -26,6 +26,7 @@ #include #include "particles/ParticleInterface.h" +#include "PlugFlowReactor/PlugFlowReactorInterface.h" //------------------------------------------------------------------- @@ -90,7 +91,8 @@ parse_species_comps( const YAML::Node& parser ) //------------------------------------------------------------------- void parse_mixture_fraction( Expr::ExpressionFactory& factory, - const YAML::Node& parser ) + const YAML::Node& parser, + const std::string reactorType) { const SpecInfo fuelComp = parse_species_comps( parser["fuel" ] ); const SpecInfo oxidComp = parse_species_comps( parser["oxidizer"] ); @@ -132,11 +134,13 @@ void parse_mixture_fraction( Expr::ExpressionFactory& factory, // create the expression to calculate the composition from the mixture fraction typedef pokitt::MixtureFractionToSpecies Z2Y; typedef Z2Y::Builder MixFracToSpec; - factory.register_expression( new MixFracToSpec( tagsN.massInflowTags, - tagsN.mixtureFractionTag, - mole_to_mass( fuelComp ), - mole_to_mass( oxidComp ), - reacted ? Z2Y::REACTED_COMPOSITION : Z2Y::UNREACTED_COMPOSITION ) ); + if( reactorType !="PFR"){ + factory.register_expression( new MixFracToSpec( tagsN.massInflowTags, + tagsN.mixtureFractionTag, + mole_to_mass( fuelComp ), + mole_to_mass( oxidComp ), + reacted ? Z2Y::REACTED_COMPOSITION : Z2Y::UNREACTED_COMPOSITION ) ); + } } //------------------------------------------------------------------- @@ -209,7 +213,7 @@ parse_reactor_parameters( const YAML::Node& rootParser, << " - reactor radius (m) : " << radius << std::endl; if(reactorShape == "Cylinder"){ std::cout << " - reactor height (m) : " << height << std::endl; - SoV = 2.0*(radius+height)/(radius*height); + SoV = 2.0 / radius; // 1/m, surface area to volume ratio; only surrounding surface is considered } if(reactorShape == "Spherical"){ SoV = 3.0 / radius; @@ -219,16 +223,20 @@ parse_reactor_parameters( const YAML::Node& rootParser, // build the expressions implied by these quantities const ReactorEnsembleUtil::ReactorEnsembleTags tags( Expr::STATE_NONE ); - if (parser["ReactorType"].as() == "ConstantVolume"){ - const double SoV = 3.0 / radius; // 1/m, surface area to volume ratio + if (parser["ReactorType"].as() == "PSRConstantVolume"){ typedef ReactorEnsembleUtil::ConvectionHeatRateCV::Builder ConvectionCVT; factory.register_expression( new ConvectionCVT( tags.rhoEgyHeatRhsTag, tags.tempTag, tags.convecCoeffTag, tags.convecTempTag, SoV ) ); } - else{ + if (parser["ReactorType"].as() == "PSRConstantPressure"){ typedef ReactorEnsembleUtil::ConvectionHeatRateCP::Builder ConvectionCPT; - typedef ReactorEnsembleUtil::HheatPartialT ::Builder HheatPartialTT; factory.register_expression( new ConvectionCPT( tags.enthHeatRhsTag, tags.tempTag, tags.rhoTag, tags.convecCoeffTag, tags.convecTempTag, SoV )); } + if(parser["ReactorType"].as() == "PFR"){ + const PlugFlowReactorInterface::PlugFlowReactorTags tagspfr( Expr::STATE_NONE ); + typedef ReactorEnsembleUtil::ConvectionHeatRatePFR::Builder ConvectionPFRT; + factory.register_expression( new ConvectionPFRT( tags.enthHeatRhsTag, tags.tempTag, tags.rhoTag, tags.convecCoeffTag, tags.convecTempTag, tagspfr.uTag, SoV )); + } + const std::string ReactionInGas = rootParser["ReactionInGas"].as( "True" ); if(ReactionInGas == "True"){ @@ -251,32 +259,53 @@ parse_initial_inflow_conditions( const YAML::Node& parser, std::set& initRoots, const bool isRestart) { + const std::string reactorType = parser["ReactorParameters"]["ReactorType"].as(); + if( reactorType != "PFR"){ + if( !parser["InflowConditions"] ){ + std::ostringstream msg; + msg << "No inflow condition block 'InflowConditions' was found!\n"; + throw std::runtime_error( msg.str()); + } - if( !parser["InflowConditions"] ){ - std::ostringstream msg; - msg << "No inflow condition block 'InflowConditions' was found!\n"; - throw std::runtime_error( msg.str()); + if( !parser["InitialConditions"] ){ + std::cout << "No initial condition block 'InitialConditions' was found! Initial conditions are set to be the same as inflow conditions\n" << std::endl; + } } - - if( !parser["InitialConditions"] ){ - std::cout << "No initial condition block 'InitialConditions' was found! Initial conditions are set to be the same as inflow conditions\n" << std::endl; + else{ + if( !parser["InitialConditions"] ){ + std::ostringstream msg; + msg << "No initial condition block 'InitialConditions' was found! (No inflow condition was found for plug flow reactor)\n"; + throw std::runtime_error( msg.str()); + } } + bool hasMixtureFraction = false; + int ic_inflow_size = 0; - const YAML::Node inflow = parser["InflowConditions"]; YAML::Node ic_inflow; - int ic_inflow_size = inflow.size(); - for( int i = 0;i < inflow.size() ;++i ){ - ic_inflow[i] = inflow[i]; + if(reactorType!="PFR"){ + const YAML::Node inflow = parser["InflowConditions"]; + ic_inflow_size = inflow.size(); + for( int i = 0;i < inflow.size() ;++i ){ + ic_inflow[i] = inflow[i]; + } + if(parser["InitialConditions"]){ + const YAML::Node ic = parser["InitialConditions"]; + for( int i = inflow.size();i < ic.size() + inflow.size();++i ){ + ic_inflow[i] = ic[i - inflow.size()]; + } + ic_inflow_size += ic.size(); + } } - if(parser["InitialConditions"]){ + else{ const YAML::Node ic = parser["InitialConditions"]; - for( int i = inflow.size();i < ic.size() + inflow.size();++i ){ - ic_inflow[i] = ic[i - inflow.size()]; + ic_inflow_size = ic.size(); + for( int i = 0;i < ic.size() ;++i ){ + ic_inflow[i] = ic[i]; } - ic_inflow_size += ic.size(); } + // Both of heat transfer coefficient and surroundings temperature must be given // or not given in "HeatTransferParameter" simultaneously if(parser["ReactorParameters"]["HeatTransferParameter"]){ @@ -302,9 +331,11 @@ parse_initial_inflow_conditions( const YAML::Node& parser, uninitializedSpecies.insert( sp_ic ); } } - BOOST_FOREACH( const std::string& sp_inflow, CanteraObjects::species_names()){ - uninflowSpecies.insert( sp_inflow ); - } + if(reactorType!="PFR"){ + BOOST_FOREACH( const std::string& sp_inflow, CanteraObjects::species_names()){ + uninflowSpecies.insert( sp_inflow ); + } + } // look through IC and inflow nodes to determine which ones form the grid int idim = 0; @@ -329,21 +360,26 @@ parse_initial_inflow_conditions( const YAML::Node& parser, } // keep track of initialized/inflow species if( name.substr( 0, 2 ) == "X_" || name.substr( 0, 2 ) == "Y_" ){ - if(parser["InitialConditions"]){ - if( name.substr( name.size() - 3 ) == "low" ){ // decide if it is inflow parameters - const std::string spnam = name.substr( 2, name.size() - 9 ); - uninflowSpecies.erase( spnam ); + if(reactorType!="PFR"){ + if(parser["InitialConditions"]){ + if( name.substr( name.size() - 4 ) == "flow" ){ // decide if it is inflow parameters + const std::string spnam = name.substr( 2, name.size() - 9 ); + uninflowSpecies.erase( spnam ); + } + else{ + const std::string spnam = name.substr( 2 ); + uninitializedSpecies.erase( spnam ); + } } else{ - const std::string spnam = name.substr( 2 ); - uninitializedSpecies.erase( spnam ); + const std::string spnam = name.substr( 2, name.size() - 9 ); + uninflowSpecies.erase( spnam ); } } else{ - const std::string spnam = name.substr( 2, name.size() - 9 ); - uninflowSpecies.erase( spnam ); + const std::string spnam = name.substr( 2 ); + uninitializedSpecies.erase( spnam ); } - } } @@ -360,7 +396,7 @@ parse_initial_inflow_conditions( const YAML::Node& parser, create_ic_inflow_expression( factory, grid, gridSpec, ic_inflow_Spec, initRoots ); if( ic_inflow_Spec["variable"].as() == "mixture_fraction" ){ hasMixtureFraction = true; - parse_mixture_fraction( factory, ic_inflow_Spec ); + parse_mixture_fraction( factory, ic_inflow_Spec, reactorType ); } } const ReactorEnsembleUtil::ReactorEnsembleTags tags( Expr::STATE_N ); @@ -394,36 +430,38 @@ parse_initial_inflow_conditions( const YAML::Node& parser, factory.register_expression( new MoleToMassT( tags.massTags, tags.moleTags, tags.mmwTag )); } - if( !hasMixtureFraction ){ + if(reactorType!="PFR"){ + if( !hasMixtureFraction ){ - if(( uninflowSpecies.size() == CanteraObjects::number_species())){ - std::ostringstream msg; - msg << "\nERROR from " << __FILE__ << " : " << __LINE__ - << "No species composition has been specified in the inflow conditions.\n\n"; - throw std::runtime_error( msg.str()); - } + if(( uninflowSpecies.size() == CanteraObjects::number_species())){ + std::ostringstream msg; + msg << "\nERROR from " << __FILE__ << " : " << __LINE__ + << "No species composition has been specified in the inflow conditions.\n\n"; + throw std::runtime_error( msg.str()); + } - // set unspecified inflow species mole fractions to zero - BOOST_FOREACH( const std::string& sp_inflow, uninflowSpecies ){ - typedef Expr::ConstantExpr::Builder ConstExpr; - if( sp_inflow == CanteraObjects::species_name( nspec - 1 )) continue; - const auto ix = CanteraObjects::species_index( sp_inflow ); - factory.register_expression( new ConstExpr( tags.moleInflowTags[ix], 0 )); - } - { // Species N - factory.register_expression( new SpeciesN( tags.moleInflowTags[nspec - 1], - Expr::tag_list( CanteraObjects::species_names(), Expr::STATE_N, "X_", - "_inflow" ), - pokitt::ERRORSPECN ), - true /* allow overwrite */ ); + // set unspecified inflow species mole fractions to zero + BOOST_FOREACH( const std::string& sp_inflow, uninflowSpecies ){ + typedef Expr::ConstantExpr::Builder ConstExpr; + if( sp_inflow == CanteraObjects::species_name( nspec - 1 )) continue; + const auto ix = CanteraObjects::species_index( sp_inflow ); + factory.register_expression( new ConstExpr( tags.moleInflowTags[ix], 0 )); + } + { // Species N + factory.register_expression( new SpeciesN( tags.moleInflowTags[nspec - 1], + Expr::tag_list( CanteraObjects::species_names(), Expr::STATE_N, "X_", + "_inflow" ), + pokitt::ERRORSPECN ), + true /* allow overwrite */ ); + } + factory.register_expression( new MoleToMassT( tags.massInflowTags, tags.moleInflowTags, tags.mmwInflowTag )); + factory.register_expression( new MixtureMWT( tags.mmwInflowTag, tags.moleInflowTags, pokitt::FractionType::MOLE )); + } + else{ + typedef pokitt::MixtureMolWeight::Builder MixtureMWT; + factory.register_expression( new MassToMoleT( tags.moleInflowTags, tags.massInflowTags, tags.mmwInflowTag )); + factory.register_expression( new MixtureMWT( tags.mmwInflowTag, tags.massInflowTags, pokitt::FractionType::MASS )); } - factory.register_expression( new MoleToMassT( tags.massInflowTags, tags.moleInflowTags, tags.mmwInflowTag )); - factory.register_expression( new MixtureMWT( tags.mmwInflowTag, tags.moleInflowTags, pokitt::FractionType::MOLE )); - } - else{ - typedef pokitt::MixtureMolWeight::Builder MixtureMWT; - factory.register_expression( new MassToMoleT( tags.moleInflowTags, tags.massInflowTags, tags.mmwInflowTag )); - factory.register_expression( new MixtureMWT( tags.mmwInflowTag, tags.massInflowTags, pokitt::FractionType::MASS )); } if(!parser["ReactorParameters"]["HeatTransferParameter"]){ @@ -507,15 +545,18 @@ parse_field_output( const YAML::Node& parser, insert( tags.dtTag ); insert( tags.expEigTag ); - if (parser["ReactorParameters"]["ReactorType"].as() == "ConstantVolume"){ + if (parser["ReactorParameters"]["ReactorType"].as() == "PSRConstantVolume"){ insert( tags.presTag ); for( size_t i=0; i() == "ConstantPressure"){ + if (parser["ReactorParameters"]["ReactorType"].as() == "PSRConstantPressure"){ insert( tags.rhoTag ); } + if (parser["ReactorParameters"]["ReactorType"].as() == "PFR"){ + insert( tags.presTag ); + } if(parser["Particles"]){ const Particles::ParticleEnsembleTags tagspart( Expr::STATE_NONE, particleNumArray ); diff --git a/src/particles/ParticleInterface.cpp b/src/particles/ParticleInterface.cpp index 1a5a01b..c656a64 100755 --- a/src/particles/ParticleInterface.cpp +++ b/src/particles/ParticleInterface.cpp @@ -45,6 +45,7 @@ #include "NusseltNumber.h" #include "SherwoodNumber.h" #include "ReactorVolume.h" +#include "PlugFlowReactor/PlugFlowReactorInterface.h" #include "ParticleInterface.h" #include "ParticleMassFraction.h" @@ -92,6 +93,8 @@ namespace Particles { typedef Particles::SourceFromGasMassChange::Builder SourceFromGasMassT; typedef Particles::ParticleNumber::Builder PartNumT; typedef Particles::ParticleTempMixing::Builder PartTempMixT; + typedef Particles::DensitySourceFromGasMassChange::Builder DensitySourceFromGasMassT; + typedef Particles::DpDxSourceFromGasMassChange::Builder DpDxSourceFromGasMassT; //--------------------------------------------------------------------------- @@ -99,16 +102,21 @@ namespace Particles { ParticleEnsembleTags:: ParticleEnsembleTags( const Expr::Context& state, const std::vector& particleNumArray) - : partTempInitTag ( Expr::Tag( "T_part_init" , state )), - partTempInflowTag ( Expr::Tag( "T_part_inflow" , state )), - partRhoInitTag ( Expr::Tag( "rho_part_init" , state )), - partRhoInflowTag ( Expr::Tag( "rho_part_inflow" , state )), - partCpInitTag ( Expr::Tag( "cp_part_init" , state )), - partConvecToGasTag ( Expr::Tag( "convection_part_to_gas", state )), - partRadiaToGasTag ( Expr::Tag( "radiation_part_to_gas" , state )), - tempRadiaWallTag ( Expr::Tag( "T_radia_wall" , state )), - partToGasMassTag ( Expr::Tag( "part_to_gas_mass" , state )), - gasEnthSrcTag ( Expr::Tag( "gas_enth_src" , state )) + : partTempInitTag ( Expr::Tag( "T_part_init" , state )), + partTempInflowTag ( Expr::Tag( "T_part_inflow" , state )), + partRhoInitTag ( Expr::Tag( "rho_part_init" , state )), + partRhoInflowTag ( Expr::Tag( "rho_part_inflow" , state )), + partCpInitTag ( Expr::Tag( "cp_part_init" , state )), + partConvecToGasTag ( Expr::Tag( "convection_part_to_gas" , state )), + partRadiaToGasTag ( Expr::Tag( "radiation_part_to_gas " , state )), + partConvecToGasPFRTag ( Expr::Tag( "convection_part_to_gas_pfr", state )), + partRadiaToGasPFRTag ( Expr::Tag( "radiation_part_to_gas_pfr" , state )), + tempRadiaWallTag ( Expr::Tag( "T_radia_wall" , state )), + partToGasMassTag ( Expr::Tag( "part_to_gas_mass" , state )), + gasEnthSrcTag ( Expr::Tag( "gas_enth_src" , state )), + gasEnthSrcPFRTag ( Expr::Tag( "gas_enth_src_pfr" , state )), + gasDensitySrcPFRTag ( Expr::Tag( "gas_density_src_pfr" , state )), + gasDpDxSrcPFRTag ( Expr::Tag( "gas_dpdx_src_pfr" , state )) { massEachPartTags = Expr::tag_list( particleNumArray, state, "mass_each_part_" ); partNumTags = Expr::tag_list( particleNumArray, state, "num_part_" ); @@ -125,6 +133,8 @@ namespace Particles { partTempMixRhsTags = Expr::tag_list( particleNumArray, state, "temp_part_", "_mix_rhs" ); partTempKinRhsTags = Expr::tag_list( particleNumArray, state, "temp_part_", "_kin_rhs" ); partTempHeatRhsTags = Expr::tag_list( particleNumArray, state, "temp_part_", "_heat_rhs" ); + partTempKinRhsPFRTags = Expr::tag_list( particleNumArray, state, "temp_part_", "_kin_rhs_pfr" ); + partTempHeatRhsPFRTags = Expr::tag_list( particleNumArray, state, "temp_part_", "_heat_rhs_pfr" ); partTempFullRhsTags = Expr::tag_list( particleNumArray, state, "temp_part_", "_full_rhs" ); partMassFracInitialTags = Expr::tag_list( particleNumArray, state, "mass_frac_part_", "_initial" ); partMassFracInflowTags = Expr::tag_list( particleNumArray, state, "mass_frac_part_", "_inflow" ); @@ -138,7 +148,8 @@ namespace Particles { shNumberTags = Expr::tag_list( particleNumArray, state, "sh_number_" ); reynoldsNumberTags = Expr::tag_list( particleNumArray, state, "re_number_part_" ); nusseltNumberTags = Expr::tag_list( particleNumArray, state, "nu_number_" ); - gasSpeciesSrcTags = Expr::tag_list( CanteraObjects::species_names(), state, "gas_species_src_"); + gasSpeciesSrcTags = Expr::tag_list( CanteraObjects::species_names(), state, "gas_species_src_" ); + gasSpeciesSrcPFRTags = Expr::tag_list( CanteraObjects::species_names(), state, "gas_species_src_pfr_"); } ParticleSetup::ParticleSetup( std::vector& particleNumArray, @@ -162,6 +173,7 @@ namespace Particles { coalimplement_(false), liquidimplement_(false) { + reactorType_ = rootParser_["ReactorParameters"]["ReactorType"].as(); if(rootParser_["Particles"]["ParticleType"].as() != "Coal"){ if(rootParser_["Particles"]["ParticleLoading"]){ npar_ = rootParser_["Particles"]["ParticleLoading"].as(); // number of particles per gas mass @@ -172,14 +184,16 @@ namespace Particles { throw std::runtime_error( msg.str()); } - if(rootParser_["Particles"]["ParticleLoadingInflow"]){ - nparInflow_ = rootParser_["Particles"]["ParticleLoadingInflow"].as(); - } - else{ - std::cout << "No inflow particle loading block, 'ParticleLoadingInflow', was found in 'Particles' block! \n" - "Inflow particle loading is set to be the same as initial particle loading\n" - << std::endl; - nparInflow_ = npar_; + if(reactorType_!="PFR"){ + if(rootParser_["Particles"]["ParticleLoadingInflow"]){ + nparInflow_ = rootParser_["Particles"]["ParticleLoadingInflow"].as(); + } + else{ + std::cout << "No inflow particle loading block, 'ParticleLoadingInflow', was found in 'Particles' block! \n" + "Inflow particle loading is set to be the same as initial particle loading\n" + << std::endl; + nparInflow_ = npar_; + } } } /** @@ -245,17 +259,19 @@ namespace Particles { initRoots_.insert( initFactory_.register_expression( new ConstantT( tagPart, val.as()))); } // Parser particle inflow conditions based on input file - if(rootParser_["Particles"]["InflowConditions"]){ - BOOST_FOREACH( const YAML::Node& parserPart_Spec, rootParser_["Particles"]["InflowConditions"] ){ - assert( parserPart_Spec.IsDefined()); - const YAML::Node& val = parserPart_Spec["value"]; - const Expr::Tag tagPart( parserPart_Spec["variable"].as(), Expr::STATE_N); - initRoots_.insert( initFactory_.register_expression( new ConstantT( tagPart, val.as()))); - } - } - else{ - initRoots_.insert( initFactory_.register_expression( new LinearT( tagsPart.partTempInflowTag, tagsPart.partTempInitTag, 1.0, 0.0))); - initRoots_.insert( initFactory_.register_expression( new LinearT( tagsPart.partRhoInflowTag, tagsPart.partRhoInitTag, 1.0, 0.0))); + if(reactorType_!="PFR"){ + if(rootParser_["Particles"]["InflowConditions"]){ + BOOST_FOREACH( const YAML::Node& parserPart_Spec, rootParser_["Particles"]["InflowConditions"] ){ + assert( parserPart_Spec.IsDefined()); + const YAML::Node& val = parserPart_Spec["value"]; + const Expr::Tag tagPart( parserPart_Spec["variable"].as(), Expr::STATE_N); + initRoots_.insert( initFactory_.register_expression( new ConstantT( tagPart, val.as()))); + } + } + else{ + initRoots_.insert( initFactory_.register_expression( new LinearT( tagsPart.partTempInflowTag, tagsPart.partTempInitTag, 1.0, 0.0))); + initRoots_.insert( initFactory_.register_expression( new LinearT( tagsPart.partRhoInflowTag, tagsPart.partRhoInitTag, 1.0, 0.0))); + } } std::vector ParticleSizeArray; @@ -269,29 +285,32 @@ namespace Particles { initFactory_.register_expression( new LinearT( tagsPart.partRhoTags[i], tagsPart.partRhoInitTag, 1, 0 )); initRoots_.insert( initFactory_.register_expression( new MassFracPartT( tagsPart.partMassFracTags[i], tagsPart.partRhoTags[i], tagsPart.partSizeTags[i], tagsPart.partNumFracTags[i]) ) ); + if(reactorType_!="PFR"){ + initRoots_.insert( initFactory_.register_expression( new LinearT( tagsPart.partTempInflowTags[i], tagsPart.partTempInflowTag, 1, 0))); + initRoots_.insert( initFactory_.register_expression( new MassFracPartT( tagsPart.partMassFracInflowTags[i], tagsPart.partRhoInflowTag, tagsPart.partSizeTags[i], + tagsPart.partNumFracInflowTags[i] ))); + } - initRoots_.insert( initFactory_.register_expression( new LinearT( tagsPart.partTempInflowTags[i], tagsPart.partTempInflowTag, 1, 0))); - initRoots_.insert( initFactory_.register_expression( new MassFracPartT( tagsPart.partMassFracInflowTags[i], tagsPart.partRhoInflowTag, tagsPart.partSizeTags[i], - tagsPart.partNumFracInflowTags[i] ))); if(rootParser_["Particles"]["ParticleType"].as() != "Coal" ){ initRoots_.insert( initFactory_.register_expression( new LinearT( tagsPart.partCpTags[i], tagsPart.partCpInitTag, 1, 0 ) ) ); if(rootParser_["Particles"]["Size"]["Distribution"].as() == "Identity"){ initRoots_.insert(initFactory_.register_expression( new ConstantT( tagsPart.partNumFracTags[i], npar_))); - initRoots_.insert( initFactory_.register_expression( new ConstantT(tagsPart.partNumFracInflowTags[i], nparInflow_))); + if(reactorType_!="PFR"){ initRoots_.insert( initFactory_.register_expression( new ConstantT(tagsPart.partNumFracInflowTags[i], nparInflow_))); } } else if(rootParser_["Particles"]["Size"]["Distribution"].as() == "UserDefinedList"){ const std::vector nparFracList = rootParser_["Particles"]["Size"]["NumbersFraction"].as >(); initRoots_.insert(initFactory_.register_expression( new ConstantT( tagsPart.partNumFracTags[i], npar_*nparFracList[i]))); - initRoots_.insert( initFactory_.register_expression( new ConstantT(tagsPart.partNumFracInflowTags[i], nparInflow_*nparFracList[i]))); + if(reactorType_!="PFR"){ initRoots_.insert( initFactory_.register_expression( new ConstantT(tagsPart.partNumFracInflowTags[i], nparInflow_*nparFracList[i])));} } else{ // npar/nparsize is always equal to 1 in the present code. initRoots_.insert(initFactory_.register_expression( new ConstantT( tagsPart.partNumFracTags[i], npar_/nparsize_))); - initRoots_.insert( initFactory_.register_expression( new ConstantT(tagsPart.partNumFracInflowTags[i], nparInflow_/nparsize_))); + if(reactorType_!="PFR"){ initRoots_.insert( initFactory_.register_expression( new ConstantT(tagsPart.partNumFracInflowTags[i], nparInflow_/nparsize_)));} } } initRoots_.insert( initFactory_.register_expression( new DivideT( tagsPart.massEachPartTags[i], tagsPart.partMassFracTags[i], tagsPart.partNumFracTags[i]))); initRoots_.insert( initFactory_.register_expression( new PartNumT( tagsPart.partNumTags[i], tagsPart.partNumFracTags[i], tags.rhoTag, tags.reactorVolumeTag))); + initRoots_.insert( initFactory_.register_expression( new LinearT( tagsPart.partMassFracInitialTags[i], tagsPart.partMassFracTags[i], 1.0, 0.0))); } const std::string reactorShape = rootParser_["ReactorParameters"]["ReactorShape"].as("Spherical"); @@ -307,6 +326,7 @@ namespace Particles { const Particles::ParticleEnsembleTags tagsEPart( Expr::STATE_NONE, particleNumArray_ ); const ReactorEnsembleUtil::ReactorEnsembleTags tagsE( Expr::STATE_NONE ); + const PlugFlowReactorInterface::PlugFlowReactorTags tagsEpfr( Expr::STATE_NONE ); Expr::ExpressionFactory& execFactory = integrator_->factory(); @@ -318,7 +338,7 @@ namespace Particles { // viscosity is set to be constant in present code. // execFactory.register_expression( new ViscosityT( tagsE.dynviscosityTag, tagsE. tempTag, tagsE.massTags ) ); execFactory.register_expression( new PlaceHolderT( tagsE.dynviscosityTag )); - if(rootParser_["ReactorParameters"]["ReactorType"].as() == "ConstantVolume"){ + if(reactorType_ == "PSRConstantVolume"){ execFactory.register_expression( new HeatCpT( tagsE.cpTag, tagsE.tempTag, tagsE.massTags )); } @@ -339,36 +359,47 @@ namespace Particles { integrator_->register_root_expression( new RhoPartT( tagsEPart.partRhoTags[i], tagsEPart.partMassFracTags[i], tagsEPart.partSizeTags[i], tagsEPart.partNumFracTags[i])); } - execFactory.register_expression( new PlaceHolderT( tagsEPart.partTempInflowTags[i] )); - execFactory.register_expression( new PlaceHolderT( tagsEPart.partMassFracInflowTags[i] )); - execFactory.register_expression( new PlaceHolderT( tagsEPart.partNumFracInflowTags[i] )); - execFactory.register_expression( new LinearT( tagsEPart.partMassFracInitialTags[i], tagsEPart.partMassFracInflowTags[i], 1.0, 0.0)); + integrator_->register_root_expression( new PlaceHolderT( tagsEPart.partMassFracInitialTags[i] )); - // particle equations if(rootParser_["Particles"]["ParticleType"].as() != "Coal" ){ - execFactory.register_expression( new PartTempMixT( tagsEPart.partTempMixRhsTags[i], tagsEPart.partTempTags[i], tagsEPart.partTempInflowTags[i], - tagsEPart.partMassFracTags[i], tagsEPart.partMassFracInflowTags[i], tagsE.tauMixTag, tagsE.rhoInflowTag, tagsE.rhoTag ) ); execFactory.register_expression( new PlaceHolderT( tagsEPart.partCpTags[i] )); } - execFactory.register_expression( new ZeroDMixingCPT( tagsEPart.partNumFracMixRhsTags[i], tagsEPart.partNumFracInflowTags[i], tagsEPart.partNumFracTags[i], - tagsE.tauMixTag, tagsE.rhoInflowTag, tagsE.rhoTag )); - execFactory.register_expression( new ZeroDMixingCPT( tagsEPart.partMassFracMixRhsTags[i], tagsEPart.partMassFracInflowTags[i], tagsEPart.partMassFracTags[i], - tagsE.tauMixTag, tagsE.rhoInflowTag, tagsE.rhoTag ) ); - execFactory.register_expression( new NuNumberT( tagsEPart.nusseltNumberTags[i], tagsE.cpTag, tagsE.dynviscosityTag, tagsE.thermalConducTag, tagsEPart.reynoldsNumberTags[i] ) ); execFactory.register_expression( new ConvectionPartT( tagsEPart.partConvecTags[i], tagsE.tempTag, tagsEPart.partTempTags[i], tagsEPart.partSizeTags[i], tagsE.thermalConducTag, tagsEPart.nusseltNumberTags[i], tagsEPart.partMassFracTags[i], tagsEPart.partCpTags[i], - tagsEPart.partNumFracTags[i]) ); + tagsEPart.partNumFracTags[i] )); + // particle equations + if(reactorType_ != "PFR"){ + execFactory.register_expression( new PlaceHolderT( tagsEPart.partTempInflowTags[i] )); + execFactory.register_expression( new PlaceHolderT( tagsEPart.partNumFracInflowTags[i] )); + execFactory.register_expression( new PlaceHolderT( tagsEPart.partMassFracInflowTags[i] )); + if( rootParser_["Particles"]["ParticleType"].as() != "Coal" ){ + execFactory.register_expression( new PartTempMixT( tagsEPart.partTempMixRhsTags[i], tagsEPart.partTempTags[i], tagsEPart.partTempInflowTags[i], + tagsEPart.partMassFracTags[i], tagsEPart.partMassFracInflowTags[i], tagsE.tauMixTag, + tagsE.rhoInflowTag, tagsE.rhoTag )); + } + execFactory.register_expression( new ZeroDMixingCPT( tagsEPart.partNumFracMixRhsTags[i], tagsEPart.partNumFracInflowTags[i], tagsEPart.partNumFracTags[i], + tagsE.tauMixTag, tagsE.rhoInflowTag, tagsE.rhoTag )); + execFactory.register_expression( new ZeroDMixingCPT( tagsEPart.partMassFracMixRhsTags[i], tagsEPart.partMassFracInflowTags[i], tagsEPart.partMassFracTags[i], + tagsE.tauMixTag, tagsE.rhoInflowTag, tagsE.rhoTag )); + + execFactory.register_expression( new SumOpT( tagsEPart.partNumFracFullRhsTags[i], {tagsEPart.partNumFracMixRhsTags[i], tagsEPart.partNumFracKinRhsTags[i]})); + execFactory.register_expression( new SumOpT( tagsEPart.partTempFullRhsTags[i], {tagsEPart.partTempMixRhsTags[i], tagsEPart.partTempHeatRhsTags[i], tagsEPart.partTempKinRhsTags[i] } ) ); + execFactory.register_expression( new SumOpT( tagsEPart.partMassFracFullRhsTags[i], {tagsEPart.partMassFracMixRhsTags[i], tagsEPart.partMassFracKinRhsTags[i] }) ); + } + if(reactorType_ == "PFR"){ + execFactory.register_expression( new DivideT( tagsEPart.partNumFracFullRhsTags[i], tagsEPart.partNumFracKinRhsTags[i], tagsEpfr.uTag)); + execFactory.register_expression( new DivideT( tagsEPart.partMassFracFullRhsTags[i], tagsEPart.partMassFracKinRhsTags[i], tagsEpfr.uTag)); + execFactory.register_expression( new DivideT( tagsEPart.partTempHeatRhsPFRTags[i], tagsEPart.partTempHeatRhsTags[i], tagsEpfr.uTag)); + execFactory.register_expression( new DivideT( tagsEPart.partTempKinRhsPFRTags[i], tagsEPart.partTempKinRhsTags[i], tagsEpfr.uTag)); + execFactory.register_expression( new SumOpT( tagsEPart.partTempFullRhsTags[i], {tagsEPart.partTempHeatRhsPFRTags[i], tagsEPart.partTempKinRhsPFRTags[i] } ) ); + } // massSourceTag has been divided by (rho*V) execFactory.register_expression( new SourceFromGasMassT( tagsEPart.partMassFracKinRhsTags[i], tagsEPart.partToGasMassTag, tagsEPart.partMassFracTags[i])); execFactory.register_expression( new SourceFromGasMassT( tagsEPart.partNumFracKinRhsTags[i], tagsEPart.partToGasMassTag, tagsEPart.partNumFracTags[i])); execFactory.register_expression( new ConstantT( tagsEPart.partTempKinRhsTags[i], 0.0 ) ); - - execFactory.register_expression( new SumOpT( tagsEPart.partNumFracFullRhsTags[i], {tagsEPart.partNumFracMixRhsTags[i], tagsEPart.partNumFracKinRhsTags[i]})); execFactory.register_expression( new SumOpT( tagsEPart.partTempHeatRhsTags[i], {tagsEPart.partGasRadiaTags[i], tagsEPart.partWallRadiaTags[i], tagsEPart.partConvecTags[i] } ) ); - execFactory.register_expression( new SumOpT( tagsEPart.partTempFullRhsTags[i], {tagsEPart.partTempMixRhsTags[i], tagsEPart.partTempHeatRhsTags[i], tagsEPart.partTempKinRhsTags[i] } ) ); - execFactory.register_expression( new SumOpT( tagsEPart.partMassFracFullRhsTags[i], {tagsEPart.partMassFracMixRhsTags[i], tagsEPart.partMassFracKinRhsTags[i] }) ); equIndex_ = equIndex_ + 1; integrator_->add_variable( tagsEPart.partNumFracTags[i].name(), tagsEPart.partNumFracFullRhsTags[i], equIndex_, equIndex_ ); @@ -381,13 +412,31 @@ namespace Particles { integrator_->register_root_expression( new PartNumT( tagsEPart.partNumTags[i], tagsEPart.partNumFracTags[i], tagsE.rhoTag, tagsE.reactorVolumeTag)); } // modify gas phase equations - if(rootParser_["ReactorParameters"]["ReactorType"].as() == "ConstantPressure"){ + if(reactorType_ == "PSRConstantPressure" or reactorType_ == "PFR"){ const int ns = CanteraObjects::number_species(); execFactory.register_expression( new SourceFromGasMassT( tagsEPart.gasEnthSrcTag, tagsEPart.partToGasMassTag, tagsE.enthTag)); - execFactory.attach_dependency_to_expression( tagsEPart.gasEnthSrcTag, tagsE.enthKinRhsTag, Expr::ADD_SOURCE_EXPRESSION); + if(reactorType_ == "PSRConstantPressure"){ + execFactory.attach_dependency_to_expression( tagsEPart.gasEnthSrcTag, tagsE.enthKinRhsTag, Expr::ADD_SOURCE_EXPRESSION); + } + else{ + execFactory.register_expression( new DensitySourceFromGasMassT( tagsEPart.gasDensitySrcPFRTag, tagsEPart.partToGasMassTag, tagsE.rhoTag, tagsEpfr.uTag)); + execFactory.attach_dependency_to_expression( tagsEPart.gasDensitySrcPFRTag, tagsE.rhoFullRhsTag, Expr::ADD_SOURCE_EXPRESSION); + execFactory.register_expression( new DivideT( tagsEPart.gasEnthSrcPFRTag, tagsEPart.gasEnthSrcTag, tagsEpfr.uTag)); + execFactory.attach_dependency_to_expression( tagsEPart.gasEnthSrcPFRTag, tagsE.enthFullRhsTag, Expr::ADD_SOURCE_EXPRESSION); + execFactory.attach_dependency_to_expression( tagsEPart.partToGasMassTag, tagsEpfr.uFullRhsTag, Expr::SUBTRACT_SOURCE_EXPRESSION); + execFactory.register_expression( new DpDxSourceFromGasMassT( tagsEPart.gasDpDxSrcPFRTag, tagsEPart.partToGasMassTag, tagsE.rhoTag, tagsE.tempTag, tagsE.enthTag, + tagsE.mmwTag, tagsE.cpTag, tagsEpfr.uTag )); + execFactory.attach_dependency_to_expression( tagsEPart.gasDpDxSrcPFRTag, tagsEpfr.dpdxTag, Expr::ADD_SOURCE_EXPRESSION); + } + for( size_t j=0; jcopy_from_initial_condition_to_execution( tagsEPart.partTempInflowTags[i].name()); - integrator_->copy_from_initial_condition_to_execution( tagsEPart.partNumFracInflowTags[i].name()); - integrator_->copy_from_initial_condition_to_execution( tagsEPart.partMassFracInflowTags[i].name()); + if(reactorType_!="PFR"){ + integrator_->copy_from_initial_condition_to_execution( tagsEPart.partTempInflowTags[i].name()); + integrator_->copy_from_initial_condition_to_execution( tagsEPart.partNumFracInflowTags[i].name()); + integrator_->copy_from_initial_condition_to_execution( tagsEPart.partMassFracInflowTags[i].name()); + } + integrator_->copy_from_initial_condition_to_execution( tagsEPart.partMassFracInitialTags[i].name()); if(rootParser_["Particles"]["ParticleType"].as() != "Coal" ){ integrator_->copy_from_initial_condition_to_execution( tagsEPart.partCpTags[i].name()); } @@ -432,9 +491,12 @@ namespace Particles { integrator_->copy_from_initial_condition_to_execution( tagsE.reactorVolumeTag.name()); } for( size_t i = 0;i < nparsize_;i++ ){ - integrator_->lock_field( tagsEPart.partTempInflowTags[i] ); - integrator_->lock_field( tagsEPart.partNumFracInflowTags[i] ); - integrator_->lock_field( tagsEPart.partMassFracInflowTags[i] ); + if(reactorType_!="PFR"){ + integrator_->lock_field( tagsEPart.partTempInflowTags[i] ); + integrator_->lock_field( tagsEPart.partNumFracInflowTags[i] ); + integrator_->lock_field( tagsEPart.partMassFracInflowTags[i] ); + } + integrator_->lock_field( tagsEPart.partMassFracInitialTags[i] ); if(rootParser_["Particles"]["ParticleType"].as() != "Coal" ){ integrator_->lock_field( tagsEPart.partCpTags[i] ); } @@ -543,6 +605,7 @@ namespace Particles { // build the expressions implied by these quantities const ReactorEnsembleUtil::ReactorEnsembleTags tagsE( Expr::STATE_NONE ); + const PlugFlowReactorInterface::PlugFlowReactorTags tagsEpfr( Expr::STATE_NONE ); const Particles::ParticleEnsembleTags tagsEPart( Expr::STATE_NONE, particleNumArray_ ); Expr::ExpressionFactory& execFactory = integrator_->factory(); @@ -573,17 +636,26 @@ namespace Particles { } //modify gas equations - if(rootParser_["ReactorParameters"]["ReactorType"].as() == "ConstantVolume"){ + if(reactorType_ == "PSRConstantVolume"){ execFactory.register_expression( new PartToGasHeatCVT( tagsEPart.partConvecToGasTag, tagsEPart.partConvecTags, tagsEPart.partMassFracTags, tagsEPart.partCpTags, tagsE.rhoTag )); execFactory.attach_dependency_to_expression(tagsEPart.partConvecToGasTag, tagsE.rhoEgyHeatRhsTag, Expr::ADD_SOURCE_EXPRESSION); execFactory.register_expression( new PartToGasHeatCVT( tagsEPart.partRadiaToGasTag, tagsEPart.partGasRadiaTags, tagsEPart.partMassFracTags, tagsEPart.partCpTags, tagsE.rhoTag )); execFactory.attach_dependency_to_expression(tagsEPart.partRadiaToGasTag, tagsE.rhoEgyHeatRhsTag, Expr::ADD_SOURCE_EXPRESSION); } - else{ + if(reactorType_ == "PSRConstantPressure" or reactorType_ == "PFR"){ execFactory.register_expression( new PartToGasHeatCPT( tagsEPart.partConvecToGasTag, tagsEPart.partConvecTags, tagsEPart.partMassFracTags, tagsEPart.partCpTags)); - execFactory.attach_dependency_to_expression(tagsEPart.partConvecToGasTag, tagsE.enthHeatRhsTag, Expr::ADD_SOURCE_EXPRESSION); execFactory.register_expression( new PartToGasHeatCPT( tagsEPart.partRadiaToGasTag, tagsEPart.partGasRadiaTags, tagsEPart.partMassFracTags, tagsEPart.partCpTags)); - execFactory.attach_dependency_to_expression(tagsEPart.partRadiaToGasTag, tagsE.enthHeatRhsTag, Expr::ADD_SOURCE_EXPRESSION); + + if(reactorType_ == "PSRConstantPressure"){ + execFactory.attach_dependency_to_expression(tagsEPart.partConvecToGasTag, tagsE.enthHeatRhsTag, Expr::ADD_SOURCE_EXPRESSION); + execFactory.attach_dependency_to_expression(tagsEPart.partRadiaToGasTag, tagsE.enthHeatRhsTag, Expr::ADD_SOURCE_EXPRESSION); + } + else{ + execFactory.register_expression( new DivideT( tagsEPart.partConvecToGasPFRTag, tagsEPart.partConvecToGasTag, tagsEpfr.uTag )); + execFactory.register_expression( new DivideT( tagsEPart.partRadiaToGasPFRTag, tagsEPart.partRadiaToGasTag, tagsEpfr.uTag )); + execFactory.attach_dependency_to_expression(tagsEPart.partConvecToGasPFRTag, tagsE.enthHeatRhsTag, Expr::ADD_SOURCE_EXPRESSION); + execFactory.attach_dependency_to_expression(tagsEPart.partRadiaToGasPFRTag, tagsE.enthHeatRhsTag, Expr::ADD_SOURCE_EXPRESSION); + } } std::cout << std::endl; @@ -591,9 +663,10 @@ namespace Particles { << "-----------------------------------------" << std::endl << std::endl; if (!coalimplement_){ - std::cout << " - particle loading for initial condition : " << npar_ << std::endl - << " - particle loading for inflow stream : " << nparInflow_ << std::endl - << std::endl; + std::cout << " - particle loading for initial condition : " << npar_ << std::endl; + if(reactorType_!="PFR"){ + std::cout << " - particle loading for inflow stream : " << nparInflow_ << std::endl; + } } std::cout << " - number of particles size : " << nparsize_ << std::endl << " - particle emissivity : " << emissivityPartWall << std::endl @@ -618,9 +691,16 @@ namespace Particles { primVarIdxMap[tagsEPart.partMassFracTags[i]] = consVarIdxMap.at( tagsEPart.partMassFracTags[i] ); primVarIdxMap[tagsEPart.partTempTags[i]] = consVarIdxMap.at( tagsEPart.partTempTags[i] ); - kinRhsIdxMap[tagsEPart.partNumFracKinRhsTags[i]] = rhsIdxMap.at( tagsEPart.partNumFracFullRhsTags[i] ); - kinRhsIdxMap[tagsEPart.partMassFracKinRhsTags[i]] = rhsIdxMap.at( tagsEPart.partMassFracFullRhsTags[i] ); - kinRhsIdxMap[tagsEPart.partTempKinRhsTags[i]] = rhsIdxMap.at( tagsEPart.partTempFullRhsTags[i] ); + if(reactorType_ != "PFR"){ + kinRhsIdxMap[tagsEPart.partNumFracKinRhsTags[i]] = rhsIdxMap.at( tagsEPart.partNumFracFullRhsTags[i] ); + kinRhsIdxMap[tagsEPart.partMassFracKinRhsTags[i]] = rhsIdxMap.at( tagsEPart.partMassFracFullRhsTags[i] ); + kinRhsIdxMap[tagsEPart.partTempKinRhsTags[i]] = rhsIdxMap.at( tagsEPart.partTempFullRhsTags[i] ); + } + else{ + kinRhsIdxMap[tagsEPart.partNumFracFullRhsTags[i]] = rhsIdxMap.at( tagsEPart.partNumFracFullRhsTags[i] ); + kinRhsIdxMap[tagsEPart.partMassFracFullRhsTags[i]] = rhsIdxMap.at( tagsEPart.partMassFracFullRhsTags[i] ); + kinRhsIdxMap[tagsEPart.partTempFullRhsTags[i]] = rhsIdxMap.at( tagsEPart.partTempFullRhsTags[i] ); + } } if(coalimplement_ ){ CoalInterface_->modify_idxmap_coal( primVarIdxMap, consVarIdxMap, kinRhsIdxMap, rhsIdxMap ); @@ -667,7 +747,7 @@ namespace Particles { Expr::Tag erg_enth; Expr::Tag qGas; - if(rootParser_["ReactorParameters"]["ReactorType"].as() == "ConstantVolume"){ + if(reactorType_ == "PSRConstantVolume"){ erg_enth = tagsE.rhoEgyTag; qGas = tagsE.rhoEgyHeatRhsTag; } @@ -701,7 +781,7 @@ namespace Particles { for( size_t j = 0;j < nspec-1;j++ ){ dqdVPart->element( erg_enthRhsIdx, primVarIdxMap.at( massFrac[j] )) = sensitivity( qGas, massFrac[j] ); } - if(rootParser_["ReactorParameters"]["ReactorType"].as() == "ConstantVolume"){ + if(reactorType_ == "PSRConstantVolume"){ dqdVPart->element( erg_enthRhsIdx, primVarIdxMap.at( rho ) ) = sensitivity( qGas, rho ); } dqdVPart->finalize(); diff --git a/src/particles/ParticleInterface.h b/src/particles/ParticleInterface.h index f7b5d39..7b5036f 100755 --- a/src/particles/ParticleInterface.h +++ b/src/particles/ParticleInterface.h @@ -57,9 +57,14 @@ namespace Particles { partCpInitTag, ///< particle initial heat capacity from input file, mainly for solid and liquid particles partConvecToGasTag, ///< convection between gas and part in gas enthalpy equation partRadiaToGasTag, ///< radiation between gas and part in gas enthalpy equation + partConvecToGasPFRTag, ///< convection between gas and part in gas enthalpy equation for plug flow reactor + partRadiaToGasPFRTag, ///< radiation between gas and part in gas enthalpy equation for plug flow reactor tempRadiaWallTag, ///< wall temperature having radiation heat transfer with particles partToGasMassTag, ///< mass from particle to gas - gasEnthSrcTag; ///< gas enthalpy source term because of the change of gas mass + gasEnthSrcTag, ///< gas enthalpy source term because of the change of gas mass + gasEnthSrcPFRTag, ///< gas enthalpy source term because of the change of gas mass for plug flow reactor + gasDensitySrcPFRTag, ///< gas density source term because of the change of gas mass for plug flow reactor + gasDpDxSrcPFRTag; /// change of `Dp/Dx` term because of the change of gas mass for plug flow reactor Expr::TagList massEachPartTags, ///< mass of each particle partNumTags, ///< number of particles partNumFracTags, ///< number of particles per mass of gas in the reactor @@ -75,6 +80,8 @@ namespace Particles { partTempMixRhsTags, ///< mixing RHS of particle enthalpy equation partTempKinRhsTags, ///< kinetics RHS of particle enthalpy equation partTempHeatRhsTags, ///< heat transfer RHS of particle enthalpy equation + partTempKinRhsPFRTags, ///< kinetics RHS of particle enthalpy equation for plug flow reactor + partTempHeatRhsPFRTags, ///< heat transfer RHS of particle enthalpy equation for plug flow reactor partTempFullRhsTags, ///< full RHS of particle enthalpy equation partMassFracInitialTags, ///< initial particle mass fraction partMassFracInflowTags, ///< inflowing particle mass fraction @@ -88,7 +95,8 @@ namespace Particles { shNumberTags, ///< sherwood number -- used to get mass transfer coefficient reynoldsNumberTags, ///< particle Re number nusseltNumberTags, ///< Nu number -- used to get convective coefficient between gas and particle - gasSpeciesSrcTags; ///< gas speices source term because of the change of gas mass + gasSpeciesSrcTags, ///< gas speices source term because of the change of gas mass + gasSpeciesSrcPFRTags; ///< gas speices source term because of the change of gas mass in plug flow reactor ParticleEnsembleTags( const Expr::Context& state, const std::vector& particleNumArray); }; @@ -114,6 +122,7 @@ namespace Particles { const bool isRestart_; double npar_, nparInflow_; // number of particles per gas mass int nparsize_; // number of particle size + std::string reactorType_; public: /** diff --git a/src/particles/ParticleTransformExpressions.h b/src/particles/ParticleTransformExpressions.h index fb61735..aff3e8a 100755 --- a/src/particles/ParticleTransformExpressions.h +++ b/src/particles/ParticleTransformExpressions.h @@ -59,77 +59,77 @@ namespace Particles { */ template class PartToGasHeatCP: public Expr::Expression { - DECLARE_VECTOR_OF_FIELDS(FieldT, particleTerms_); - DECLARE_VECTOR_OF_FIELDS(FieldT, massFracParts_); - DECLARE_VECTOR_OF_FIELDS(FieldT, cpParts_ ); - const int nparsize_; + DECLARE_VECTOR_OF_FIELDS(FieldT, particleTerms_); + DECLARE_VECTOR_OF_FIELDS(FieldT, massFracParts_); + DECLARE_VECTOR_OF_FIELDS(FieldT, cpParts_ ); + const int nparsize_; + + PartToGasHeatCP( const Expr::TagList particleTermTags, + const Expr::TagList massFracPartTags, + const Expr::TagList cpPartTags) + : Expr::Expression(), + nparsize_(particleTermTags.size()) + { + this->set_gpu_runnable( true ); + this->template create_field_vector_request ( particleTermTags, particleTerms_); + this->template create_field_vector_request ( massFracPartTags, massFracParts_); + this->template create_field_vector_request ( cpPartTags, cpParts_); + } - PartToGasHeatCP( const Expr::TagList particleTermTags, + public: + class Builder : public Expr::ExpressionBuilder { + const Expr::TagList particleTermTags_, massFracPartTags_, cpPartTags_; + public: + /** + * @brief The mechanism for building a PartToGasHeatCP object + * @tparam FieldT + * @param partToGasHeatTag Convective heat transfer from particles to gas + * @param particleTermTags List of convective heat transfer term between particle and gas in particle temperature equation + * @param massFracPartTags List of particle mass fraction + * @param cpPartTags List of particle specific heat capacity + */ + Builder( const Expr::Tag partToGasHeatTag, + const Expr::TagList particleTermTags, const Expr::TagList massFracPartTags, const Expr::TagList cpPartTags) - : Expr::Expression(), - nparsize_(particleTermTags.size()) - { - this->set_gpu_runnable( true ); - this->template create_field_vector_request ( particleTermTags, particleTerms_); - this->template create_field_vector_request ( massFracPartTags, massFracParts_); - this->template create_field_vector_request ( cpPartTags, cpParts_); - } - - public: - class Builder : public Expr::ExpressionBuilder { - const Expr::TagList particleTermTags_, massFracPartTags_, cpPartTags_; - public: - /** - * @brief The mechanism for building a PartToGasHeatCP object - * @tparam FieldT - * @param partToGasHeatTag Convective heat transfer from particles to gas - * @param particleTermTags List of convective heat transfer term between particle and gas in particle temperature equation - * @param massFracPartTags List of particle mass fraction - * @param cpPartTags List of particle specific heat capacity - */ - Builder( const Expr::Tag partToGasHeatTag, - const Expr::TagList particleTermTags, - const Expr::TagList massFracPartTags, - const Expr::TagList cpPartTags) - : Expr::ExpressionBuilder( partToGasHeatTag ), - particleTermTags_ ( particleTermTags ), - massFracPartTags_ ( massFracPartTags ), - cpPartTags_ ( cpPartTags ){} - - ~Builder(){} - - Expr::ExpressionBase* build() const{ - return new PartToGasHeatCP( particleTermTags_, massFracPartTags_, cpPartTags_); - } - }; + : Expr::ExpressionBuilder( partToGasHeatTag ), + particleTermTags_ ( particleTermTags ), + massFracPartTags_ ( massFracPartTags ), + cpPartTags_ ( cpPartTags ){} - void evaluate(){ - using namespace SpatialOps; - FieldT& result = this->value(); - result <<= 0; - for ( size_t i = 0; i < nparsize_; ++i){ - result <<= result - particleTerms_[i]->field_ref() * ( massFracParts_[i]->field_ref() * cpParts_[i]->field_ref()); - } - } - - void sensitivity( const Expr::Tag& sensVarTag ){ - FieldT& dfdv = this->sensitivity_result( sensVarTag ); - FieldT& result = this->value(); - dfdv <<= 0; - for ( size_t i = 0; i< nparsize_; ++i){ - const FieldT& particleTermi = particleTerms_[i]->field_ref(); - const FieldT& massFracParti = massFracParts_[i]->field_ref(); - const FieldT& cpParti = cpParts_[i]->field_ref(); - const FieldT& dparticleTermdvi = particleTerms_[i]->sens_field_ref(sensVarTag); - const FieldT& dmassFracPartdvi = massFracParts_[i]->sens_field_ref(sensVarTag); - const FieldT& dcpPartdvi = cpParts_[i]->sens_field_ref(sensVarTag); - dfdv <<= dfdv - ( dparticleTermdvi * massFracParti * cpParti - + particleTermi * dmassFracPartdvi * cpParti - + particleTermi * massFracParti * dcpPartdvi); - } - } - }; + ~Builder(){} + + Expr::ExpressionBase* build() const{ + return new PartToGasHeatCP( particleTermTags_, massFracPartTags_, cpPartTags_); + } + }; + + void evaluate(){ + using namespace SpatialOps; + FieldT& result = this->value(); + result <<= 0; + for ( size_t i = 0; i < nparsize_; ++i){ + result <<= result - particleTerms_[i]->field_ref() * ( massFracParts_[i]->field_ref() * cpParts_[i]->field_ref()); + } + } + + void sensitivity( const Expr::Tag& sensVarTag ){ + FieldT& dfdv = this->sensitivity_result( sensVarTag ); + FieldT& result = this->value(); + dfdv <<= 0; + for ( size_t i = 0; i< nparsize_; ++i){ + const FieldT& particleTermi = particleTerms_[i]->field_ref(); + const FieldT& massFracParti = massFracParts_[i]->field_ref(); + const FieldT& cpParti = cpParts_[i]->field_ref(); + const FieldT& dparticleTermdvi = particleTerms_[i]->sens_field_ref(sensVarTag); + const FieldT& dmassFracPartdvi = massFracParts_[i]->sens_field_ref(sensVarTag); + const FieldT& dcpPartdvi = cpParts_[i]->sens_field_ref(sensVarTag); + dfdv <<= dfdv - ( dparticleTermdvi * massFracParti * cpParti + + particleTermi * dmassFracPartdvi * cpParti + + particleTermi * massFracParti * dcpPartdvi); + } + } + }; /** * @class PartToGasHeatCV @@ -182,15 +182,15 @@ namespace Particles { const Expr::TagList massFracPartTags_, cpPartTags_; const Expr::Tag rhoTag_; public: - /** - * @brief The mechanism for building a PartToGasHeatCP object - * @tparam FieldT - * @param partToGasHeatTag Convective heat transfer from particles to gas - * @param particleTermTags List of convective heat transfer term between particle and gas in particle temperature equation - * @param massFracPartTags List of particle mass fraction - * @param cpPartTags List of particle specific heat capacity - * @param rhoTag Density of gas phase - */ + /** + * @brief The mechanism for building a PartToGasHeatCP object + * @tparam FieldT + * @param partToGasHeatTag Convective heat transfer from particles to gas + * @param particleTermTags List of convective heat transfer term between particle and gas in particle temperature equation + * @param massFracPartTags List of particle mass fraction + * @param cpPartTags List of particle specific heat capacity + * @param rhoTag Density of gas phase + */ Builder( const Expr::Tag partToGasHeatTag, const Expr::TagList particleTermTags, const Expr::TagList massFracPartTags, @@ -232,9 +232,9 @@ namespace Particles { const FieldT& dmassFracPartdvi = massFracParts_[i]->sens_field_ref(sensVarTag); const FieldT& dcpPartdvi = cpParts_[i]->sens_field_ref(sensVarTag); dfdv <<= dfdv - ( dparticleTermdvi * massFracParti * cpParti * rho - + particleTermi * dmassFracPartdvi * cpParti * rho - + particleTermi * massFracParti * dcpPartdvi * rho - + particleTermi * massFracParti * cpParti * drhodv); + + particleTermi * dmassFracPartdvi * cpParti * rho + + particleTermi * massFracParti * dcpPartdvi * rho + + particleTermi * massFracParti * cpParti * drhodv); } } }; @@ -278,14 +278,14 @@ namespace Particles { class Builder : public Expr::ExpressionBuilder { const Expr::Tag sourceTermTag_, massSourceTermTag_, gasTermTag_; public: - /** - * @brief The mechanism for building a PartToGasV object - * @tparam FieldT - * @param rhsTag rhs terms in species/energy equation from qll particles to gas - * @param sourceTermTag source term for species/energy from all particles to gas - * @param massSourceTermTag source term for mass from all particles to gas - * @param gasTermTag Gas phase parameter: h or Y_i - */ + /** + * @brief The mechanism for building a PartToGasV object + * @tparam FieldT + * @param rhsTag rhs terms in species/energy equation from qll particles to gas + * @param sourceTermTag source term for species/energy from all particles to gas + * @param massSourceTermTag source term for mass from all particles to gas + * @param gasTermTag Gas phase parameter: h or Y_i + */ Builder( const Expr::Tag rhsTag, const Expr::Tag sourceTermTag, const Expr::Tag massSourceTermTag, @@ -359,13 +359,13 @@ namespace Particles { class Builder : public Expr::ExpressionBuilder { const Expr::Tag sourceTermTag_, rhoTag_; public: - /** - * @brief The mechanism for building a PartToGasV object - * @tparam FieldT - * @param rhsTag rhs terms in mass/energy equation from qll particles to gas - * @param sourceTermTag source term for mass/energy from all particles to gas - * @param rhoTag Density of gas phase - */ + /** + * @brief The mechanism for building a PartToGasV object + * @tparam FieldT + * @param rhsTag rhs terms in mass/energy equation from qll particles to gas + * @param sourceTermTag source term for mass/energy from all particles to gas + * @param rhoTag Density of gas phase + */ Builder( const Expr::Tag rhsTag, const Expr::Tag sourceTermTag, const Expr::Tag rhoTag) @@ -428,12 +428,12 @@ namespace Particles { class Builder : public Expr::ExpressionBuilder { const Expr::TagList particleTermTags_; public: - /** - * @brief The mechasism for building a PartSummation object - * @tparam FieldT - * @param partSummationTag Sum of all particle terms - * @param particleTermTags List of particle parameters - */ + /** + * @brief The mechasism for building a PartSummation object + * @tparam FieldT + * @param partSummationTag Sum of all particle terms + * @param particleTermTags List of particle parameters + */ Builder( const Expr::Tag partSummationTag, const Expr::TagList particleTermTags) : Expr::ExpressionBuilder( partSummationTag ), @@ -489,7 +489,7 @@ namespace Particles { GasMassSourceFromPart( const Expr::TagList particleTermTags) : Expr::Expression(), - nsize_(particleTermTags.size()) + nsize_(particleTermTags.size()) { this->set_gpu_runnable( true ); this->template create_field_vector_request ( particleTermTags, particleTerms_); @@ -500,12 +500,12 @@ namespace Particles { class Builder : public Expr::ExpressionBuilder { const Expr::TagList particleTermTags_; public: - /** - * @brief The mechanism for building a GasMassSourceFromPart object - * @tparam FieldT - * @param resultTag Gas source term from particles - * @param particleTermTags List of particle parameters - */ + /** + * @brief The mechanism for building a GasMassSourceFromPart object + * @tparam FieldT + * @param resultTag Gas source term from particles + * @param particleTermTags List of particle parameters + */ Builder( const Expr::Tag resultTag, const Expr::TagList particleTermTags) : Expr::ExpressionBuilder( resultTag ), @@ -573,13 +573,13 @@ namespace Particles { const Expr::TagList particleTermTags_; const int nspecies_; public: - /** - * @brief The mechanism for building a SpeciesSourceFromPart vector - * @tparam FieldT - * @param resultTags Species source from particle to gas - * @param particleTermTags List of particle parameters - * @param nspecies number of species - */ + /** + * @brief The mechanism for building a SpeciesSourceFromPart vector + * @tparam FieldT + * @param resultTags Species source from particle to gas + * @param particleTermTags List of particle parameters + * @param nspecies number of species + */ Builder( const Expr::TagList resultTags, const Expr::TagList particleTermTags, const int nspecies) @@ -632,7 +632,7 @@ namespace Particles { * * The result is given as * \f[ - * S_i = - \frac{S_{m,g} * \phi} + * S_i = - S_{m,g} \phi * \f] * Here, \f$ S_{m,g} \f$ is the source term for gas phase mass. It has been divided by \f$\rho V\f$. * \f$ \phi \f$ is the calculated parameter. @@ -643,9 +643,9 @@ namespace Particles { class SourceFromGasMassChange: public Expr::Expression { DECLARE_FIELDS(FieldT, gasMassSource_, phi_) - SourceFromGasMassChange( const Expr::Tag& gasMassSourceTag, - const Expr::Tag& phiTag) - : Expr::Expression() + SourceFromGasMassChange( const Expr::Tag& gasMassSourceTag, + const Expr::Tag& phiTag) + : Expr::Expression() { this->set_gpu_runnable( true ); gasMassSource_ = this->template create_field_request( gasMassSourceTag ); @@ -657,13 +657,13 @@ namespace Particles { class Builder : public Expr::ExpressionBuilder { const Expr::Tag gasMassSourceTag_, phiTag_; public: - /** - * @brief The mechanism for building a SourceFromGasMassChange object - * @tparam FieldT - * @param resultTag Source term related to the mass source term of gas phase. - * @param gasMassSourceTag Source term for gas phase mass. It has been divided by \f$\rho V\f$. - * @param phiTag Calculated parameter. - */ + /** + * @brief The mechanism for building a SourceFromGasMassChange object + * @tparam FieldT + * @param resultTag Source term related to the mass source term of gas phase. + * @param gasMassSourceTag Source term for gas phase mass. It has been divided by \f$\rho V\f$. + * @param phiTag Calculated parameter. + */ Builder( const Expr::Tag& resultTag, const Expr::Tag& gasMassSourceTag, const Expr::Tag& phiTag) @@ -738,13 +738,13 @@ namespace Particles { class Builder : public Expr::ExpressionBuilder { const Expr::TagList particleMassTermTags_, enthSpeciesTermTags_; public: - /** - * @brief The mechansim for building a GasEnergySourceFromPart object - * @tparam FieldT - * @param resultTag Energy source term from particles because of the speceis transportation - * @param particleMassTermTags List of species source terms from particle to gas (It size is equal to npar*nspecies) - * @param enthSpeciesTermTags List of species enthalpies at particle temperature - */ + /** + * @brief The mechansim for building a GasEnergySourceFromPart object + * @tparam FieldT + * @param resultTag Energy source term from particles because of the speceis transportation + * @param particleMassTermTags List of species source terms from particle to gas (It size is equal to npar*nspecies) + * @param enthSpeciesTermTags List of species enthalpies at particle temperature + */ Builder( const Expr::Tag resultTag, const Expr::TagList particleMassTermTags, const Expr::TagList enthSpeciesTermTags) @@ -773,12 +773,318 @@ namespace Particles { dfdv <<= 0; for ( size_t i = 0; i< particleMassTerms_.size(); ++i){ dfdv <<= dfdv - - particleMassTerms_[i]->sens_field_ref( sensVarTag ) * enthSpeciesTerms_[i]->field_ref() - - particleMassTerms_[i]->field_ref() * enthSpeciesTerms_[i]->sens_field_ref( sensVarTag ); + - particleMassTerms_[i]->sens_field_ref( sensVarTag ) * enthSpeciesTerms_[i]->field_ref() + - particleMassTerms_[i]->field_ref() * enthSpeciesTerms_[i]->sens_field_ref( sensVarTag ); } } }; + /** + * @class DensitySourceFromGasMassChange + * @ingroup Particles + * @brief Getting the source term for density equation related to the mass source term of gas phase for plug flow reactor + * @author Hang + * + * The result is given as + * \f[ + * S_i = 2 \frac{S_{m,g}}{u} + * \f] + * Here, \f$ S_{m,g} \f$ is the source term for gas phase mass (kg/m^3/s). + * \f$ u \f$ is the velocity of gas phase. + * + */ + template + class DensitySourceFromGasMassChange: public Expr::Expression { + DECLARE_FIELDS(FieldT, gasMassSource_, u_, rho_) + + DensitySourceFromGasMassChange( const Expr::Tag& gasMassSourceTag, + const Expr::Tag& rhoTag, + const Expr::Tag& uTag) + : Expr::Expression() + { + this->set_gpu_runnable( true ); + gasMassSource_ = this->template create_field_request( gasMassSourceTag ); + u_ = this->template create_field_request( uTag ); + rho_ = this->template create_field_request( rhoTag ); + } + + public: + + class Builder : public Expr::ExpressionBuilder { + const Expr::Tag gasMassSourceTag_, uTag_, rhoTag_; + public: + /** + * @brief The mechanism for building a SourceFromGasMassChange object + * @tparam FieldT + * @param resultTag Source term related to the mass source term of gas phase. + * @param gasMassSourceTag Source term for gas phase mass(1/s). It has been divided by \f$\rho\f$. + * @param rhoTag Density of gas phase. + * @param uTag Velocity of gas phase. + */ + Builder( const Expr::Tag& resultTag, + const Expr::Tag& gasMassSourceTag, + const Expr::Tag& rhoTag, + const Expr::Tag& uTag) + : Expr::ExpressionBuilder( resultTag ), + gasMassSourceTag_ ( gasMassSourceTag ), + rhoTag_ ( rhoTag ), + uTag_ ( uTag ){} + + ~Builder(){} + + Expr::ExpressionBase* build() const{ + return new DensitySourceFromGasMassChange( gasMassSourceTag_, rhoTag_, uTag_); + } + }; + + void evaluate(){ + using namespace SpatialOps; + FieldT& result = this->value(); + result <<= 2.0 * gasMassSource_->field_ref() * rho_->field_ref() / u_->field_ref(); + } + + void sensitivity( const Expr::Tag& sensVarTag ){ + FieldT& dfdv = this->sensitivity_result( sensVarTag ); + const FieldT& gasMassSource = gasMassSource_->field_ref(); + const FieldT& rho = rho_->field_ref(); + const FieldT& u = u_->field_ref(); + const FieldT& dgasMassSourcedv = gasMassSource_->sens_field_ref( sensVarTag ); + const FieldT& drhodv = rho_->sens_field_ref( sensVarTag ); + const FieldT& dudv = u_->sens_field_ref( sensVarTag ); + dfdv <<= 2.0 * (dgasMassSourcedv*rho/u + gasMassSource*drhodv/u - gasMassSource*rho/square(u)*dudv); + } + }; + + /** + * @class DpDxSourceFromGasMassChange + * @ingroup Particles + * @brief Getting the source term for `Dp/Dx` term related to the mass source term of gas phase for plug flow reactor + * @author Hang + * + * The result is given as + * \f[ + * S_{DpDx}} = \frac{(2 T -h/cp) S_{m,g} \rho}{u(\frac{Mw}{R}-\frac{T}{u^2}-\frac{1}{cp})} + * \f] + * Here, \f$ S_{m,g} \f$ is the source term for gas phase mass (kg/m^3/s). + * \f$ u \f$ is the velocity of gas phase. + * \f$ T \f$, \f$ h \f$ and \f$ cp \f$ are temperature, enthalpy and specific heat copacity of gas phase. + * \f$ Mw \f$ is the molecular weigh of gas mixture. + * \f$ R \f$ is the gas constant. + * + */ + template + class DpDxSourceFromGasMassChange: public Expr::Expression { + DECLARE_FIELDS(FieldT, gasMassSource_, u_, rho_, T_, enth_, cp_, mmw_) + const double gasConstant_; + + DpDxSourceFromGasMassChange( const Expr::Tag& gasMassSourceTag, + const Expr::Tag& rhoTag, + const Expr::Tag& tempTag, + const Expr::Tag& enthTag, + const Expr::Tag& mmwTag, + const Expr::Tag& cpTag, + const Expr::Tag& uTag) + : Expr::Expression(), + gasConstant_(CanteraObjects::gas_constant()) + { + this->set_gpu_runnable( true ); + gasMassSource_ = this->template create_field_request( gasMassSourceTag ); + rho_ = this->template create_field_request( rhoTag ); + T_ = this->template create_field_request( tempTag ); + enth_ = this->template create_field_request( enthTag ); + mmw_ = this->template create_field_request( mmwTag ); + cp_ = this->template create_field_request( cpTag ); + u_ = this->template create_field_request( uTag ); + } + + public: + + class Builder : public Expr::ExpressionBuilder { + const Expr::Tag gasMassSourceTag_, uTag_, rhoTag_, tempTag_, enthTag_, cpTag_, mmwTag_; + public: + /** + * @brief The mechanism for building a SourceFromGasMassChange object + * @tparam FieldT + * @param resultTag Source term related to the mass source term of gas phase. + * @param gasMassSourceTag Source term for gas phase mass(1/s). It has been divided by \f$\rho f$. + * @param rhoTag Density of gas phase. + * @param tempTag Temperature of gas phase. + * @param enthTag Specific enthalpy of gas phase. + * @param mmwTag Molecular weight of gas phase. + * @param cpTag Heat capacity of gas phase. + * @param uTag Velocity of gas phase. + */ + Builder( const Expr::Tag& resultTag, + const Expr::Tag& gasMassSourceTag, + const Expr::Tag& rhoTag, + const Expr::Tag& tempTag, + const Expr::Tag& enthTag, + const Expr::Tag& mmwTag, + const Expr::Tag& cpTag, + const Expr::Tag& uTag) + : Expr::ExpressionBuilder( resultTag ), + gasMassSourceTag_ ( gasMassSourceTag ), + rhoTag_ ( rhoTag ), + tempTag_ ( tempTag ), + enthTag_ ( enthTag ), + mmwTag_ ( mmwTag ), + cpTag_ ( cpTag ), + uTag_ ( uTag ){} + + ~Builder(){} + + Expr::ExpressionBase* build() const{ + return new DpDxSourceFromGasMassChange( gasMassSourceTag_, rhoTag_, tempTag_, enthTag_, mmwTag_, cpTag_, uTag_); + } + }; + + void evaluate(){ + using namespace SpatialOps; + FieldT& result = this->value(); + const FieldT& gasMassSource = gasMassSource_->field_ref(); + const FieldT& rho = rho_ ->field_ref(); + const FieldT& T = T_ ->field_ref(); + const FieldT& enth = enth_ ->field_ref(); + const FieldT& mmw = mmw_ ->field_ref(); + const FieldT& cp = cp_ ->field_ref(); + const FieldT& u = u_ ->field_ref(); + result <<= (2.0*T-enth/cp)*gasMassSource*rho / u / (mmw/gasConstant_-T/square(u)-1/cp); + } + + void sensitivity( const Expr::Tag& sensVarTag ){ + FieldT& dfdv = this->sensitivity_result( sensVarTag ); + const FieldT& gasMassSource = gasMassSource_->field_ref(); const FieldT& dgasMassSourcedv = gasMassSource_->sens_field_ref( sensVarTag ); + const FieldT& rho = rho_ ->field_ref(); const FieldT& drhodv = rho_ ->sens_field_ref( sensVarTag ); + const FieldT& T = T_ ->field_ref(); const FieldT& dTdv = T_ ->sens_field_ref( sensVarTag ); + const FieldT& enth = enth_ ->field_ref(); const FieldT& denthdv = enth_ ->sens_field_ref( sensVarTag ); + const FieldT& mmw = mmw_ ->field_ref(); const FieldT& dmmwdv = mmw_ ->sens_field_ref( sensVarTag ); + const FieldT& cp = cp_ ->field_ref(); const FieldT& dcpdv = cp_ ->sens_field_ref( sensVarTag ); + const FieldT& u = u_ ->field_ref(); const FieldT& dudv = u_ ->sens_field_ref( sensVarTag ); + + dfdv <<= ((2.0*dTdv-denthdv/cp+enth/square(cp)*dcpdv)*gasMassSource*rho + (2.0*T-enth/cp)*(dgasMassSourcedv*rho+gasMassSource*drhodv) ) / u / (mmw/gasConstant_-T/square(u)-1/cp) + - (2.0*T-enth/cp)*gasMassSource*rho / square(u) * dudv / (mmw/gasConstant_-T/square(u)-1/cp) + - (2.0*T-enth/cp)*gasMassSource*rho / u / square(mmw/gasConstant_-T/square(u)-1/cp) * (dmmwdv/gasConstant_-dTdv/square(u) + 2.0*T/cube(u)*dudv+1/square(cp)*dcpdv); + } + }; + + /** + * @class DpDxSourceFromGasEnthalpyChange + * @ingroup Particles + * @brief Getting the source term for `Dp/Dx` term related to the enthalpy source term of gas phase for plug flow reactor. + * @author Hang + * + * The result is given as + * \f[ + * S_{DpDx}} = \frac{ S_{h,g}}{u cp(\frac{Mw}{R}-\frac{T}{u^2}-\frac{1}{cp})} + * \f] + * Here, \f$ S_{h,g} \f$ is the source term for gas phase enthalpy (J/m^3/s). + * So it needs to time \f$\rho\f$ to get the source term every unit volume. + * \f$ u \f$ is the velocity of gas phase. + * \f$ T \f$, \f$ h \f$ and \f$ cp \f$ are temperature, enthalpy and specific heat copacity of gas phase. + * \f$ Mw \f$ is the molecular weigh of gas mixture. + * \f$ R \f$ is the gas constant. + * + */ + template + class DpDxSourceFromGasEnthalpyChange: public Expr::Expression { + DECLARE_FIELDS(FieldT, gasEnthalpySource_, u_, rho_, T_, enth_, cp_, mmw_) + const double gasConstant_; + + DpDxSourceFromGasEnthalpyChange( const Expr::Tag& gasEnthalpySourceTag, + const Expr::Tag& rhoTag, + const Expr::Tag& tempTag, + const Expr::Tag& enthTag, + const Expr::Tag& mmwTag, + const Expr::Tag& cpTag, + const Expr::Tag& uTag) + : Expr::Expression(), + gasConstant_(CanteraObjects::gas_constant()) + { + this->set_gpu_runnable( true ); + gasEnthalpySource_ = this->template create_field_request( gasEnthalpySourceTag ); + rho_ = this->template create_field_request( rhoTag ); + T_ = this->template create_field_request( tempTag ); + enth_ = this->template create_field_request( enthTag ); + mmw_ = this->template create_field_request( mmwTag ); + cp_ = this->template create_field_request( cpTag ); + u_ = this->template create_field_request( uTag ); + } + + public: + + class Builder : public Expr::ExpressionBuilder { + const Expr::Tag gasEnthalpySourceTag_, uTag_, rhoTag_, tempTag_, enthTag_, cpTag_, mmwTag_; + public: + /** + * @brief The mechanism for building a SourceFromGasMassChange object + * @tparam FieldT + * @param resultTag Source term related to the mass source term of gas phase. + * @param gasEnthalpySourceTag Source term for gas phase enthalpy (J/kg/s). It has been divided by \f$\rho \f$. + * @param rhoTag Density of gas phase. + * @param tempTag Temperature of gas phase. + * @param enthTag Specific enthalpy of gas phase. + * @param mmwTag Molecular weight of gas phase. + * @param cpTag Heat capacity of gas phase. + * @param uTag Velocity of gas phase. + */ + Builder( const Expr::Tag& resultTag, + const Expr::Tag& gasEnthalpySourceTag, + const Expr::Tag& rhoTag, + const Expr::Tag& tempTag, + const Expr::Tag& enthTag, + const Expr::Tag& mmwTag, + const Expr::Tag& cpTag, + const Expr::Tag& uTag) + : Expr::ExpressionBuilder( resultTag ), + gasEnthalpySourceTag_ ( gasEnthalpySourceTag ), + rhoTag_ ( rhoTag ), + tempTag_ ( tempTag ), + enthTag_ ( enthTag ), + mmwTag_ ( mmwTag ), + cpTag_ ( cpTag ), + uTag_ ( uTag ){} + + ~Builder(){} + + Expr::ExpressionBase* build() const{ + return new DpDxSourceFromGasEnthalpyChange( gasEnthalpySourceTag_, rhoTag_, tempTag_, enthTag_, mmwTag_, cpTag_, uTag_); + } + }; + + void evaluate(){ + using namespace SpatialOps; + FieldT& result = this->value(); + const FieldT& gasEnthalpySource = gasEnthalpySource_->field_ref(); + const FieldT& rho = rho_->field_ref(); + const FieldT& T = T_->field_ref(); + const FieldT& enth = enth_->field_ref(); + const FieldT& mmw = mmw_->field_ref(); + const FieldT& cp = cp_->field_ref(); + const FieldT& u = u_->field_ref(); + result <<= gasEnthalpySource * rho / u / cp / (mmw/gasConstant_-T/square(u)-1/cp); + } + + void sensitivity( const Expr::Tag& sensVarTag ){ + FieldT& dfdv = this->sensitivity_result( sensVarTag ); + const FieldT& gasEnthalpySource = gasEnthalpySource_->field_ref(); + const FieldT& rho = rho_->field_ref(); + const FieldT& T = T_->field_ref(); + const FieldT& enth = enth_->field_ref(); + const FieldT& mmw = mmw_->field_ref(); + const FieldT& cp = cp_->field_ref(); + const FieldT& u = u_->field_ref(); + const FieldT& dgasEnthalpySourcedv = gasEnthalpySource_->sens_field_ref( sensVarTag ); + const FieldT& drhodv = rho_->sens_field_ref( sensVarTag ); + const FieldT& dTdv = T_->sens_field_ref( sensVarTag ); + const FieldT& denthdv = enth_->sens_field_ref( sensVarTag ); + const FieldT& dmmwdv = mmw_->sens_field_ref( sensVarTag ); + const FieldT& dcpdv = cp_->sens_field_ref( sensVarTag ); + const FieldT& dudv = u_->sens_field_ref( sensVarTag ); + dfdv <<= (dgasEnthalpySourcedv*rho+ gasEnthalpySource*drhodv) / u / cp / (mmw/gasConstant_-T/square(u)-1/cp) + - (gasEnthalpySource*rho/square(u)*dudv/cp + gasEnthalpySource*rho/u/square(cp)*dcpdv) / (mmw/gasConstant_-T/square(u)-1/cp) + - gasEnthalpySource*rho/u/cp / square(mmw/gasConstant_-T/square(u)-1/cp) * (dmmwdv/gasConstant_-dTdv/square(u) + 2.0*T/cube(u)*dudv+1/square(cp)*dcpdv); + } + }; } diff --git a/src/particles/Vaporization/VaporizationInterface.cpp b/src/particles/Vaporization/VaporizationInterface.cpp index 8420712..a6175c4 100755 --- a/src/particles/Vaporization/VaporizationInterface.cpp +++ b/src/particles/Vaporization/VaporizationInterface.cpp @@ -44,6 +44,7 @@ #include "VaporizationMass.h" #include "particles/coal/CoalData.h" +#include "PlugFlowReactor/PlugFlowReactorInterface.h" using Expr::matrix::sensitivity; @@ -51,10 +52,12 @@ namespace Vap { typedef Expr::ConstantExpr::Builder ConstantT; typedef pokitt::SpeciesEnthalpy::Builder SpeciesEnthalpyT; + typedef ReactorEnsembleUtil::DivisionExpression::Builder DivideT; typedef Particles::PartToGasCV::Builder PartToGasCVT; typedef Particles::GasMassSourceFromPart::Builder GasMassSourceT; typedef Particles::GasEnergySourceFromPart::Builder GasEnergySourceT; + typedef Particles::DpDxSourceFromGasEnthalpyChange::Builder DpDxEnthalpyT; typedef Vap::VaporizationMass::Builder VapMassT; typedef Vap::VaporizationHeatPart::Builder VapHeatPartT; @@ -65,10 +68,13 @@ namespace Vap { VapTags:: VapTags( const Expr::Context& state, const std::vector& particleNumArray) - : vapMassGasSourceTag ( Expr::Tag( "vap_mass_gas_source" , state ) ), - vapHeatGasSourceTag ( Expr::Tag( "vap_heat_gas_source" , state ) ), - vapMassToGasTag ( Expr::Tag( "vap_mass_to_gas" , state ) ), - vapHeatToGasTag ( Expr::Tag( "vap_heat_to_gas" , state ) ) + : vapMassGasSourceTag ( Expr::Tag( "vap_mass_gas_source" , state ) ), + vapHeatGasSourceTag ( Expr::Tag( "vap_heat_gas_source" , state ) ), + vapMassGasSourcePFRTag ( Expr::Tag( "vap_mass_gas_source_pfr" , state ) ), + vapHeatGasSourcePFRTag ( Expr::Tag( "vap_heat_gas_source_pfr" , state ) ), + vapMassToGasTag ( Expr::Tag( "vap_mass_to_gas" , state ) ), + vapHeatToGasTag ( Expr::Tag( "vap_heat_to_gas" , state ) ), + vapHeatDpDxTag ( Expr::Tag( "vap_heat_dpdx" , state ) ) { vapRateTags = Expr::tag_list( particleNumArray, state, "vap_rate_" ); vapH2OEnthalpyTags = Expr::tag_list( particleNumArray, state, "vap_h2o_enthalpy_" ); @@ -102,8 +108,10 @@ namespace Vap { const ReactorEnsembleUtil::ReactorEnsembleTags tagsE( Expr::STATE_NONE ); const Vap::VapTags tagsEVap( Expr::STATE_NONE, particleNumArray_ ); const Coal::CoalEnsembleTags tagsECoal( Expr::STATE_NONE, particleNumArray_ ); + const PlugFlowReactorInterface::PlugFlowReactorTags tagsEpfr( Expr::STATE_NONE ); Expr::ExpressionFactory& execFactory = integrator_->factory(); + const std::string reactorType = rootParser_["ReactorParameters"]["ReactorType"].as(); const int IdxH2O = CanteraObjects::species_index( "H2O" ); const int nparsize = particleNumArray_.size(); @@ -127,7 +135,7 @@ namespace Vap { execFactory.register_expression( new VapHeatPartT( tagsEVap.vapHeatPartTags[i], tagsEVap.vapRateTags[i], tagsEPart.partTempTags[i], tagsEPart.partMassFracTags[i], tagsEPart.partCpTags[i] )); execFactory.attach_dependency_to_expression( tagsEVap.vapHeatPartTags[i], tagsEPart.partTempKinRhsTags[i], Expr::ADD_SOURCE_EXPRESSION ); - // modify particle mass and num fraction equations + // modify particle mass fraction equations execFactory.attach_dependency_to_expression( tagsEVap.vapRateTags[i], tagsEPart.partMassFracKinRhsTags[i], Expr::ADD_SOURCE_EXPRESSION); } @@ -136,17 +144,26 @@ namespace Vap { execFactory.attach_dependency_to_expression( tagsEVap.vapMassGasSourceTag, tagsEPart.partToGasMassTag, Expr::ADD_SOURCE_EXPRESSION); //modify gas equation - if(rootParser_["ReactorParameters"]["ReactorType"].as() == "ConstantVolume"){ + if(reactorType == "PSRConstantVolume"){ execFactory.register_expression( new PartToGasCVT( tagsEVap.vapMassToGasTag, tagsEVap.vapMassGasSourceTag, tagsE.rhoTag ) ); execFactory.register_expression( new PartToGasCVT( tagsEVap.vapHeatToGasTag, tagsEVap.vapHeatGasSourceTag, tagsE.rhoTag ) ); execFactory.attach_dependency_to_expression( tagsEVap.vapMassToGasTag, tagsE.rhoKinRhsTag, Expr::ADD_SOURCE_EXPRESSION ); execFactory.attach_dependency_to_expression( tagsEVap.vapHeatToGasTag, tagsE.rhoEgyKinRhsTag, Expr::ADD_SOURCE_EXPRESSION ); execFactory.attach_dependency_to_expression( tagsEVap.vapMassToGasTag, tagsE.rhoYKinRhsTags[IdxH2O], Expr::ADD_SOURCE_EXPRESSION ); } - if(rootParser_["ReactorParameters"]["ReactorType"].as() == "ConstantPressure"){ + if(reactorType == "PSRConstantPressure"){ execFactory.attach_dependency_to_expression( tagsEVap.vapHeatGasSourceTag, tagsE.enthKinRhsTag, Expr::ADD_SOURCE_EXPRESSION ); execFactory.attach_dependency_to_expression( tagsEVap.vapMassGasSourceTag, tagsE.yKinRhsTags[IdxH2O], Expr::ADD_SOURCE_EXPRESSION ); } + if(reactorType == "PFR"){ + execFactory.register_expression( new DivideT( tagsEVap.vapMassGasSourcePFRTag, tagsEVap.vapMassGasSourceTag, tagsEpfr.uTag )); + execFactory.register_expression( new DivideT( tagsEVap.vapHeatGasSourcePFRTag, tagsEVap.vapHeatGasSourceTag, tagsEpfr.uTag )); + execFactory.register_expression( new DpDxEnthalpyT( tagsEVap.vapHeatDpDxTag, tagsEVap.vapHeatGasSourceTag, tagsE.rhoTag, tagsE.tempTag, + tagsE.enthTag, tagsE.mmwTag, tagsE.cpTag, tagsEpfr.uTag)); + execFactory.attach_dependency_to_expression( tagsEVap.vapHeatGasSourcePFRTag, tagsE.enthFullRhsTag, Expr::ADD_SOURCE_EXPRESSION ); + execFactory.attach_dependency_to_expression( tagsEVap.vapMassGasSourcePFRTag, tagsE.yFullRhsTags[IdxH2O], Expr::ADD_SOURCE_EXPRESSION ); + execFactory.attach_dependency_to_expression( tagsEVap.vapHeatDpDxTag, tagsEpfr.dpdxTag, Expr::ADD_SOURCE_EXPRESSION ); + } } } // namespace Vap diff --git a/src/particles/Vaporization/VaporizationInterface.h b/src/particles/Vaporization/VaporizationInterface.h index f0dd4b5..ea8fe73 100755 --- a/src/particles/Vaporization/VaporizationInterface.h +++ b/src/particles/Vaporization/VaporizationInterface.h @@ -49,13 +49,16 @@ namespace Vap { */ class VapTags { public: - const Expr::Tag vapMassGasSourceTag, ///< gas phase mass source term from vaporization (only one species: H2O) - vapHeatGasSourceTag, ///< gas phase energy source term from vaporization - vapMassToGasTag, ///< rhs in gas phase mass equation from vaporization - vapHeatToGasTag; ///< rhs in gas phase energy equation from vaporization - Expr::TagList vapRateTags, ///< vaporization rate - vapH2OEnthalpyTags, ///< enthalpy of H2O at particle temperature - vapHeatPartTags; ///< heat transfer term in particle temperature equation from vaporization + const Expr::Tag vapMassGasSourceTag, ///< gas phase mass source term from vaporization (only one species: H2O) + vapHeatGasSourceTag, ///< gas phase energy source term from vaporization + vapMassGasSourcePFRTag, ///< gas phase mass source term from vaporization (only one species: H2O) for plug flow reactor + vapHeatGasSourcePFRTag, ///< gas phase energy source term from vaporization for plug flow reactor + vapMassToGasTag, ///< rhs in gas phase mass equation from vaporization + vapHeatToGasTag, ///< rhs in gas phase energy equation from vaporization + vapHeatDpDxTag; ///< enthalpy source term in `Dp/Dx` from vaporization for plug flow reactor + Expr::TagList vapRateTags, ///< vaporization rate + vapH2OEnthalpyTags, ///< enthalpy of H2O at particle temperature + vapHeatPartTags; ///< heat transfer term in particle temperature equation from vaporization VapTags( const Expr::Context& state, const std::vector& particleNumArray); diff --git a/src/particles/coal/CharCombustion/CharInterface.cpp b/src/particles/coal/CharCombustion/CharInterface.cpp index cb40db6..43360bd 100644 --- a/src/particles/coal/CharCombustion/CharInterface.cpp +++ b/src/particles/coal/CharCombustion/CharInterface.cpp @@ -16,14 +16,17 @@ #include "CharSpeciesTransportHeat.h" #include "EffecDiffCoeff.h" #include "BinaryDiffCoeff.h" +#include "PlugFlowReactor/PlugFlowReactorInterface.h" namespace Char { typedef Expr::ConstantExpr::Builder ConstantT; typedef pokitt::SpeciesEnthalpy::Builder SpecEnthT; + typedef ReactorEnsembleUtil::DivisionExpression::Builder DivisionT; typedef Particles::PartToGasCV::Builder PartToGasCVT; typedef Particles::GasMassSourceFromPart::Builder GasMassSourceT; typedef Particles::SpeciesSourceFromPart::Builder SpeciesSourceT; + typedef Particles::DpDxSourceFromGasEnthalpyChange::Builder DpDxEnthalpyT; typedef Char::BinaryDiffCoeff::Builder BinaryDiffCoeffT; typedef Char::EffecDiffCoeff::Builder EffecDiffCoeffT; @@ -39,27 +42,30 @@ namespace Char { const std::vector& speciesCharArray, const std::vector& binarySpeciesArray, const std::vector& partNumSpeciesCharArray ) - : charMassGasSourceTag( Expr::Tag( "char_mass_gas_source", state )), - charHeatGasSourceTag( Expr::Tag( "char_heat_gas_source", state )), - charMassGasRHSTag ( Expr::Tag( "char_mass_gas_rhs" , state )), - charHeatGasRHSTag ( Expr::Tag( "char_heat_gas_rhs" , state )) + : charMassGasSourceTag ( Expr::Tag( "char_mass_gas_source" , state )), + charHeatGasSourceTag ( Expr::Tag( "char_heat_gas_source" , state )), + charHeatGasSourcePFRTag ( Expr::Tag( "char_heat_gas_source_pfr" , state )), + charHeatGasSourceDpDxTag( Expr::Tag( "char_heat_gas_source_dpdx", state )), + charMassGasRHSTag ( Expr::Tag( "char_mass_gas_rhs" , state )), + charHeatGasRHSTag ( Expr::Tag( "char_heat_gas_rhs" , state )) { - qTags = Expr::tag_list( particleNumArray, state, "q_" ); - po2sTags = Expr::tag_list( particleNumArray, state, "p02s_" ); - co2CoRatioTags = Expr::tag_list( particleNumArray, state, "co2CoRatio_" ); - charOxiRhsTags = Expr::tag_list( particleNumArray, state, "charOxiRhs_" ); - heteroCO2Tags = Expr::tag_list( particleNumArray, state, "heteroCO2_" ); - heteroH2OTags = Expr::tag_list( particleNumArray, state, "heteroH2O_" ); - charSpeciesTags = Expr::tag_list( partNumSpeciesCharArray, state, "char_species_" ); - charSpeciesSourceTags = Expr::tag_list( speciesCharArray, state, "char_species_source_" ); - charSpeciesRHSTags = Expr::tag_list( speciesCharArray, state, "char_species_rhs_" ); - enthTgasCharTags = Expr::tag_list( partNumSpeciesCharArray, state, "enthTgasChar_" ); - enthTpartCharTags = Expr::tag_list( partNumSpeciesCharArray, state, "enthTpartChar_" ); - charSpecTransHeatTags = Expr::tag_list( particleNumArray, state, "charSpeciesTransHeat_" ); - charHeatReleaseGasTags = Expr::tag_list( particleNumArray, state, "charHeatReleaseGas_" ); - charHeatReleasePartTags = Expr::tag_list( particleNumArray, state, "charHeatReleaseGPart_" ); - binaryDiffCoeffTags = Expr::tag_list( binarySpeciesArray, state, "binaryDiffCoeff_" ); - effecDiffCoeffTags = Expr::tag_list( speciesCharArray, state, "effecDiffCoeff_" ); + qTags = Expr::tag_list( particleNumArray, state, "q_" ); + po2sTags = Expr::tag_list( particleNumArray, state, "p02s_" ); + co2CoRatioTags = Expr::tag_list( particleNumArray, state, "co2CoRatio_" ); + charOxiRhsTags = Expr::tag_list( particleNumArray, state, "charOxiRhs_" ); + heteroCO2Tags = Expr::tag_list( particleNumArray, state, "heteroCO2_" ); + heteroH2OTags = Expr::tag_list( particleNumArray, state, "heteroH2O_" ); + charSpeciesTags = Expr::tag_list( partNumSpeciesCharArray, state, "char_species_" ); + charSpeciesSourceTags = Expr::tag_list( speciesCharArray, state, "char_species_source_" ); + charSpeciesSourcePFRTags = Expr::tag_list( speciesCharArray, state, "char_species_source_pfr_" ); + charSpeciesRHSTags = Expr::tag_list( speciesCharArray, state, "char_species_rhs_" ); + enthTgasCharTags = Expr::tag_list( partNumSpeciesCharArray, state, "enthTgasChar_" ); + enthTpartCharTags = Expr::tag_list( partNumSpeciesCharArray, state, "enthTpartChar_" ); + charSpecTransHeatTags = Expr::tag_list( particleNumArray, state, "charSpeciesTransHeat_" ); + charHeatReleaseGasTags = Expr::tag_list( particleNumArray, state, "charHeatReleaseGas_" ); + charHeatReleasePartTags = Expr::tag_list( particleNumArray, state, "charHeatReleaseGPart_" ); + binaryDiffCoeffTags = Expr::tag_list( binarySpeciesArray, state, "binaryDiffCoeff_" ); + effecDiffCoeffTags = Expr::tag_list( speciesCharArray, state, "effecDiffCoeff_" ); } CharInterface:: @@ -168,7 +174,9 @@ namespace Char { const Coal::CoalEnsembleTags tagsECoal( Expr::STATE_NONE, particleNumArray_ ); const Char::CharTags tagsEChar( Expr::STATE_NONE, particleNumArray_, speciesCharArray_, binarySpeciesArray_, partNumSpeciesCharArray_ ); + const PlugFlowReactorInterface::PlugFlowReactorTags tagsEpfr( Expr::STATE_NONE ); Expr::ExpressionFactory& execFactory = integrator_->factory(); + const std::string reactorType = rootParser_["ReactorParameters"]["ReactorType"].as(); const int nparsize = particleNumArray_.size(); @@ -218,7 +226,7 @@ namespace Char { execFactory.register_expression( new SpeciesSourceT( tagsEChar.charSpeciesSourceTags, tagsEChar.charSpeciesTags, speciesCharArray_.size())); execFactory.attach_dependency_to_expression( tagsEChar.charMassGasSourceTag, tagsEPart.partToGasMassTag, Expr::SUBTRACT_SOURCE_EXPRESSION ); - if( rootParser_["ReactorParameters"]["ReactorType"].as() == "ConstantVolume" ){ + if( reactorType == "PSRConstantVolume" ){ for( size_t j = 0;j < speciesCharArray_.size();j++ ){ const int Idx = CanteraObjects::species_index( speciesCharArray_[j] ); execFactory.register_expression( new PartToGasCVT( tagsEChar.charSpeciesRHSTags[j], tagsEChar.charSpeciesSourceTags[j], tagsE.rhoTag )); @@ -229,13 +237,25 @@ namespace Char { execFactory.attach_dependency_to_expression( tagsEChar.charMassGasRHSTag, tagsE.rhoKinRhsTag, Expr::SUBTRACT_SOURCE_EXPRESSION ); execFactory.attach_dependency_to_expression( tagsEChar.charHeatGasRHSTag, tagsE.rhoEgyKinRhsTag, Expr::ADD_SOURCE_EXPRESSION ); } - if( rootParser_["ReactorParameters"]["ReactorType"].as() == "ConstantPressure" ){ + if( reactorType == "PSRConstantPressure" ){ execFactory.attach_dependency_to_expression( tagsEChar.charHeatGasSourceTag, tagsE.enthKinRhsTag, Expr::ADD_SOURCE_EXPRESSION ); for( size_t j = 0;j < speciesCharArray_.size();j++ ){ const int Idx = CanteraObjects::species_index( speciesCharArray_[j] ); execFactory.attach_dependency_to_expression( tagsEChar.charSpeciesSourceTags[j], tagsE.yKinRhsTags[Idx], Expr::ADD_SOURCE_EXPRESSION ); } } + if( reactorType == "PFR"){ + execFactory.register_expression( new DivisionT( tagsEChar.charHeatGasSourcePFRTag, tagsEChar.charHeatGasSourceTag, tagsEpfr.uTag )); + execFactory.attach_dependency_to_expression( tagsEChar.charHeatGasSourcePFRTag, tagsE.enthFullRhsTag, Expr::ADD_SOURCE_EXPRESSION ); + for( size_t j = 0;j < speciesCharArray_.size();j++ ){ + const int Idx = CanteraObjects::species_index( speciesCharArray_[j] ); + execFactory.register_expression( new DivisionT( tagsEChar.charSpeciesSourcePFRTags[j], tagsEChar.charSpeciesSourceTags[j], tagsEpfr.uTag )); + execFactory.attach_dependency_to_expression( tagsEChar.charSpeciesSourcePFRTags[j], tagsE.yFullRhsTags[Idx], Expr::ADD_SOURCE_EXPRESSION ); + } + execFactory.register_expression( new DpDxEnthalpyT( tagsEChar.charHeatGasSourceDpDxTag, tagsEChar.charHeatGasSourceTag, tagsE.rhoTag, tagsE.tempTag, + tagsE.enthTag, tagsE.mmwTag, tagsE.cpTag, tagsEpfr.uTag)); + execFactory.attach_dependency_to_expression( tagsEChar.charHeatGasSourceDpDxTag, tagsEpfr.dpdxTag, Expr::ADD_SOURCE_EXPRESSION ); + } } //--------------------------------------------------------------------------- diff --git a/src/particles/coal/CharCombustion/CharInterface.h b/src/particles/coal/CharCombustion/CharInterface.h index ee0b575..54a8689 100644 --- a/src/particles/coal/CharCombustion/CharInterface.h +++ b/src/particles/coal/CharCombustion/CharInterface.h @@ -28,6 +28,8 @@ namespace Char{ public: const Expr::Tag charMassGasSourceTag, ///< gas phase mass source term from char reaction charHeatGasSourceTag, ///< gas phase energy source term from char reaction + charHeatGasSourcePFRTag, ///< gas phase energy source term from char reaction for plug flow reactor + charHeatGasSourceDpDxTag, ///< gas phase energy source term in `Dp/Dx` from char reaction for plug flow reactor charMassGasRHSTag, ///< rhs in gas phase mass equation from char reaction charHeatGasRHSTag; ///< rhs in gas phase energy equation from char reaction Expr::TagList qTags, ///< char oxidization rate @@ -38,6 +40,7 @@ namespace Char{ heteroH2OTags, ///< H2O from gasification of char charSpeciesTags, ///< production of species from char gas/oxi charSpeciesSourceTags, ///< gas species source term from char gas/oxi + charSpeciesSourcePFRTags, ///< gas species source term from char gas/oxi for plug flow reactor charSpeciesRHSTags, ///< rhs in species mass fraction from char gas/oxi enthTgasCharTags, ///< enthalpy of species used in char model under gas temperature enthTpartCharTags, ///< enthalpy of species used in char model under particle temperature diff --git a/src/particles/coal/CharCombustion/Oxidation/CharOxidationInterface.cpp b/src/particles/coal/CharCombustion/Oxidation/CharOxidationInterface.cpp index 0e0e010..2d76d33 100644 --- a/src/particles/coal/CharCombustion/Oxidation/CharOxidationInterface.cpp +++ b/src/particles/coal/CharCombustion/Oxidation/CharOxidationInterface.cpp @@ -82,7 +82,7 @@ namespace CharOxidation { execFactory.register_expression( new LHFractalT( oxiTags, tagsEPart.partSizeTags[i], tagsEPart.partTempTags[i], tagsEPart.partNumFracTags[i], tagsE.tempTag, tagsE.massTags[IdxO2], tagsE.mmwTag, tagsEPart.partRhoTags[i], tagsECoal.charMassFracTags[i], tagsECoal.charMassFracInitialTags[i], - tagsE.presTag, tagsEPart.partMassFracInflowTags[i], charData_, charoxidamodel_)); + tagsE.presTag, tagsEPart.partMassFracInitialTags[i], charData_, charoxidamodel_)); } } if( charoxidamodel_ == FIRST_ORDER ){} diff --git a/src/particles/coal/CharCombustion/Oxidation/LH_Fractal/CharOxidationLH_Fractal.h b/src/particles/coal/CharCombustion/Oxidation/LH_Fractal/CharOxidationLH_Fractal.h index 6618357..7126b70 100644 --- a/src/particles/coal/CharCombustion/Oxidation/LH_Fractal/CharOxidationLH_Fractal.h +++ b/src/particles/coal/CharCombustion/Oxidation/LH_Fractal/CharOxidationLH_Fractal.h @@ -128,7 +128,7 @@ namespace CharOxidation{ * @param charMassTag char mass per gas mass * @param charMassInTag initial char mass per gas mass * @param gasPressTag gas pressure - * @param intPrtmasTag initialparticle mass + * @param intPrtmasTag initial particle mass * @param oxiData char oxidation data * @param charoxidamodel char oxidation model */ diff --git a/src/particles/coal/CoalInterface.cpp b/src/particles/coal/CoalInterface.cpp index 20b1f84..3f7823e 100755 --- a/src/particles/coal/CoalInterface.cpp +++ b/src/particles/coal/CoalInterface.cpp @@ -16,6 +16,7 @@ #include "Devolatilization/CPD/c0_fun.h" #include "CoalTempMixRHS.h" #include "CoalParticleLoading.cpp" +#include "PlugFlowReactor/PlugFlowReactorInterface.h" using Expr::matrix::sensitivity; @@ -56,7 +57,6 @@ namespace Coal{ charMassFracFullRhsTags = Expr::tag_list( particleNumArray, state, "char_mass_frac_", "_full_rhs" ); volMassEachPartTags = Expr::tag_list( particleNumArray, state, "vol_mass_each_part_" ); volMassFracTags = Expr::tag_list( particleNumArray, state, "vol_mass_frac_" ); - volMassFracInitialTags = Expr::tag_list( particleNumArray, state, "vol_mass_frac_", "_initial" ); volMassFracInflowTags = Expr::tag_list( particleNumArray, state, "vol_mass_frac_", "_inflow" ); volMassFracMixRhsTags = Expr::tag_list( particleNumArray, state, "vol_mass_frac_", "_mix_rhs" ); volMassFracKinRhsTags = Expr::tag_list( particleNumArray, state, "vol_mass_frac_", "_kin_rhs" ); @@ -93,6 +93,7 @@ namespace Coal{ equIndex_(equIndex), isRestart_(isRestart) { + reactorType_ = rootParser_["ReactorParameters"]["ReactorType"].as(); if(!isRestart_){ setup_initial_conditions_coal(); } @@ -147,64 +148,69 @@ namespace Coal{ double ymoisInit, yvolInit, ycharInit, ymoisInflow, yvolInflow, ycharInflow; const std::vector defaultCoalComp={coalComp.get_moisture(), coalComp.get_vm(), coalComp.get_fixed_c()}; const std::vector coalInitComp = rootParser_["Particles"]["CoalInitComp"].as >(defaultCoalComp); - const std::vector coalInflowComp = rootParser_["Particles"]["CoalInflowComp"].as >(defaultCoalComp); ymoisInit = coalInitComp[0]; yvolInit = coalInitComp[1]; ycharInit = coalInitComp[2]; - ymoisInflow = coalInflowComp[0]; - yvolInflow = coalInflowComp[1]; - ycharInflow = coalInflowComp[2]; - std::cout << " moist: " << ymoisInflow << " " << coalComp.get_moisture() - << " vol: " << yvolInflow << " " << coalComp.get_vm() - << " char: " << ycharInflow << " " << coalComp.get_fixed_c() - << std::endl; + if(reactorType_!="PFR"){ + const std::vector coalInflowComp = rootParser_["Particles"]["CoalInflowComp"].as >(defaultCoalComp); + ymoisInflow = coalInflowComp[0]; + yvolInflow = coalInflowComp[1]; + ycharInflow = coalInflowComp[2]; + } for( size_t i = 0;i < nparsize;i++){ // moisture, volatile and char mass initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCoal.moistureMassFracTags[i], tagsPart.partMassFracTags[i], ymoisInit, 0.0) ) ); - initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCoal.moistureMassFracInflowTags[i], tagsPart.partMassFracInflowTags[i], ymoisInflow, 0.0) ) ); + initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCoal.moistureMassFracInitialTags[i], tagsPart.partMassFracTags[i], ymoisInit, 0.0) ) ); + if(reactorType_!="PFR"){ initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCoal.moistureMassFracInflowTags[i], tagsPart.partMassFracInflowTags[i], ymoisInflow, 0.0) ) );} if(devModel_ == Dev::OFF or devModel_ == Dev::CPDM){ const double c0 = CPD::c0_fun( coalComp.get_C(), coalComp.get_O()); initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCoal.volMassFracTags[i], tagsPart.partMassFracTags[i], yvolInit*(1-c0), 0.0 ) ) ); initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCoal.charMassFracTags[i], tagsPart.partMassFracTags[i], ycharInit+yvolInit*c0, 0.0 ) ) ); - initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCoal.volMassFracInflowTags[i], tagsPart.partMassFracInflowTags[i], yvolInflow*(1-c0), 0.0 ) ) ); - initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCoal.charMassFracInflowTags[i], tagsPart.partMassFracInflowTags[i], ycharInflow+yvolInflow*c0, 0.0 ) ) ); + if(reactorType_!="PFR"){ + initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCoal.volMassFracInflowTags[i], tagsPart.partMassFracInflowTags[i], yvolInflow * ( 1 - c0 ), 0.0 ))); + initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCoal.charMassFracInflowTags[i], tagsPart.partMassFracInflowTags[i], ycharInflow + yvolInflow * c0, 0.0 ))); + } } else{ initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCoal.volMassFracTags[i], tagsPart.partMassFracTags[i], yvolInit, 0.0 ))); initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCoal.charMassFracTags[i], tagsPart.partMassFracTags[i], ycharInit, 0.0 ))); - initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCoal.volMassFracInflowTags[i], tagsPart.partMassFracInflowTags[i], yvolInflow, 0.0 ))); - initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCoal.charMassFracInflowTags[i], tagsPart.partMassFracInflowTags[i], ycharInflow, 0.0 ))); + if(reactorType_!="PFR"){ + initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCoal.volMassFracInflowTags[i], tagsPart.partMassFracInflowTags[i], yvolInflow, 0.0 ))); + initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCoal.charMassFracInflowTags[i], tagsPart.partMassFracInflowTags[i], ycharInflow, 0.0 ))); + } } - + initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCoal.charMassFracInitialTags[i], tagsCoal.charMassFracTags[i], 1.0, 0.0 ) ) ); initRoots_.insert( initFactory_.register_expression( new DivideT( tagsCoal.moistureMassEachPartTags[i], tagsCoal.moistureMassFracTags[i], tagsPart.partNumFracTags[i]))); initRoots_.insert( initFactory_.register_expression( new DivideT( tagsCoal.volMassEachPartTags[i], tagsCoal.volMassFracTags[i], tagsPart.partNumFracTags[i]))); initRoots_.insert( initFactory_.register_expression( new DivideT( tagsCoal.charMassEachPartTags[i], tagsCoal.charMassFracTags[i], tagsPart.partNumFracTags[i]))); } // number fraction of particle - - if(rootParser_["Particles"]["ParticleLoadingInflow"]){ - const double nparInflow = rootParser_["Particles"]["ParticleLoadingInflow"].as(); - for( size_t i = 0;i < nparsize;i++){ - if(rootParser_["Particles"]["Size"]["Distribution"].as() == "Identity"){ - initRoots_.insert( initFactory_.register_expression( new ConstantT(tagsPart.partNumFracInflowTags[i], nparInflow))); - } - else if(rootParser_["Particles"]["Size"]["Distribution"].as() == "UserDefinedList"){ - const std::vector nparFracList = rootParser_["Particles"]["Size"]["NumbersFraction"].as >(); - initRoots_.insert( initFactory_.register_expression( new ConstantT(tagsPart.partNumFracInflowTags[i], nparInflow*nparFracList[i]))); - } - else{ - // npar/nparsize is always equal to 1 in the present code. - initRoots_.insert( initFactory_.register_expression( new ConstantT(tagsPart.partNumFracInflowTags[i], nparInflow/nparsize))); + if(reactorType_!="PFR"){ + if(rootParser_["Particles"]["ParticleLoadingInflow"]){ + const double nparInflow = rootParser_["Particles"]["ParticleLoadingInflow"].as(); + for( size_t i = 0;i < nparsize;i++){ + if(rootParser_["Particles"]["Size"]["Distribution"].as() == "Identity"){ + initRoots_.insert( initFactory_.register_expression( new ConstantT(tagsPart.partNumFracInflowTags[i], nparInflow))); + } + else if(rootParser_["Particles"]["Size"]["Distribution"].as() == "UserDefinedList"){ + const std::vector nparFracList = rootParser_["Particles"]["Size"]["NumbersFraction"].as >(); + initRoots_.insert( initFactory_.register_expression( new ConstantT(tagsPart.partNumFracInflowTags[i], nparInflow*nparFracList[i]))); + } + else{ + // npar/nparsize is always equal to 1 in the present code. + initRoots_.insert( initFactory_.register_expression( new ConstantT(tagsPart.partNumFracInflowTags[i], nparInflow/nparsize))); + } } } + else{ + initRoots_.insert( initFactory_.register_expression( new PartLoadingT( tagsPart.partNumFracInflowTags, tags.massInflowTags[IdxO2], tagsCoal.fuelAirEquivalenceRatio, tagsPart.partRhoTags, tagsPart.partSizeTags, + nparList, coalComp, yvolInflow, ycharInflow, devModel_, charModel_ ))); + } } - else{ - initRoots_.insert( initFactory_.register_expression( new PartLoadingT( tagsPart.partNumFracInflowTags, tags.massInflowTags[IdxO2], tagsCoal.fuelAirEquivalenceRatio, tagsPart.partRhoTags, tagsPart.partSizeTags, - nparList, coalComp, yvolInflow, ycharInflow, devModel_, charModel_ ))); - } + if(rootParser_["Particles"]["ParticleLoading"]){ const double npar = rootParser_["Particles"]["ParticleLoading"].as(); // number of particles per gas mass for( size_t i = 0;i < nparsize;i++){ @@ -234,44 +240,62 @@ namespace Coal{ const Particles::ParticleEnsembleTags tagsEPart( Expr::STATE_NONE, particleNumArray_ ); const Vap::VapTags tagsEVap( Expr::STATE_NONE, particleNumArray_ ); const Coal::CoalEnsembleTags tagsECoal( Expr::STATE_NONE, particleNumArray_ ); + const PlugFlowReactorInterface::PlugFlowReactorTags tagsEpfr( Expr::STATE_NONE ); const int nparsize = particleNumArray_.size(); Expr::ExpressionFactory& execFactory = integrator_->factory(); for( size_t i = 0;i < nparsize;i++){ execFactory.register_expression( new CoalCpT( tagsEPart.partCpTags[i], tagsECoal.volMassFracTags[i], tagsECoal.charMassFracTags[i], tagsECoal.moistureMassFracTags[i], tagsEPart.partMassFracTags[i], tagsEPart.partTempTags[i] )); - // mixing term in particle temperature equation - execFactory.register_expression( new CoalTempMixRHST( tagsEPart.partTempMixRhsTags[i], tagsECoal.volMassFracTags[i], tagsECoal.charMassFracTags[i], tagsECoal.moistureMassFracTags[i], - tagsEPart.partMassFracTags[i], tagsEPart.partTempTags[i], tagsEPart.partTempInflowTags[i], tagsEPart.partCpTags[i], - tagsE.rhoTag, tagsE.rhoInflowTag, tagsE.tauMixTag)); + + if(reactorType_ != "PFR"){ + // mixing term in particle temperature equation + execFactory.register_expression( new CoalTempMixRHST( tagsEPart.partTempMixRhsTags[i], tagsECoal.volMassFracTags[i], tagsECoal.charMassFracTags[i], tagsECoal.moistureMassFracTags[i], + tagsEPart.partMassFracTags[i], tagsEPart.partTempTags[i], tagsEPart.partTempInflowTags[i], tagsEPart.partCpTags[i], + tagsE.rhoTag, tagsE.rhoInflowTag, tagsE.tauMixTag)); + execFactory.register_expression( new ZeroDMixingCPT( tagsECoal.moistureMassFracMixRhsTags[i], tagsECoal.moistureMassFracInflowTags[i], tagsECoal.moistureMassFracTags[i], + tagsE.tauMixTag, tagsE.rhoInflowTag, tagsE.rhoTag )); + execFactory.register_expression( new ZeroDMixingCPT( tagsECoal.charMassFracMixRhsTags[i], tagsECoal.charMassFracInflowTags[i], tagsECoal.charMassFracTags[i], + tagsE.tauMixTag, tagsE.rhoInflowTag, tagsE.rhoTag ) ); + execFactory.register_expression( new SumOpT( tagsECoal.moistureMassFracFullRhsTags[i], { tagsECoal.moistureMassFracMixRhsTags[i], tagsECoal.moistureMassFracKinRhsTags[i] } )); + execFactory.register_expression( new SumOpT( tagsECoal.charMassFracFullRhsTags[i], {tagsECoal.charMassFracMixRhsTags[i], tagsECoal.charMassFracKinRhsTags[i]})); + + execFactory.register_expression( new PlaceHolderT( tagsECoal.moistureMassFracInflowTags[i] )); + execFactory.register_expression( new PlaceHolderT(tagsECoal.charMassFracInflowTags[i])); + } + else{ + execFactory.register_expression( new DivideT( tagsECoal.moistureMassFracFullRhsTags[i], tagsECoal.moistureMassFracKinRhsTags[i], tagsEpfr.uTag )); + execFactory.register_expression( new DivideT( tagsECoal.charMassFracFullRhsTags[i], tagsECoal.charMassFracKinRhsTags[i], tagsEpfr.uTag )); + } // moisture mass equation - execFactory.register_expression( new PlaceHolderT( tagsECoal.moistureMassFracInflowTags[i] )); - execFactory.register_expression( new LinearT( tagsECoal.moistureMassFracInitialTags[i], tagsECoal.moistureMassFracInflowTags[i], 1.0, 0.0)); - execFactory.register_expression( new ZeroDMixingCPT( tagsECoal.moistureMassFracMixRhsTags[i], tagsECoal.moistureMassFracInflowTags[i], tagsECoal.moistureMassFracTags[i], - tagsE.tauMixTag, tagsE.rhoInflowTag, tagsE.rhoTag )); + integrator_->register_root_expression( new PlaceHolderT( tagsECoal.moistureMassFracInitialTags[i] )); + execFactory.register_expression( new SourceFromGasMassT( tagsECoal.moistureMassFracKinRhsTags[i], tagsEPart.partToGasMassTag, tagsECoal.moistureMassFracTags[i])); - execFactory.register_expression( new SumOpT( tagsECoal.moistureMassFracFullRhsTags[i], { tagsECoal.moistureMassFracMixRhsTags[i], tagsECoal.moistureMassFracKinRhsTags[i] } )); + equIndex_ = equIndex_ + 1; integrator_->add_variable( tagsECoal.moistureMassFracTags[i].name(), tagsECoal.moistureMassFracFullRhsTags[i], equIndex_, equIndex_ ); // char mass equation - execFactory.register_expression( new PlaceHolderT(tagsECoal.charMassFracInflowTags[i])); - execFactory.register_expression( new LinearT( tagsECoal.charMassFracInitialTags[i], tagsECoal.charMassFracInflowTags[i], 1.0, 0.0)); - execFactory.register_expression( new ZeroDMixingCPT( tagsECoal.charMassFracMixRhsTags[i], tagsECoal.charMassFracInflowTags[i], tagsECoal.charMassFracTags[i], - tagsE.tauMixTag, tagsE.rhoInflowTag, tagsE.rhoTag ) ); + integrator_->register_root_expression( new PlaceHolderT(tagsECoal.charMassFracInitialTags[i])); + execFactory.register_expression( new SourceFromGasMassT( tagsECoal.charMassFracKinRhsTags[i], tagsEPart.partToGasMassTag, tagsECoal.charMassFracTags[i] )); - execFactory.register_expression( new SumOpT( tagsECoal.charMassFracFullRhsTags[i], {tagsECoal.charMassFracMixRhsTags[i], tagsECoal.charMassFracKinRhsTags[i]})); + equIndex_ = equIndex_ + 1; integrator_->add_variable( tagsECoal.charMassFracTags[i].name(), tagsECoal.charMassFracFullRhsTags[i], equIndex_, equIndex_ ); if(devModel_ != Dev::CPDM){ + if(reactorType_ != "PFR"){ + execFactory.register_expression( new ZeroDMixingCPT( tagsECoal.volMassFracMixRhsTags[i], tagsECoal.volMassFracInflowTags[i], tagsECoal.volMassFracTags[i], + tagsE.tauMixTag, tagsE.rhoInflowTag, tagsE.rhoTag ) ); + execFactory.register_expression( new SumOpT( tagsECoal.volMassFracFullRhsTags[i], {tagsECoal.volMassFracMixRhsTags[i], tagsECoal.volMassFracKinRhsTags[i]} ) ); + execFactory.register_expression(( new PlaceHolderT( tagsECoal.volMassFracInflowTags[i] ) )); + } + else{ + execFactory.register_expression( new DivideT( tagsECoal.volMassFracFullRhsTags[i], tagsECoal.volMassFracKinRhsTags[i], tagsEpfr.uTag )); + } // volatile mass equations - execFactory.register_expression( new PlaceHolderT( tagsECoal.volMassFracInflowTags[i] ) ); - execFactory.register_expression( new LinearT( tagsECoal.volMassFracInitialTags[i], tagsECoal.volMassFracInflowTags[i], 1.0, 0.0)); - execFactory.register_expression( new ZeroDMixingCPT( tagsECoal.volMassFracMixRhsTags[i], tagsECoal.volMassFracInflowTags[i], tagsECoal.volMassFracTags[i], - tagsE.tauMixTag, tagsE.rhoInflowTag, tagsE.rhoTag ) ); execFactory.register_expression( new SourceFromGasMassT( tagsECoal.volMassFracKinRhsTags[i], tagsEPart.partToGasMassTag, tagsECoal.volMassFracTags[i] )); - execFactory.register_expression( new SumOpT( tagsECoal.volMassFracFullRhsTags[i], {tagsECoal.volMassFracMixRhsTags[i], tagsECoal.volMassFracKinRhsTags[i]} ) ); + equIndex_ = equIndex_ + 1; integrator_->add_variable( tagsECoal.volMassFracTags[i].name(), tagsECoal.volMassFracFullRhsTags[i], equIndex_, equIndex_ ); } @@ -290,16 +314,23 @@ namespace Coal{ const int nparsize = particleNumArray_.size(); for( size_t i = 0;i < nparsize;i++ ){ if(!isRestart_){ - integrator_->copy_from_initial_condition_to_execution( tagsECoal.moistureMassFracInflowTags[i].name()); - integrator_->copy_from_initial_condition_to_execution( tagsECoal.charMassFracInflowTags[i].name()); - if(devModel_ != Dev::CPDM){ - integrator_->copy_from_initial_condition_to_execution( tagsECoal.volMassFracInflowTags[i].name()); + if(reactorType_ != "PFR"){ + integrator_->copy_from_initial_condition_to_execution( tagsECoal.moistureMassFracInflowTags[i].name()); + integrator_->copy_from_initial_condition_to_execution( tagsECoal.charMassFracInflowTags[i].name()); + if(devModel_ != Dev::CPDM){ + integrator_->copy_from_initial_condition_to_execution( tagsECoal.volMassFracInflowTags[i].name()); + } } + + integrator_->copy_from_initial_condition_to_execution( tagsECoal.moistureMassFracInitialTags[i].name()); + integrator_->copy_from_initial_condition_to_execution( tagsECoal.charMassFracInitialTags[i].name()); } - integrator_->lock_field( tagsECoal.moistureMassFracInflowTags[i] ); - integrator_->lock_field( tagsECoal.charMassFracInflowTags[i] ); - if(devModel_ != Dev::CPDM){ - integrator_->lock_field( tagsECoal.volMassFracInflowTags[i] ); + if(reactorType_ != "PFR"){ + integrator_->lock_field( tagsECoal.moistureMassFracInflowTags[i] ); + integrator_->lock_field( tagsECoal.charMassFracInflowTags[i] ); + if( devModel_ != Dev::CPDM ){ + integrator_->lock_field( tagsECoal.volMassFracInflowTags[i] ); + } } } if (devModel_ != Dev::OFF){ @@ -317,12 +348,23 @@ namespace Coal{ const int nparsize = particleNumArray_.size(); for( size_t i = 0;i < nparsize;i++ ){ primitiveTags_.push_back( tagsECoal.moistureMassFracTags[i] ); - kinRhsTags_.push_back( tagsECoal.moistureMassFracKinRhsTags[i] ); primitiveTags_.push_back( tagsECoal.charMassFracTags[i] ); - kinRhsTags_.push_back( tagsECoal.charMassFracKinRhsTags[i] ); + if(reactorType_!="PFR"){ + kinRhsTags_.push_back( tagsECoal.moistureMassFracKinRhsTags[i] ); + kinRhsTags_.push_back( tagsECoal.charMassFracKinRhsTags[i] ); + } + else{ + kinRhsTags_.push_back( tagsECoal.moistureMassFracFullRhsTags[i] ); + kinRhsTags_.push_back( tagsECoal.charMassFracFullRhsTags[i] ); + } if(devModel_ != Dev::CPDM){ primitiveTags_.push_back( tagsECoal.volMassFracTags[i] ); - kinRhsTags_.push_back( tagsECoal.volMassFracKinRhsTags[i] ); + if(reactorType_!="PFR"){ + kinRhsTags_.push_back( tagsECoal.volMassFracKinRhsTags[i] ); + } + else{ + kinRhsTags_.push_back( tagsECoal.volMassFracFullRhsTags[i] ); + } } } } @@ -337,12 +379,23 @@ namespace Coal{ const int nparsize = particleNumArray_.size(); for( size_t i = 0;i < nparsize;i++ ){ primVarIdxMap[tagsECoal.moistureMassFracTags[i]] = consVarIdxMap.at( tagsECoal.moistureMassFracTags[i] ); - kinRhsIdxMap[tagsECoal.moistureMassFracKinRhsTags[i]] = rhsIdxMap.at( tagsECoal.moistureMassFracFullRhsTags[i] ); primVarIdxMap[tagsECoal.charMassFracTags[i]] = consVarIdxMap.at( tagsECoal.charMassFracTags[i] ); - kinRhsIdxMap[tagsECoal.charMassFracKinRhsTags[i]] = rhsIdxMap.at( tagsECoal.charMassFracFullRhsTags[i] ); + if(reactorType_!="PFR"){ + kinRhsIdxMap[tagsECoal.moistureMassFracKinRhsTags[i]] = rhsIdxMap.at( tagsECoal.moistureMassFracFullRhsTags[i] ); + kinRhsIdxMap[tagsECoal.charMassFracKinRhsTags[i]] = rhsIdxMap.at( tagsECoal.charMassFracFullRhsTags[i] ); + } + else{ + kinRhsIdxMap[tagsECoal.moistureMassFracFullRhsTags[i]] = rhsIdxMap.at( tagsECoal.moistureMassFracFullRhsTags[i] ); + kinRhsIdxMap[tagsECoal.charMassFracFullRhsTags[i]] = rhsIdxMap.at( tagsECoal.charMassFracFullRhsTags[i] ); + } if(devModel_ != Dev::CPDM){ primVarIdxMap[tagsECoal.volMassFracTags[i]] = consVarIdxMap.at( tagsECoal.volMassFracTags[i] ); - kinRhsIdxMap[tagsECoal.volMassFracKinRhsTags[i]] = rhsIdxMap.at( tagsECoal.volMassFracFullRhsTags[i] ); + if(reactorType_!="PFR"){ + kinRhsIdxMap[tagsECoal.volMassFracKinRhsTags[i]] = rhsIdxMap.at( tagsECoal.volMassFracFullRhsTags[i] ); + } + else{ + kinRhsIdxMap[tagsECoal.volMassFracFullRhsTags[i]] = rhsIdxMap.at( tagsECoal.volMassFracFullRhsTags[i] ); + } } } diff --git a/src/particles/coal/CoalInterface.h b/src/particles/coal/CoalInterface.h index 5a00529..0127f1a 100755 --- a/src/particles/coal/CoalInterface.h +++ b/src/particles/coal/CoalInterface.h @@ -45,7 +45,6 @@ namespace Coal{ charMassFracFullRhsTags, ///< full RHS of char mass fraction equation volMassEachPartTags, ///< volatile mass in each particle volMassFracTags, ///< volatile mass fraction - volMassFracInitialTags, ///< initial volatile mass fraction volMassFracInflowTags, ///< inflowing devolatilization mass fraction in particle volMassFracMixRhsTags, ///< mixing RHS of devolatilization mass fraction equation volMassFracKinRhsTags, ///< kinetic RHS of devolatilization mass fraction equation @@ -77,6 +76,7 @@ namespace Coal{ Expr::TagList& kinRhsTags_; int& equIndex_; const bool isRestart_; + std::string reactorType_; Vap::Vaporization* vap_; Dev::DevolatilizationInterface* dev_; diff --git a/src/particles/coal/Devolatilization/CPD/CPDInterface.cpp b/src/particles/coal/Devolatilization/CPD/CPDInterface.cpp index 0848986..b654901 100755 --- a/src/particles/coal/Devolatilization/CPD/CPDInterface.cpp +++ b/src/particles/coal/Devolatilization/CPD/CPDInterface.cpp @@ -1,8 +1,10 @@ #include "SumOp.h" #include "ZeroDimMixing.h" #include "ReactorEnsembleUtil.h" +#include "TransformationMatrixExpressions.h" #include "particles/ParticleInterface.h" #include "particles/ParticleTransformExpressions.h" +#include "PlugFlowReactor/PlugFlowReactorInterface.h" // expressions we build here #include "CPDInterface.h" @@ -29,6 +31,7 @@ namespace CPD{ typedef Expr::PlaceHolder::Builder PlaceHolderT; typedef ReactorEnsembleUtil::SumOp::Builder SumT; + typedef ReactorEnsembleUtil::DivisionExpression::Builder DivisionT; typedef ReactorEnsembleUtil::ZeroDMixingCP::Builder ZeroDMixingCPT; typedef Particles::SourceFromGasMassChange::Builder SourceFromGasMassT; @@ -137,6 +140,11 @@ namespace CPD{ const Particles::ParticleEnsembleTags tagsPart( Expr::STATE_N, particleNumArray_ ); const CPD::CPDTags tagsCPD( Expr::STATE_N, particleNumArray_, cpdArray_ ); const Coal::CoalEnsembleTags tagsCoal( Expr::STATE_N, particleNumArray_ ); + const std::string reactorType = rootParser_["ReactorParameters"]["ReactorType"].as(); + + std::vector deltai0 = deltai_0( cpdInfo_, c0 ); + deltai0.push_back( tar0 ); + const std::vector defaultgi(cpdSpeciesNum, 0.0); const int nparsize = particleNumArray_.size(); double yvolInit, yvolInflow, l0_frac_init, l0_frac_inflow; // mass fraction l in particle volatile @@ -148,34 +156,35 @@ namespace CPD{ } else{ yvolInit = coalcomp_.get_vm(); } - if( rootParser_["Particles"]["CoalInflowComp"] ){ - const std::vector coalInflowComp = rootParser_["Particles"]["CoalInflowComp"].as >(); - yvolInflow = coalInflowComp[1]; + if(reactorType!="PFR"){ + if( rootParser_["Particles"]["CoalInflowComp"] ){ + const std::vector coalInflowComp = rootParser_["Particles"]["CoalInflowComp"].as >(); + yvolInflow = coalInflowComp[1]; + } + else{ yvolInflow = coalcomp_.get_vm(); } + l0_frac_inflow = rootParser_["Particles"]["CPDInflow"]["l"].as( cpdInfo_.get_l0_mass() ); + delta_frac_inflow = rootParser_["Particles"]["CPDInflow"]["deltai"].as>( deltai0 ); + gi_inflow = rootParser_["Particles"]["CPDInflow"]["gi"].as>( defaultgi ); } - else{ yvolInflow = coalcomp_.get_vm(); } l0_frac_init = rootParser_["Particles"]["CPDInit"]["l"].as( cpdInfo_.get_l0_mass() ); - l0_frac_inflow = rootParser_["Particles"]["CPDInflow"]["l"].as( cpdInfo_.get_l0_mass() ); - std::vector deltai0 = deltai_0( cpdInfo_, c0 ); - deltai0.push_back( tar0 ); delta_frac_init = rootParser_["Particles"]["CPDInit"]["deltai"].as>( deltai0 ); - delta_frac_inflow = rootParser_["Particles"]["CPDInflow"]["deltai"].as>( deltai0 ); - - const std::vector defaultgi(cpdSpeciesNum, 0.0); gi_init = rootParser_["Particles"]["CPDInit"]["gi"].as>( defaultgi ); - gi_inflow = rootParser_["Particles"]["CPDInflow"]["gi"].as>( defaultgi ); + for( size_t i = 0;i < nparsize;i++ ){ initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCPD.lTags[i], tagsPart.partMassFracTags[i], yvolInit * l0_frac_init, 0.0 ))); - initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCPD.lInflowTags[i], tagsPart.partMassFracInflowTags[i], yvolInflow * l0_frac_inflow, 0.0 ))); + if(reactorType!="PFR"){ initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCPD.lInflowTags[i], tagsPart.partMassFracInflowTags[i], yvolInflow * l0_frac_inflow, 0.0 )));} initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCPD.initPartMassFracTags[i], tagsPart.partMassFracTags[i], 1.0, 0.0 ))); for( size_t j = 0;j < cpdSpeciesNum;j++ ){ initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCPD.deltaTags[i*cpdSpeciesNum + j], tagsPart.partMassFracTags[i], yvolInit * delta_frac_init[j], 0.0 ))); - initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCPD.deltaInflowTags[i*cpdSpeciesNum + j], tagsPart.partMassFracInflowTags[i], yvolInflow * delta_frac_inflow[j], 0.0 ))); initRoots_.insert( initFactory_.register_expression( new ConstantT( tagsCPD.gTags[i*cpdSpeciesNum + j], gi_init[j] ))); - initRoots_.insert( initFactory_.register_expression( new ConstantT( tagsCPD.gInflowTags[i*cpdSpeciesNum + j], gi_inflow[j] ))); + if(reactorType!="PFR"){ + initRoots_.insert( initFactory_.register_expression( new LinearT( tagsCPD.deltaInflowTags[i*cpdSpeciesNum + j], tagsPart.partMassFracInflowTags[i], yvolInflow * delta_frac_inflow[j], 0.0 ))); + initRoots_.insert( initFactory_.register_expression( new ConstantT( tagsCPD.gInflowTags[i*cpdSpeciesNum + j], gi_inflow[j] ))); + } } } } @@ -187,6 +196,7 @@ namespace CPD{ const Coal::CoalEnsembleTags tagsECoal( Expr::STATE_NONE, particleNumArray_); const Dev::DevTags tagsEDev( Expr::STATE_NONE, particleNumArray_, speciesArray_, partNumSpeciesArray_ ); const CPD::CPDTags tagsECPD( Expr::STATE_NONE, particleNumArray_, cpdArray_ ); + const PlugFlowReactorInterface::PlugFlowReactorTags tagsEpfr( Expr::STATE_NONE ); Expr::ExpressionFactory& execFactory = integrator_->factory(); const int nparsize = particleNumArray_.size(); @@ -197,12 +207,17 @@ namespace CPD{ // kb execFactory.register_expression( new kbT( tagsECPD.kbTags[i], tagsEPart.partTempTags[i] )); //l_rhs - execFactory.register_expression( new PlaceHolderT( tagsECPD.lInflowTags[i] )); - execFactory.register_expression( new ZeroDMixingCPT( tagsECPD.lMixRhsTags[i], tagsECPD.lInflowTags[i], tagsECPD.lTags[i], tagsE.tauMixTag, tagsE.rhoInflowTag, tagsE.rhoTag )); execFactory.register_expression( new SourceFromGasMassT( tagsECPD.lKinRhsTags[i], tagsEPart.partToGasMassTag, tagsECPD.lTags[i])); execFactory.register_expression( new LRhsT( tagsECPD.lReacTags[i], tagsECPD.kbTags[i], tagsECPD.lTags[i] )); //negative execFactory.attach_dependency_to_expression( tagsECPD.lReacTags[i], tagsECPD.lKinRhsTags[i], Expr::ADD_SOURCE_EXPRESSION); - execFactory.register_expression( new SumT( tagsECPD.lFullRhsTags[i], { tagsECPD.lKinRhsTags[i], tagsECPD.lMixRhsTags[i] } )); + if(reactorType != "PFR"){ + execFactory.register_expression( new PlaceHolderT( tagsECPD.lInflowTags[i] )); + execFactory.register_expression( new ZeroDMixingCPT( tagsECPD.lMixRhsTags[i], tagsECPD.lInflowTags[i], tagsECPD.lTags[i], tagsE.tauMixTag, tagsE.rhoInflowTag, tagsE.rhoTag )); + execFactory.register_expression( new SumT( tagsECPD.lFullRhsTags[i], { tagsECPD.lKinRhsTags[i], tagsECPD.lMixRhsTags[i] } )); + } + else{ + execFactory.register_expression( new DivisionT( tagsECPD.lFullRhsTags[i], tagsECPD.lKinRhsTags[i], tagsEpfr.uTag )); + } //C_rhs execFactory.register_expression( new CRhsT( tagsEDev.volCharTags[i], tagsECPD.kbTags[i], tagsECPD.lTags[i], cpdInfo_ )); // positive @@ -214,24 +229,31 @@ namespace CPD{ execFactory.register_expression( new kgiT( tagsECPD.kgTags[i * cpdSpeciesNum + j], tagsECPD.egygTags[i * cpdSpeciesNum + j], tagsEPart.partTempTags[i], cpdInfo_, j )); //delta_i - execFactory.register_expression( new PlaceHolderT( tagsECPD.deltaInflowTags[i * cpdSpeciesNum + j] )); execFactory.register_expression( new SourceFromGasMassT( tagsECPD.deltaKinRhsTags[i * cpdSpeciesNum + j], tagsEPart.partToGasMassTag, tagsECPD.deltaTags[i * cpdSpeciesNum + j])); execFactory.register_expression( new DeltaiRhsT( tagsECPD.deltaReacTags[i * cpdSpeciesNum + j], tagsECPD.kbTags[i], tagsECPD.kgTags[i * cpdSpeciesNum + j], tagsECPD.deltaTags[i * cpdSpeciesNum + j], tagsECPD.lTags[i], cpdInfo_, tarSootInfo_, j )); execFactory.attach_dependency_to_expression( tagsECPD.deltaReacTags[i * cpdSpeciesNum + j], tagsECPD.deltaKinRhsTags[i * cpdSpeciesNum + j], Expr::ADD_SOURCE_EXPRESSION); - execFactory.register_expression( new ZeroDMixingCPT( tagsECPD.deltaMixRhsTags[i * cpdSpeciesNum + j], tagsECPD.deltaInflowTags[i * cpdSpeciesNum + j],tagsECPD.deltaTags[i * cpdSpeciesNum + j], - tagsE.tauMixTag, tagsE.rhoInflowTag, tagsE.rhoTag )); - execFactory.register_expression( new SumT( tagsECPD.deltaFullRhsTags[i * cpdSpeciesNum + j], { tagsECPD.deltaMixRhsTags[i * cpdSpeciesNum + j], tagsECPD.deltaKinRhsTags[i * cpdSpeciesNum + j] } )); //g_i - execFactory.register_expression( new PlaceHolderT( tagsECPD.gInflowTags[i * cpdSpeciesNum + j] )); execFactory.register_expression( new SourceFromGasMassT( tagsECPD.gKinRhsTags[i*cpdSpeciesNum+j], tagsEPart.partToGasMassTag, tagsECPD.gTags[i*cpdSpeciesNum+j])); execFactory.register_expression( new GiRhsT( tagsECPD.gReacTags[i * cpdSpeciesNum + j], tagsECPD.kbTags[i], tagsECPD.kgTags[i * cpdSpeciesNum + j], tagsECPD.deltaTags[i * cpdSpeciesNum + j], tagsECPD.lTags[i], cpdInfo_, tarSootInfo_, j )); //positive execFactory.attach_dependency_to_expression( tagsECPD.gReacTags[i * cpdSpeciesNum + j], tagsECPD.gKinRhsTags[i * cpdSpeciesNum + j], Expr::ADD_SOURCE_EXPRESSION); - execFactory.register_expression( new ZeroDMixingCPT( tagsECPD.gMixRhsTags[i * cpdSpeciesNum + j], tagsECPD.gInflowTags[i * cpdSpeciesNum + j], tagsECPD.gTags[i * cpdSpeciesNum + j], - tagsE.tauMixTag, tagsE.rhoInflowTag, tagsE.rhoTag )); - execFactory.register_expression( new SumT( tagsECPD.gFullRhsTags[i * cpdSpeciesNum + j],{ tagsECPD.gMixRhsTags[i * cpdSpeciesNum + j],tagsECPD.gKinRhsTags[i * cpdSpeciesNum + j] } )); + + if(reactorType != "PFR"){ + execFactory.register_expression( new PlaceHolderT( tagsECPD.deltaInflowTags[i * cpdSpeciesNum + j] )); + execFactory.register_expression( new PlaceHolderT( tagsECPD.gInflowTags[i * cpdSpeciesNum + j] )); + execFactory.register_expression( new ZeroDMixingCPT( tagsECPD.deltaMixRhsTags[i * cpdSpeciesNum + j], tagsECPD.deltaInflowTags[i * cpdSpeciesNum + j],tagsECPD.deltaTags[i * cpdSpeciesNum + j], + tagsE.tauMixTag, tagsE.rhoInflowTag, tagsE.rhoTag )); + execFactory.register_expression( new SumT( tagsECPD.deltaFullRhsTags[i * cpdSpeciesNum + j], { tagsECPD.deltaMixRhsTags[i * cpdSpeciesNum + j], tagsECPD.deltaKinRhsTags[i * cpdSpeciesNum + j] } )); + execFactory.register_expression( new ZeroDMixingCPT( tagsECPD.gMixRhsTags[i * cpdSpeciesNum + j], tagsECPD.gInflowTags[i * cpdSpeciesNum + j], tagsECPD.gTags[i * cpdSpeciesNum + j], + tagsE.tauMixTag, tagsE.rhoInflowTag, tagsE.rhoTag )); + execFactory.register_expression( new SumT( tagsECPD.gFullRhsTags[i * cpdSpeciesNum + j],{ tagsECPD.gMixRhsTags[i * cpdSpeciesNum + j],tagsECPD.gKinRhsTags[i * cpdSpeciesNum + j] } )); + } + else{ + execFactory.register_expression( new DivisionT( tagsECPD.deltaFullRhsTags[i * cpdSpeciesNum + j], tagsECPD.deltaKinRhsTags[i * cpdSpeciesNum + j], tagsEpfr.uTag )); + execFactory.register_expression( new DivisionT( tagsECPD.gFullRhsTags[i * cpdSpeciesNum + j], tagsECPD.gKinRhsTags[i * cpdSpeciesNum + j], tagsEpfr.uTag )); + } } execFactory.register_expression( new LinearT( tagsEDev.volTarTags[i], tagsECPD.gReacTags[(i+1)*cpdSpeciesNum-1], 1.0, 0.0)); //positive } @@ -256,24 +278,26 @@ namespace CPD{ void CPDInterface::initialize_coal_dev(){ const CPD::CPDTags tagsECPD( Expr::STATE_NONE, particleNumArray_, cpdArray_ ); + const std::string reactorType = rootParser_["ReactorParameters"]["ReactorType"].as(); const int nparsize = particleNumArray_.size(); for( size_t i = 0;i < nparsize;i++ ){ if(!isRestart_){ integrator_->copy_from_initial_condition_to_execution(tagsECPD.initPartMassFracTags[i].name()); - integrator_->copy_from_initial_condition_to_execution(tagsECPD.lInflowTags[i].name()); + if(reactorType != "PFR"){ integrator_->copy_from_initial_condition_to_execution(tagsECPD.lInflowTags[i].name());} } integrator_->lock_field( tagsECPD.initPartMassFracTags[i] ); - integrator_->lock_field( tagsECPD.lInflowTags[i] ); - - for(size_t j = 0; jcopy_from_initial_condition_to_execution(tagsECPD.deltaInflowTags[i*cpdSpeciesNum+j].name()); - integrator_->copy_from_initial_condition_to_execution(tagsECPD.gInflowTags[i*cpdSpeciesNum+j].name()); + if(reactorType != "PFR"){ + integrator_->lock_field( tagsECPD.lInflowTags[i] ); + for(size_t j = 0; jcopy_from_initial_condition_to_execution(tagsECPD.deltaInflowTags[i*cpdSpeciesNum+j].name()); + integrator_->copy_from_initial_condition_to_execution(tagsECPD.gInflowTags[i*cpdSpeciesNum+j].name()); + } + integrator_->lock_field( tagsECPD.deltaInflowTags[i*cpdSpeciesNum+j] ); + integrator_->lock_field( tagsECPD.gInflowTags[i*cpdSpeciesNum+j] ); } - integrator_->lock_field( tagsECPD.deltaInflowTags[i*cpdSpeciesNum+j] ); - integrator_->lock_field( tagsECPD.gInflowTags[i*cpdSpeciesNum+j] ); } } } @@ -284,13 +308,24 @@ namespace CPD{ const int nparsize = particleNumArray_.size(); for( size_t i = 0;i < nparsize;i++ ){ primitiveTags_.push_back( tagsECPD.lTags[i]); - kinRhsTags_.push_back( tagsECPD.lKinRhsTags[i]); + if(rootParser_["ReactorParameters"]["ReactorType"].as() != "PFR"){ + kinRhsTags_.push_back( tagsECPD.lKinRhsTags[i]); + } + else{ + kinRhsTags_.push_back( tagsECPD.lFullRhsTags[i]); + } + for(size_t j = 0; j() != "PFR"){ + kinRhsTags_.push_back( tagsECPD.deltaKinRhsTags[i * cpdSpeciesNum + j] ); + kinRhsTags_.push_back( tagsECPD.gKinRhsTags[i * cpdSpeciesNum + j] ); + } + else{ + kinRhsTags_.push_back( tagsECPD.deltaFullRhsTags[i * cpdSpeciesNum + j] ); + kinRhsTags_.push_back( tagsECPD.gFullRhsTags[i * cpdSpeciesNum + j] ); + } } } } @@ -304,13 +339,23 @@ namespace CPD{ const int nparsize = particleNumArray_.size(); for( size_t i = 0;i < nparsize;i++ ){ primVarIdxMap[tagsECPD.lTags[i]] = consVarIdxMap.at( tagsECPD.lTags[i]); - kinRhsIdxMap[tagsECPD.lKinRhsTags[i]] = rhsIdxMap.at( tagsECPD.lFullRhsTags[i]); + if(rootParser_["ReactorParameters"]["ReactorType"].as() != "PFR"){ + kinRhsIdxMap[tagsECPD.lKinRhsTags[i]] = rhsIdxMap.at( tagsECPD.lFullRhsTags[i] ); + } + else{ + kinRhsIdxMap[tagsECPD.lFullRhsTags[i]] = rhsIdxMap.at( tagsECPD.lFullRhsTags[i] ); + } for(size_t j = 0; j() != "PFR"){ + kinRhsIdxMap[tagsECPD.deltaKinRhsTags[i * cpdSpeciesNum + j]] = rhsIdxMap.at( tagsECPD.deltaFullRhsTags[i * cpdSpeciesNum + j] ); + kinRhsIdxMap[tagsECPD.gKinRhsTags[i * cpdSpeciesNum + j]] = rhsIdxMap.at( tagsECPD.gFullRhsTags[i * cpdSpeciesNum + j] ); + } + else{ + kinRhsIdxMap[tagsECPD.deltaFullRhsTags[i * cpdSpeciesNum + j]] = rhsIdxMap.at( tagsECPD.deltaFullRhsTags[i * cpdSpeciesNum + j] ); + kinRhsIdxMap[tagsECPD.gFullRhsTags[i * cpdSpeciesNum + j]] = rhsIdxMap.at( tagsECPD.gFullRhsTags[i * cpdSpeciesNum + j] ); + } } } } diff --git a/src/particles/coal/Devolatilization/DevolatilizationInterface.cpp b/src/particles/coal/Devolatilization/DevolatilizationInterface.cpp index 526e26b..d0df0b3 100755 --- a/src/particles/coal/Devolatilization/DevolatilizationInterface.cpp +++ b/src/particles/coal/Devolatilization/DevolatilizationInterface.cpp @@ -41,15 +41,18 @@ #include "DevolatilizationInterface.h" #include "CPD/c0_fun.h" #include "particles/coal/TarSootReaction/TarAndSootInfo.h" +#include "PlugFlowReactor/PlugFlowReactorInterface.h" namespace Dev { typedef pokitt::SpeciesEnthalpy::Builder SpecEnthT; + typedef ReactorEnsembleUtil::DivisionExpression::Builder DivisionT; typedef Particles::PartToGasCV::Builder PartToGasCVT; typedef Particles::GasMassSourceFromPart::Builder GasMassSourceT; typedef Particles::SpeciesSourceFromPart::Builder SpeciesSourceT; typedef Particles::GasEnergySourceFromPart::Builder GasEnergySourceT; + typedef Particles::DpDxSourceFromGasEnthalpyChange::Builder DpDxEnthalpyT; //--------------------------------------------------------------------------- DevTags:: @@ -57,13 +60,16 @@ namespace Dev { const std::vector& particleNumArray, const std::vector& SpeciesArray, const std::vector& partNumSpeciesArray) - : volMassGasSourceTag ( Expr::Tag( "vol_mass_gas_source" , state ) ), - volHeatGasSourceTag ( Expr::Tag( "vol_heat_gas_source" , state ) ), - volMassToGasTag ( Expr::Tag( "vol_mass_to_gas" , state ) ), - volHeatToGasTag ( Expr::Tag( "vol_heat_to_gas" , state ) ) + : volMassGasSourceTag ( Expr::Tag( "vol_mass_gas_source" , state ) ), + volHeatGasSourceTag ( Expr::Tag( "vol_heat_gas_source" , state ) ), + volHeatGasSourcePFRTag ( Expr::Tag( "vol_heat_gas_source_pfr" , state ) ), + volMassToGasTag ( Expr::Tag( "vol_mass_to_gas" , state ) ), + volHeatToGasTag ( Expr::Tag( "vol_heat_to_gas" , state ) ), + volHeatDpDxTag ( Expr::Tag( "vol_heat_dpdx" , state ) ) { volRateTags = Expr::tag_list( particleNumArray, state, "vol_rate_" ); volSpeciesSourceTags = Expr::tag_list( SpeciesArray, state, "vol_species_source_" ); + volSpeciesSourcePFRTags = Expr::tag_list( SpeciesArray, state, "vol_species_source_pfr_"); volSpeciesRHSTags = Expr::tag_list( SpeciesArray, state, "vol_species_rhs_" ); volSpeciesGasTags = Expr::tag_list( partNumSpeciesArray, state, "vol_species_mass_" ); volTarTags = Expr::tag_list( particleNumArray, state, "vol_tar_" ); @@ -180,6 +186,8 @@ namespace Dev { const Particles::ParticleEnsembleTags tagsEPart( Expr::STATE_NONE, particleNumArray_ ); const Dev::DevTags tagsEDev( Expr::STATE_NONE, particleNumArray_, speciesArray_, partNumSpeciesArray_ ); const Coal::CoalEnsembleTags tagsECoal( Expr::STATE_NONE, particleNumArray_ ); + const PlugFlowReactorInterface::PlugFlowReactorTags tagsEpfr( Expr::STATE_NONE ); + const std::string reactorType = rootParser_["ReactorParameters"]["ReactorType"].as(); const int nparsize = particleNumArray_.size(); const int nspecies = speciesArray_.size(); @@ -201,7 +209,6 @@ namespace Dev { // modify char mass fraction equations execFactory.attach_dependency_to_expression( tagsEDev.volCharTags[i], tagsECoal.charMassFracKinRhsTags[i], Expr::ADD_SOURCE_EXPRESSION ); //positive - //modify gas equations for( size_t j = 0; j() == "ConstantVolume"){ + if( reactorType== "PSRConstantVolume"){ execFactory.register_expression( new PartToGasCVT( tagsEDev.volMassToGasTag, tagsEDev.volMassGasSourceTag, tagsE.rhoTag ) ); execFactory.register_expression( new PartToGasCVT( tagsEDev.volHeatToGasTag, tagsEDev.volHeatGasSourceTag, tagsE.rhoTag ) ); execFactory.attach_dependency_to_expression( tagsEDev.volMassToGasTag, tagsE.rhoKinRhsTag, Expr::ADD_SOURCE_EXPRESSION ); @@ -220,13 +227,25 @@ namespace Dev { execFactory.attach_dependency_to_expression( tagsEDev.volSpeciesRHSTags[j], tagsE.rhoYKinRhsTags[Idx], Expr::ADD_SOURCE_EXPRESSION ); } } - if(rootParser_["ReactorParameters"]["ReactorType"].as() == "ConstantPressure"){ + if( reactorType == "PSRConstantPressure"){ execFactory.attach_dependency_to_expression( tagsEDev.volHeatGasSourceTag, tagsE.enthKinRhsTag, Expr::SUBTRACT_SOURCE_EXPRESSION ); for( size_t j = 0;j < nspecies;j++ ){ const int Idx = CanteraObjects::species_index( speciesArray_[j] ); execFactory.attach_dependency_to_expression( tagsEDev.volSpeciesSourceTags[j], tagsE.yKinRhsTags[Idx], Expr::ADD_SOURCE_EXPRESSION ); } } + if( reactorType == "PFR"){ + execFactory.register_expression( new DivisionT( tagsEDev.volHeatGasSourcePFRTag, tagsEDev.volHeatGasSourceTag, tagsEpfr.uTag )); + execFactory.attach_dependency_to_expression( tagsEDev.volHeatGasSourcePFRTag, tagsE.enthFullRhsTag, Expr::ADD_SOURCE_EXPRESSION ); + execFactory.register_expression( new DpDxEnthalpyT( tagsEDev.volHeatDpDxTag, tagsEDev.volHeatGasSourceTag, tagsE.rhoTag, tagsE.tempTag, + tagsE.enthTag, tagsE.mmwTag, tagsE.cpTag, tagsEpfr.uTag)); + execFactory.attach_dependency_to_expression( tagsEDev.volHeatDpDxTag, tagsEpfr.dpdxTag, Expr::ADD_SOURCE_EXPRESSION ); + for( size_t j = 0;j < nspecies;j++ ){ + const int Idx = CanteraObjects::species_index( speciesArray_[j] ); + execFactory.register_expression( new DivisionT( tagsEDev.volSpeciesSourcePFRTags[j], tagsEDev.volSpeciesSourceTags[j], tagsEpfr.uTag )); + execFactory.attach_dependency_to_expression( tagsEDev.volSpeciesSourcePFRTags[j], tagsE.yFullRhsTags[Idx], Expr::ADD_SOURCE_EXPRESSION ); + } + } devmodel_->build_equation_system_coal_dev(); } @@ -269,7 +288,7 @@ namespace Dev { std::map consVarRhsMap){ devmodel_->dmMixingdv_coal_dev( dmMixingdVPart, primVarIdxMap, rhsIdxMap, consVarRhsMap); - if(rootParser_["ReactorParameters"]["ReactorType"].as() == "ConstantPressure"){ + if(rootParser_["ReactorParameters"]["ReactorType"].as() == "PSRConstantPressure"){ if(tsm_ != Tarsoot::OFF){ tarsoot_->dmMixingdv_coal_tarsoot( dmMixingdVPart, primVarIdxMap, rhsIdxMap, consVarRhsMap); } diff --git a/src/particles/coal/Devolatilization/DevolatilizationInterface.h b/src/particles/coal/Devolatilization/DevolatilizationInterface.h index 96e33cd..7ae9e76 100755 --- a/src/particles/coal/Devolatilization/DevolatilizationInterface.h +++ b/src/particles/coal/Devolatilization/DevolatilizationInterface.h @@ -56,10 +56,13 @@ namespace Dev { public: const Expr::Tag volMassGasSourceTag, ///< gas phase mass source term from devolatilization volHeatGasSourceTag, ///< gas phase energy source term from devolatilization + volHeatGasSourcePFRTag, ///< gas phase energy source term from devolatilization for plug flow reactor volMassToGasTag, ///< rhs in gas phase mass equation from devolatilization - volHeatToGasTag; ///< rhs in gas phase energy equation from devolatilization + volHeatToGasTag, ///< rhs in gas phase energy equation from devolatilization + volHeatDpDxTag; ///< enthalpy source term in `Dp/Dx` from devolatilization for plug flow reactor Expr::TagList volRateTags, ///< devolatilization rate volSpeciesSourceTags, ///< species source term in gas from devolatilization + volSpeciesSourcePFRTags, ///< species source term in gas from devolatilization for plug flow reactor volSpeciesRHSTags, ///< rhs in species mass fraction equation in gas from volSpeciesGasTags, ///< species mass transport from every particle to gas volTarTags, ///< production of tar from devolatilization for every particle diff --git a/src/particles/coal/Devolatilization/KobayashiSarofim/KobSarofimInterface.cpp b/src/particles/coal/Devolatilization/KobayashiSarofim/KobSarofimInterface.cpp index 8246234..451c2b6 100755 --- a/src/particles/coal/Devolatilization/KobayashiSarofim/KobSarofimInterface.cpp +++ b/src/particles/coal/Devolatilization/KobayashiSarofim/KobSarofimInterface.cpp @@ -27,6 +27,7 @@ #include #include +#include #include "ZeroDimMixing.h" #include "SumOp.h" @@ -36,6 +37,7 @@ #include "KobayashiSarofimModel.h" #include "KobSarofimInterface.h" #include "KobSarofimData.h" +#include "PlugFlowReactor/PlugFlowReactorInterface.h" using Expr::matrix::sensitivity; @@ -45,6 +47,7 @@ namespace KobSarofim { typedef Expr::PlaceHolder::Builder PlaceHolderT; typedef ReactorEnsembleUtil::ZeroDMixingCP::Builder ZeroDMixingCPT; typedef ReactorEnsembleUtil::SumOp::Builder SumOpT; + typedef ReactorEnsembleUtil::DivisionExpression::Builder DivisionT; typedef Particles::SourceFromGasMassChange::Builder SourceFromGasMassT; typedef KobSarofim::KobayashiSarofimModel::Builder KobSaroT; @@ -110,13 +113,16 @@ namespace KobSarofim { const KobSarofim::KobSarofimTags tagsKoobS( Expr::STATE_N, particleNumArray_ ); KobSarofimInformation kobsarofimdate(coalcomp_); + const std::string reactorType = rootParser_["ReactorParameters"]["ReactorType"].as(); const int nparsize = particleNumArray_.size(); for( size_t i = 0;i < nparsize;i++ ){ initRoots_.insert( initFactory_.register_expression( new LinearT( tagsKoobS.yHVolTags[i], tagsCoal.volMassFracTags[i], kobsarofimdate.get_hydrogen_mass_fraction(), 0.0))); initRoots_.insert( initFactory_.register_expression( new LinearT( tagsKoobS.yOVolTags[i], tagsCoal.volMassFracTags[i], kobsarofimdate.get_oxygen_mass_fraction(), 0.0))); - initRoots_.insert( initFactory_.register_expression( new LinearT( tagsKoobS.yHVolInflowTags[i], tagsCoal.volMassFracInflowTags[i], kobsarofimdate.get_hydrogen_mass_fraction(), 0.0))); - initRoots_.insert( initFactory_.register_expression( new LinearT( tagsKoobS.yOVolInflowTags[i], tagsCoal.volMassFracInflowTags[i], kobsarofimdate.get_oxygen_mass_fraction(), 0.0))); + if(reactorType!="PFR"){ + initRoots_.insert( initFactory_.register_expression( new LinearT( tagsKoobS.yHVolInflowTags[i], tagsCoal.volMassFracInflowTags[i], kobsarofimdate.get_hydrogen_mass_fraction(), 0.0))); + initRoots_.insert( initFactory_.register_expression( new LinearT( tagsKoobS.yOVolInflowTags[i], tagsCoal.volMassFracInflowTags[i], kobsarofimdate.get_oxygen_mass_fraction(), 0.0))); + } } } @@ -127,6 +133,7 @@ namespace KobSarofim { const Coal::CoalEnsembleTags tagsECoal( Expr::STATE_NONE, particleNumArray_ ); const Dev::DevTags tagsEDev( Expr::STATE_NONE, particleNumArray_, speciesArray_, partNumSpeciesArray_ ); const KobSarofim::KobSarofimTags tagsEKoobS( Expr::STATE_NONE, particleNumArray_ ); + const PlugFlowReactorInterface::PlugFlowReactorTags tagsEpfr( Expr::STATE_NONE ); Expr::ExpressionFactory& execFactory = integrator_->factory(); @@ -147,19 +154,26 @@ namespace KobSarofim { execFactory.register_expression( new KobSaroT( devrhsTags, tagsEPart.partTempTags[i], tagsECoal.volMassFracTags[i], tagsEKoobS.yHVolTags[i], tagsEKoobS.yOVolTags[i], tarSootInfo_ ) ); - execFactory.register_expression( new PlaceHolderT( tagsEKoobS.yHVolInflowTags[i])); - execFactory.register_expression( new ZeroDMixingCPT( tagsEKoobS.yHVolMixRhsTags[i], tagsEKoobS.yHVolInflowTags[i], tagsEKoobS.yHVolTags[i], - tagsE.tauMixTag, tagsE.rhoInflowTag, tagsE.rhoTag )); execFactory.register_expression( new SourceFromGasMassT( tagsEKoobS.yHVolKinRhsTags[i], tagsEPart.partToGasMassTag, tagsEKoobS.yHVolTags[i])); execFactory.attach_dependency_to_expression( tagsEKoobS.yHVolRateTags[i], tagsEKoobS.yHVolKinRhsTags[i], Expr::ADD_SOURCE_EXPRESSION); - execFactory.register_expression( new SumOpT( tagsEKoobS.yHVolFullRhsTags[i], {tagsEKoobS.yHVolMixRhsTags[i], tagsEKoobS.yHVolKinRhsTags[i]})); - execFactory.register_expression( new PlaceHolderT( tagsEKoobS.yOVolInflowTags[i])); - execFactory.register_expression( new ZeroDMixingCPT( tagsEKoobS.yOVolMixRhsTags[i], tagsEKoobS.yOVolInflowTags[i], tagsEKoobS.yOVolTags[i], - tagsE.tauMixTag, tagsE.rhoInflowTag, tagsE.rhoTag )); execFactory.register_expression( new SourceFromGasMassT( tagsEKoobS.yOVolKinRhsTags[i], tagsEPart.partToGasMassTag, tagsEKoobS.yOVolTags[i])); execFactory.attach_dependency_to_expression( tagsEKoobS.yOVolRateTags[i], tagsEKoobS.yOVolKinRhsTags[i], Expr::ADD_SOURCE_EXPRESSION); - execFactory.register_expression( new SumOpT( tagsEKoobS.yOVolFullRhsTags[i], {tagsEKoobS.yOVolMixRhsTags[i], tagsEKoobS.yOVolKinRhsTags[i]})); + + if(rootParser_["ReactorParameters"]["ReactorType"].as()!="PFR"){ + execFactory.register_expression( new PlaceHolderT( tagsEKoobS.yHVolInflowTags[i])); + execFactory.register_expression( new PlaceHolderT( tagsEKoobS.yOVolInflowTags[i])); + execFactory.register_expression( new ZeroDMixingCPT( tagsEKoobS.yHVolMixRhsTags[i], tagsEKoobS.yHVolInflowTags[i], tagsEKoobS.yHVolTags[i], + tagsE.tauMixTag, tagsE.rhoInflowTag, tagsE.rhoTag )); + execFactory.register_expression( new SumOpT( tagsEKoobS.yHVolFullRhsTags[i], {tagsEKoobS.yHVolMixRhsTags[i], tagsEKoobS.yHVolKinRhsTags[i]})); + execFactory.register_expression( new ZeroDMixingCPT( tagsEKoobS.yOVolMixRhsTags[i], tagsEKoobS.yOVolInflowTags[i], tagsEKoobS.yOVolTags[i], + tagsE.tauMixTag, tagsE.rhoInflowTag, tagsE.rhoTag )); + execFactory.register_expression( new SumOpT( tagsEKoobS.yOVolFullRhsTags[i], {tagsEKoobS.yOVolMixRhsTags[i], tagsEKoobS.yOVolKinRhsTags[i]})); + } + else{ + execFactory.register_expression( new DivisionT( tagsEKoobS.yHVolFullRhsTags[i], tagsEKoobS.yHVolKinRhsTags[i], tagsEpfr.uTag )); + execFactory.register_expression( new DivisionT( tagsEKoobS.yOVolFullRhsTags[i], tagsEKoobS.yOVolKinRhsTags[i], tagsEpfr.uTag )); + } // add variables to the integrator equIndex_ = equIndex_ + 1; integrator_->add_variable( tagsEKoobS.yHVolTags[i].name(), tagsEKoobS.yHVolFullRhsTags[i], equIndex_, equIndex_ ); @@ -172,13 +186,15 @@ namespace KobSarofim { { const KobSarofim::KobSarofimTags tagsEKoobS( Expr::STATE_NONE, particleNumArray_ ); const int nparsize = particleNumArray_.size(); - for( size_t i = 0;i < nparsize;i++ ){ - if(!isRestart_){ - integrator_->copy_from_initial_condition_to_execution( tagsEKoobS.yHVolInflowTags[i].name()); - integrator_->copy_from_initial_condition_to_execution( tagsEKoobS.yOVolInflowTags[i].name()); + if(rootParser_["ReactorParameters"]["ReactorType"].as()!="PFR"){ + for( size_t i = 0;i < nparsize;i++ ){ + if(!isRestart_){ + integrator_->copy_from_initial_condition_to_execution( tagsEKoobS.yHVolInflowTags[i].name()); + integrator_->copy_from_initial_condition_to_execution( tagsEKoobS.yOVolInflowTags[i].name()); + } + integrator_->lock_field( tagsEKoobS.yHVolInflowTags[i] ); + integrator_->lock_field( tagsEKoobS.yOVolInflowTags[i] ); } - integrator_->lock_field( tagsEKoobS.yHVolInflowTags[i] ); - integrator_->lock_field( tagsEKoobS.yOVolInflowTags[i] ); } } @@ -189,8 +205,14 @@ namespace KobSarofim { for( size_t i = 0;i < nparsize;i++ ){ primitiveTags_.push_back(tagsKoobS.yHVolTags[i] ); primitiveTags_.push_back(tagsKoobS.yOVolTags[i] ); - kinRhsTags_.push_back(tagsKoobS.yHVolKinRhsTags[i]); - kinRhsTags_.push_back(tagsKoobS.yOVolKinRhsTags[i]); + if(rootParser_["ReactorParameters"]["ReactorType"].as()!="PFR"){ + kinRhsTags_.push_back( tagsKoobS.yHVolKinRhsTags[i] ); + kinRhsTags_.push_back( tagsKoobS.yOVolKinRhsTags[i] ); + } + else{ + kinRhsTags_.push_back( tagsKoobS.yHVolFullRhsTags[i] ); + kinRhsTags_.push_back( tagsKoobS.yOVolFullRhsTags[i] ); + } } } @@ -204,8 +226,14 @@ namespace KobSarofim { for( size_t i = 0;i < nparsize;i++ ){ primVarIdxMap[tagsKoobS.yHVolTags[i]] = consVarIdxMap.at( tagsKoobS.yHVolTags[i]); primVarIdxMap[tagsKoobS.yOVolTags[i]] = consVarIdxMap.at( tagsKoobS.yOVolTags[i]); - kinRhsIdxMap[tagsKoobS.yHVolKinRhsTags[i]] = rhsIdxMap.at( tagsKoobS.yHVolFullRhsTags[i]); - kinRhsIdxMap[tagsKoobS.yOVolKinRhsTags[i]] = rhsIdxMap.at( tagsKoobS.yOVolFullRhsTags[i]); + if(rootParser_["ReactorParameters"]["ReactorType"].as()!="PFR"){ + kinRhsIdxMap[tagsKoobS.yHVolKinRhsTags[i]] = rhsIdxMap.at( tagsKoobS.yHVolFullRhsTags[i] ); + kinRhsIdxMap[tagsKoobS.yOVolKinRhsTags[i]] = rhsIdxMap.at( tagsKoobS.yOVolFullRhsTags[i] ); + } + else{ + kinRhsIdxMap[tagsKoobS.yHVolFullRhsTags[i]] = rhsIdxMap.at( tagsKoobS.yHVolFullRhsTags[i] ); + kinRhsIdxMap[tagsKoobS.yOVolFullRhsTags[i]] = rhsIdxMap.at( tagsKoobS.yOVolFullRhsTags[i] ); + } } } diff --git a/src/particles/coal/TarSootReaction/SootFormationRate.h b/src/particles/coal/TarSootReaction/SootFormationRate.h index 1c946a4..a6f3a07 100755 --- a/src/particles/coal/TarSootReaction/SootFormationRate.h +++ b/src/particles/coal/TarSootReaction/SootFormationRate.h @@ -120,13 +120,13 @@ namespace Tarsoot { const FieldT& massTar = massTar_->field_ref(); const FieldT& temp = temp_->field_ref(); - if (reactorType_ == "ConstantVolume"){ + if (reactorType_ == "PSRConstantVolume"){ const FieldT& rho = rho_->field_ref(); tarConsump <<= cond( massTar <= 0.0, 0.0) ( - rho * massTar * A_ * exp( -E_ / ( gasCon_ * temp ))); // negative } - if (reactorType_ == "ConstantPressure"){ + else{ tarConsump <<= cond( massTar <= 0.0, 0.0) ( - massTar * A_ * exp( -E_ / ( gasCon_ * temp ))); // negative } @@ -145,7 +145,7 @@ namespace Tarsoot { const FieldT& dmassTardv = massTar_->sens_field_ref( sensVarTag ); const FieldT& dtempdv = temp_->sens_field_ref( sensVarTag ); - if (reactorType_ == "ConstantVolume"){ + if (reactorType_ == "PSRConstantVolume"){ const FieldT& rho = rho_->field_ref(); const FieldT& drhodv = rho_->sens_field_ref( sensVarTag ); dfdvs[0] <<= cond( massTar <= 0.0, 0.0) @@ -153,7 +153,7 @@ namespace Tarsoot { - rho * massTar * A_ * exp(-E_ / ( gasCon_ * temp )) * E_ / (gasCon_*temp*temp) * dtempdv); } - if (reactorType_ == "ConstantPressure"){ + else{ dfdvs[0] <<= cond( massTar <= 0.0, 0.0) ( - dmassTardv * A_ * exp( -E_ / ( gasCon_ * temp )) - massTar * A_ * exp(-E_ / ( gasCon_ * temp )) * E_ / (gasCon_*temp*temp) * dtempdv); diff --git a/src/particles/coal/TarSootReaction/SootOxidationRate.h b/src/particles/coal/TarSootReaction/SootOxidationRate.h index cf77b73..0c44472 100644 --- a/src/particles/coal/TarSootReaction/SootOxidationRate.h +++ b/src/particles/coal/TarSootReaction/SootOxidationRate.h @@ -144,13 +144,13 @@ namespace Tarsoot { SpatFldPtr nSootParticle = SpatialFieldStore::get( press ); *nSootParticle <<= na_ / ( cMin_ * sootMW_ ) * massSoot; - if (reactorType_=="ConstantVolume"){ + if (reactorType_=="PSRConstantVolume"){ const FieldT& rho = rho_ ->field_ref(); result <<= cond( massSoot <= 0.0, 0.0) ( - rho * pow( 36.0*M_PI * *nSootParticle * square(massSoot / sootDens_), 1.0/3.0 ) // (total surface area of soot particles)/density * mmw/O2Mw_ * yO2 * press/sqrt(temp) * A_ * exp(-E_ / (gasCon_ * temp)) ); } - if (reactorType_=="ConstantPressure"){ + else{ result <<= cond( massSoot <= 0.0, 0.0) ( - pow( 36.0*M_PI * *nSootParticle * square(massSoot / sootDens_), 1.0/3.0 ) // (total surface area of soot particles)/density * mmw/O2Mw_ * yO2 * press/sqrt(temp) * A_ * exp(-E_ / (gasCon_ * temp)) ); @@ -192,7 +192,7 @@ namespace Tarsoot { - mmw/O2Mw_ * yO2*press * 1.0 / 2.0 * pow(temp, -1.5) * dtempdv) * A_ * exp(-E_ / (gasCon_ * temp)) + mmw/O2Mw_ * yO2 * press/sqrt(temp) * A_ * exp(-E_ / (gasCon_ * temp)) * E_/(gasCon_ * temp * temp) * dtempdv; - if (reactorType_=="ConstantVolume"){ + if (reactorType_=="PSRConstantVolume"){ const FieldT& rho = rho_->field_ref(); const FieldT& drhodv = rho_->sens_field_ref( sensVarTag ); dfdv <<= cond( massSoot <= 0.0, 0.0) @@ -201,7 +201,7 @@ namespace Tarsoot { - rho * *surfArea * *drateTermdv); } - if (reactorType_=="ConstantPressure"){ + else{ dfdv <<= cond( massSoot <= 0.0, 0.0) ( - *dsurfAreadv * *rateTerm - *surfArea * *drateTermdv); diff --git a/src/particles/coal/TarSootReaction/TarGasificationRate.h b/src/particles/coal/TarSootReaction/TarGasificationRate.h index a5214a1..363eea8 100644 --- a/src/particles/coal/TarSootReaction/TarGasificationRate.h +++ b/src/particles/coal/TarSootReaction/TarGasificationRate.h @@ -107,12 +107,12 @@ namespace Tarsoot { const FieldT& massTar = massTar_->field_ref(); const FieldT& temp = temp_->field_ref(); - if( reactorType_=="ConstantVolume"){ + if( reactorType_=="PSRConstantVolume"){ const FieldT& rho =rho_->field_ref(); result <<= cond( massTar <= 0.0, 0.0) ( - rho * massTar * A_ * exp( -E_ / ( gasCon_ * temp ))); //negative } - if( reactorType_=="ConstantPressure"){ + else{ result <<= cond( massTar <= 0.0, 0.0) ( - massTar * A_ * exp( -E_ / ( gasCon_ * temp ))); //negative } @@ -126,7 +126,7 @@ namespace Tarsoot { const FieldT& dmassTardv = massTar_->sens_field_ref(sensVarTag); const FieldT& dtempdv = temp_->sens_field_ref(sensVarTag); - if( reactorType_=="ConstantVolume"){ + if( reactorType_=="PSRConstantVolume"){ const FieldT& rho =rho_->field_ref(); const FieldT& drhodv =rho_->sens_field_ref(sensVarTag); dfdv <<= cond( massTar <= 0.0, 0.0) @@ -134,7 +134,7 @@ namespace Tarsoot { - rho*massTar * A_ * exp(-E_ / ( gasCon_ * temp )) * E_ / (gasCon_*temp*temp) * dtempdv); } - if( reactorType_=="ConstantPressure"){ + else{ dfdv <<= cond( massTar <= 0.0, 0.0) ( - dmassTardv * A_ * exp( -E_ / ( gasCon_ * temp )) - massTar * A_ * exp(-E_ / ( gasCon_ * temp )) * E_ / (gasCon_*temp*temp) * dtempdv); diff --git a/src/particles/coal/TarSootReaction/TarOxidationRate.h b/src/particles/coal/TarSootReaction/TarOxidationRate.h index 89231a5..69d3b33 100644 --- a/src/particles/coal/TarSootReaction/TarOxidationRate.h +++ b/src/particles/coal/TarSootReaction/TarOxidationRate.h @@ -112,11 +112,11 @@ namespace Tarsoot { const FieldT& massTar = massTar_->field_ref(); const FieldT& temp = temp_ ->field_ref(); - if( reactorType_=="ConstantVolume"){ + if( reactorType_=="PSRConstantVolume"){ result <<= cond( massTar <= 0.0, 0.0) ( - square(density) * massTar * yO2 * A_ * exp( -E_ / ( gasCon_* temp ) )); // negative } - if( reactorType_=="ConstantPressure"){ + else{ result <<= cond( massTar <= 0.0, 0.0) ( - massTar * density * yO2 * A_ * exp( -E_ / ( gasCon_* temp ) )); // negative } @@ -134,14 +134,14 @@ namespace Tarsoot { const FieldT& dmassTardv = massTar_->sens_field_ref(sensVarTag); const FieldT& dtempdv = temp_ ->sens_field_ref(sensVarTag); - if( reactorType_=="ConstantVolume"){ + if( reactorType_=="PSRConstantVolume"){ dfdv<<= cond( massTar <= 0.0, 0.0 ) ( - ( square(density) * dmassTardv * yO2 + 2 * density * ddensitydv * massTar * yO2 + square(density) * massTar * dyO2dv) * A_ * exp( -E_ / ( gasCon_* temp ) ) - massTar * square(density) * yO2 * A_ * exp( -E_ / ( gasCon_* temp ) ) * E_ / (gasCon_ * temp * temp) * dtempdv ); } - if( reactorType_=="ConstantPressure"){ + else{ dfdv<<= cond( massTar <= 0.0, 0.0 ) ( - ( dmassTardv * density * yO2 + massTar * ddensitydv * yO2 + massTar * density * dyO2dv) * A_ * exp( -E_ / ( gasCon_* temp ) ) diff --git a/src/particles/coal/TarSootReaction/TarSootReactionInterface.cpp b/src/particles/coal/TarSootReaction/TarSootReactionInterface.cpp index 11c8372..5148ac1 100755 --- a/src/particles/coal/TarSootReaction/TarSootReactionInterface.cpp +++ b/src/particles/coal/TarSootReaction/TarSootReactionInterface.cpp @@ -48,6 +48,7 @@ #include "SootOxidationRate.h" #include "DerivedRxnTerms.h" #include "TarSootTransformExpression.h" +#include "PlugFlowReactor/PlugFlowReactorInterface.h" #define ASSEMBLER(MatrixT, FieldT, name) \ boost::shared_ptr > name = boost::make_shared >( #name ); @@ -66,8 +67,10 @@ namespace Tarsoot { typedef ReactorEnsembleUtil::ZeroDMixing::Builder ZeroDMixingT; typedef ReactorEnsembleUtil::ZeroDMixingCP::Builder ZeroDMixingCPT; typedef ReactorEnsembleUtil::ProductExpression::Builder ProductT; + typedef ReactorEnsembleUtil::DivisionExpression::Builder DivisionT; typedef Particles::SourceFromGasMassChange::Builder SourceFromGasMassT; + typedef Particles::DpDxSourceFromGasEnthalpyChange::Builder DpDxEnthalpyT; typedef Tarsoot::TarOxidationRate::Builder TarOxiT; typedef Tarsoot::TarGasificationRate::Builder TarGasiT; @@ -110,8 +113,13 @@ namespace Tarsoot { o2ConsumTotalTag ( Expr::Tag( "o2_consum_total" , state ) ), coProdTotalTag ( Expr::Tag( "co_prod_total" , state ) ), h2oProdTotalTag ( Expr::Tag( "h2o_prod_total" , state ) ), + o2ConsumTotalPFRTag ( Expr::Tag( "o2_consum_total_pfr" , state ) ), + coProdTotalPFRTag ( Expr::Tag( "co_prod_total_pfr" , state ) ), + h2oProdTotalPFRTag ( Expr::Tag( "h2o_prod_total_pfr" , state ) ), tarSootMassGasSourceTag ( Expr::Tag( "tar_soot_mass_gas_source" , state ) ), tarSootHeatGasSourceTag ( Expr::Tag( "tar_soot_heat_gas_source" , state ) ), + tarSootHeatGasSourcePFRTag ( Expr::Tag( "tar_soot_heat_gas_source_pfr" , state ) ), + tarSootHeatGasSourceDpDxTag ( Expr::Tag( "tar_soot_heat_gas_source_dpdx" , state ) ), tarGasifTag ( Expr::Tag( "tar_gasif" , state ) ), tarOxidTag ( Expr::Tag( "tar_oxid" , state ) ), tarToSootTag ( Expr::Tag( "tar_to_soot" , state ) ), @@ -122,6 +130,7 @@ namespace Tarsoot { coProductionTarTag ( Expr::Tag( "co_product_tar" , state ) ), h2oProductionTarTag ( Expr::Tag( "h2o_product_tar" , state ) ), h2ProductionTarTag ( Expr::Tag( "h2_product_tar" , state ) ), + h2ProductionTarPFRTag ( Expr::Tag( "h2_product_tar_pfr" , state ) ), o2ConsumptionSootTag ( Expr::Tag( "o2_consump_soot" , state ) ), coProductionSootTag ( Expr::Tag( "co_product_soot" , state ) ), h2oProductionSootTag ( Expr::Tag( "h2o_product_soot" , state ) ), @@ -165,6 +174,7 @@ namespace Tarsoot { isRestart_(isRestart), haveSoot_(rootParser["Particles"]["SootIsCarbon"]) { + reactorType_ = rootParser_["ReactorParameters"]["ReactorType"].as(); if(!isRestart_){ setup_initial_conditions_tarsoot(); } @@ -186,25 +196,27 @@ namespace Tarsoot { const Tarsoot::TarSootTags tagsTarsoot( Expr::STATE_N, particleNumArray_ ); double tarInflow, sootInflow, tarInit, sootInit; const std::vector defaultTarSoot = {0.0, 0.0}; - tarInflow = rootParser_["Particles"]["TarSootInflowFrac"].as>(defaultTarSoot)[0]; - sootInflow = rootParser_["Particles"]["TarSootInflowFrac"].as>(defaultTarSoot)[1]; + if(reactorType_!="PFR"){ + tarInflow = rootParser_["Particles"]["TarSootInflowFrac"].as>(defaultTarSoot)[0]; + sootInflow = rootParser_["Particles"]["TarSootInflowFrac"].as>(defaultTarSoot)[1]; + } tarInit = rootParser_["Particles"]["TarSootInitFrac"].as>(defaultTarSoot)[0]; sootInit = rootParser_["Particles"]["TarSootInitFrac"].as>(defaultTarSoot)[1]; - if( rootParser_["ReactorParameters"]["ReactorType"].as() == "ConstantVolume" ){ + if( reactorType_ == "PSRConstantVolume" ){ initRoots_.insert( initFactory_.register_expression( new LinearT( tagsTarsoot.rhotarGasMassTag, tags.rhoTag, tarInit, 0.0))); - initRoots_.insert( initFactory_.register_expression(new LinearT( tagsTarsoot.rhotarGasInflowTag, tags.rhoInflowTag, tarInflow, 0.0 ))); + if(reactorType_!="PFR"){ initRoots_.insert( initFactory_.register_expression(new LinearT( tagsTarsoot.rhotarGasInflowTag, tags.rhoInflowTag, tarInflow, 0.0 )));} if(haveSoot_){ initRoots_.insert( initFactory_.register_expression( new LinearT( tagsTarsoot.rhosootMassTag, tags.rhoTag, sootInit, 0.0))); - initRoots_.insert( initFactory_.register_expression(new LinearT( tagsTarsoot.rhosootInflowTag, tags.rhoInflowTag, sootInflow, 0.0 ))); + if(reactorType_!="PFR"){ initRoots_.insert( initFactory_.register_expression(new LinearT( tagsTarsoot.rhosootInflowTag, tags.rhoInflowTag, sootInflow, 0.0 )));} } } - if( rootParser_["ReactorParameters"]["ReactorType"].as() == "ConstantPressure" ){ + else{ initRoots_.insert( initFactory_.register_expression( new ConstantT( tagsTarsoot.tarGasMassTag, tarInit ))); - initRoots_.insert( initFactory_.register_expression( new ConstantT( tagsTarsoot.tarGasInflowTag,tarInflow ) ) ); + if(reactorType_!="PFR"){ initRoots_.insert( initFactory_.register_expression( new ConstantT( tagsTarsoot.tarGasInflowTag,tarInflow ) ) );} if(haveSoot_){ initRoots_.insert( initFactory_.register_expression( new ConstantT( tagsTarsoot.sootMassTag, sootInit ))); - initRoots_.insert( initFactory_.register_expression( new ConstantT( tagsTarsoot.sootInflowTag,sootInflow ) ) ); + if(reactorType_!="PFR"){ initRoots_.insert( initFactory_.register_expression( new ConstantT( tagsTarsoot.sootInflowTag,sootInflow ) ) );} } } } @@ -217,9 +229,9 @@ namespace Tarsoot { const Coal::CoalEnsembleTags tagsECoal( Expr::STATE_NONE, particleNumArray_ ); const Dev::DevTags tagsEDev( Expr::STATE_NONE, particleNumArray_, speciesArray_, partNumSpeciesArray_ ); const Tarsoot::TarSootTags tagsETarsoot( Expr::STATE_NONE, particleNumArray_ ); + const PlugFlowReactorInterface::PlugFlowReactorTags tagsEpfr( Expr::STATE_NONE ); const int nparsize = particleNumArray_.size(); - const std::string reactorType = rootParser_["ReactorParameters"]["ReactorType"].as(); const int IdxO2 = CanteraObjects::species_index( "O2" ); const int IdxCO = CanteraObjects::species_index( "CO" ); const int IdxH2O = CanteraObjects::species_index( "H2O" ); @@ -236,7 +248,7 @@ namespace Tarsoot { Expr::ExpressionFactory& execFactory = integrator_->factory(); - execFactory.register_expression( new TarOxiT( tagsETarsoot.tarOxidTag, tagsE.rhoTag, tagsE.massTags[IdxO2], tagsETarsoot.tarGasMassTag, tagsE.tempTag, reactorType )); // negative + execFactory.register_expression( new TarOxiT( tagsETarsoot.tarOxidTag, tagsE.rhoTag, tagsE.massTags[IdxO2], tagsETarsoot.tarGasMassTag, tagsE.tempTag, reactorType_ )); // negative // execFactory.register_expression( new TarGasiT( tagsETarsoot.tarGasifTag, tagsETarsoot.tarGasMassTag, tagsE.tempTag, tagsE.rhoTag, reactorType )); // negative execFactory.register_expression( new ConstantT( tagsETarsoot.tarGasifTag, 0.0 )); // negative @@ -247,9 +259,9 @@ namespace Tarsoot { execFactory.register_expression( new DerivedRxnRateT( tagsETarsoot.h2oProductionTarTag, tarMW, 18.02, -1.0, tarH2O, tagsETarsoot.tarOxidTag )); // positive if(haveSoot_){ execFactory.register_expression( new SootFormT( Expr::tag_list( tagsETarsoot.tarToSootTag, tagsETarsoot.sootFormTag ), tagsETarsoot.tarGasMassTag, tagsE.tempTag, tagsE.rhoTag, - tarSootInfo_, reactorType )); // tarToSoot: negative; sootForm: positive + tarSootInfo_, reactorType_ )); // tarToSoot: negative; sootForm: positive execFactory.register_expression( new SootOxidT( tagsETarsoot.sootOxidTag, tagsE.massTags[IdxO2], tagsETarsoot.sootMassTag, - tagsE.presTag, tagsE.tempTag, tagsE.rhoTag, tagsE.mmwTag, reactorType, tarSootInfo_ )); //negative + tagsE.presTag, tagsE.tempTag, tagsE.rhoTag, tagsE.mmwTag, reactorType_, tarSootInfo_ )); //negative execFactory.register_expression( new DerivedRxnRateT( tagsETarsoot.h2ProductionTarTag, tarMW, 2.016, -1.0, tarH2, tagsETarsoot.tarToSootTag ));// positive // Calculate the O2, CO, and H2O source terms due to soot oxidation: execFactory.register_expression( new DerivedRxnRateT( tagsETarsoot.o2ConsumptionSootTag, sootMW, 32.0, 1.0, sootO2, tagsETarsoot.sootOxidTag )); // negative @@ -283,7 +295,7 @@ namespace Tarsoot { tagsETarsoot.h2ProductionTarTag, tagsETarsoot.o2EnthTgasTag, tagsETarsoot.coEnthTgasTag, tagsETarsoot.h2oEnthTgasTag, tagsETarsoot.h2EnthTgasTag, tagsETarsoot.tarOxidTag, tagsETarsoot.sootOxidTag, tarSootInfo_)); - if( rootParser_["ReactorParameters"]["ReactorType"].as() == "ConstantVolume" ){ + if( reactorType_ == "PSRConstantVolume" ){ // tar mass fraction equation execFactory.register_expression( new PlaceHolderT( tagsETarsoot.rhotarGasInflowTag ) ); execFactory.register_expression( new SumOpT( tagsETarsoot.rhotarGasKinRhsTag, {tagsETarsoot.tarOxidTag, tagsETarsoot.tarGasifTag, tagsETarsoot.tarToSootTag} ) ); @@ -330,13 +342,10 @@ namespace Tarsoot { } } - if( rootParser_["ReactorParameters"]["ReactorType"].as() == "ConstantPressure" ){ + if( reactorType_ == "PSRConstantPressure" or reactorType_ == "PFR"){ // tar mass fraction equation - execFactory.register_expression( new PlaceHolderT( tagsETarsoot.tarGasInflowTag ) ); + integrator_->register_root_expression( new PlaceHolderT( tagsETarsoot.tarGasInflowTag ) ); execFactory.register_expression( new SumOpT( tagsETarsoot.tarGasKinRhsTag, {tagsETarsoot.tarOxidTag, tagsETarsoot.tarGasifTag, tagsETarsoot.tarToSootTag} ) ); - execFactory.register_expression( new ZeroDMixingCPT( tagsETarsoot.tarGasMixRhsTag, tagsETarsoot.tarGasInflowTag, tagsETarsoot.tarGasMassTag, tagsE.tauMixTag, - tagsE.rhoInflowTag, tagsE.rhoTag )); - execFactory.register_expression( new SumOpT( tagsETarsoot.tarGasFullRhsTag, {tagsETarsoot.tarGasMixRhsTag, tagsETarsoot.tarGasKinRhsTag} ) ); // modify tar equations for( size_t i = 0;i < nparsize;i++ ){ @@ -347,28 +356,57 @@ namespace Tarsoot { execFactory.register_expression( new SourceFromGasMassT( tagsETarsoot.tarGasSrcFromGasSrcTag, tagsEPart.partToGasMassTag, tagsETarsoot.tarGasMassTag)); execFactory.attach_dependency_to_expression( tagsETarsoot.tarGasSrcFromGasSrcTag, tagsETarsoot.tarGasKinRhsTag, Expr::ADD_SOURCE_EXPRESSION); - // modify gas equations - execFactory.attach_dependency_to_expression( tagsETarsoot.o2ConsumTotalTag, tagsE.yKinRhsTags[IdxO2], Expr::ADD_SOURCE_EXPRESSION ); - execFactory.attach_dependency_to_expression( tagsETarsoot.coProdTotalTag, tagsE.yKinRhsTags[IdxCO], Expr::ADD_SOURCE_EXPRESSION ); - execFactory.attach_dependency_to_expression( tagsETarsoot.h2oProdTotalTag, tagsE.yKinRhsTags[IdxH2O], Expr::ADD_SOURCE_EXPRESSION ); - execFactory.attach_dependency_to_expression( tagsETarsoot.h2ProductionTarTag, tagsE.yKinRhsTags[IdxH2], Expr::ADD_SOURCE_EXPRESSION ); + if( reactorType_ == "PSRConstantPressure"){ + execFactory.register_expression( new ZeroDMixingCPT( tagsETarsoot.tarGasMixRhsTag, tagsETarsoot.tarGasInflowTag, tagsETarsoot.tarGasMassTag, tagsE.tauMixTag, + tagsE.rhoInflowTag, tagsE.rhoTag )); + execFactory.register_expression( new SumOpT( tagsETarsoot.tarGasFullRhsTag, {tagsETarsoot.tarGasMixRhsTag, tagsETarsoot.tarGasKinRhsTag} ) ); + + // modify gas equations + execFactory.attach_dependency_to_expression( tagsETarsoot.o2ConsumTotalTag, tagsE.yKinRhsTags[IdxO2], Expr::ADD_SOURCE_EXPRESSION ); + execFactory.attach_dependency_to_expression( tagsETarsoot.coProdTotalTag, tagsE.yKinRhsTags[IdxCO], Expr::ADD_SOURCE_EXPRESSION ); + execFactory.attach_dependency_to_expression( tagsETarsoot.h2oProdTotalTag, tagsE.yKinRhsTags[IdxH2O], Expr::ADD_SOURCE_EXPRESSION ); + execFactory.attach_dependency_to_expression( tagsETarsoot.h2ProductionTarTag, tagsE.yKinRhsTags[IdxH2], Expr::ADD_SOURCE_EXPRESSION ); - execFactory.attach_dependency_to_expression( tagsETarsoot.tarSootHeatGasSourceTag, tagsE.enthKinRhsTag, Expr::ADD_SOURCE_EXPRESSION ); + execFactory.attach_dependency_to_expression( tagsETarsoot.tarSootHeatGasSourceTag, tagsE.enthKinRhsTag, Expr::ADD_SOURCE_EXPRESSION ); + } + else{ + execFactory.register_expression( new DivisionT( tagsETarsoot.tarGasFullRhsTag, tagsETarsoot.tarGasKinRhsTag, tagsEpfr.uTag )); + // modify gas equations + execFactory.register_expression( new DivisionT( tagsETarsoot.o2ConsumTotalPFRTag, tagsETarsoot.o2ConsumTotalTag, tagsEpfr.uTag )); + execFactory.register_expression( new DivisionT( tagsETarsoot.coProdTotalPFRTag, tagsETarsoot.coProdTotalTag, tagsEpfr.uTag )); + execFactory.register_expression( new DivisionT( tagsETarsoot.h2oProdTotalPFRTag, tagsETarsoot.h2oProdTotalTag, tagsEpfr.uTag )); + execFactory.register_expression( new DivisionT( tagsETarsoot.h2ProductionTarPFRTag, tagsETarsoot.h2ProductionTarTag, tagsEpfr.uTag )); + execFactory.attach_dependency_to_expression( tagsETarsoot.o2ConsumTotalPFRTag, tagsE.yFullRhsTags[IdxO2], Expr::ADD_SOURCE_EXPRESSION ); + execFactory.attach_dependency_to_expression( tagsETarsoot.coProdTotalPFRTag, tagsE.yFullRhsTags[IdxCO], Expr::ADD_SOURCE_EXPRESSION ); + execFactory.attach_dependency_to_expression( tagsETarsoot.h2oProdTotalPFRTag, tagsE.yFullRhsTags[IdxH2O], Expr::ADD_SOURCE_EXPRESSION ); + execFactory.attach_dependency_to_expression( tagsETarsoot.h2ProductionTarPFRTag, tagsE.yFullRhsTags[IdxH2], Expr::ADD_SOURCE_EXPRESSION ); + + execFactory.register_expression( new DivisionT( tagsETarsoot.tarSootHeatGasSourcePFRTag, tagsETarsoot.tarSootHeatGasSourceTag, tagsEpfr.uTag )); + execFactory.attach_dependency_to_expression( tagsETarsoot.tarSootHeatGasSourcePFRTag, tagsE.enthFullRhsTag, Expr::ADD_SOURCE_EXPRESSION ); + + execFactory.register_expression( new DpDxEnthalpyT( tagsETarsoot.tarSootHeatGasSourceDpDxTag, tagsETarsoot.tarSootHeatGasSourceTag, tagsE.rhoTag, tagsE.tempTag, + tagsE.enthTag, tagsE.mmwTag, tagsE.cpTag, tagsEpfr.uTag)); + execFactory.attach_dependency_to_expression( tagsETarsoot.tarSootHeatGasSourceDpDxTag, tagsEpfr.dpdxTag, Expr::ADD_SOURCE_EXPRESSION ); + } // add variables to the integrator equIndex_ = equIndex_ + 1; integrator_->add_variable( tagsETarsoot.tarGasMassTag.name(), tagsETarsoot.tarGasFullRhsTag, equIndex_, equIndex_ ); if(haveSoot_){ // soot mass fraction equation - execFactory.register_expression( new PlaceHolderT( tagsETarsoot.sootInflowTag ) ); + integrator_->register_root_expression( new PlaceHolderT( tagsETarsoot.sootInflowTag ) ); execFactory.register_expression( new SumOpT( tagsETarsoot.sootKinRhsTag, {tagsETarsoot.sootFormTag, tagsETarsoot.sootOxidTag}) ); - execFactory.register_expression(new ZeroDMixingCPT( tagsETarsoot.sootMixRhsTag, tagsETarsoot.sootInflowTag, tagsETarsoot.sootMassTag, - tagsE.tauMixTag, tagsE.rhoInflowTag, tagsE.rhoTag )); - execFactory.register_expression( new SumOpT( tagsETarsoot.sootFullRhsTag, {tagsETarsoot.sootMixRhsTag, tagsETarsoot.sootKinRhsTag} ) ); - execFactory.register_expression( new SourceFromGasMassT( tagsETarsoot.sootSrcFromGasSrcTag, tagsEPart.partToGasMassTag, tagsETarsoot.sootMassTag)); execFactory.attach_dependency_to_expression( tagsETarsoot.sootSrcFromGasSrcTag, tagsETarsoot.sootKinRhsTag, Expr::ADD_SOURCE_EXPRESSION); + if( reactorType_ == "PSRConstantPressure"){ + execFactory.register_expression(new ZeroDMixingCPT( tagsETarsoot.sootMixRhsTag, tagsETarsoot.sootInflowTag, tagsETarsoot.sootMassTag, + tagsE.tauMixTag, tagsE.rhoInflowTag, tagsE.rhoTag )); + execFactory.register_expression( new SumOpT( tagsETarsoot.sootFullRhsTag, {tagsETarsoot.sootMixRhsTag, tagsETarsoot.sootKinRhsTag} ) ); + } + else{ + execFactory.register_expression( new DivisionT( tagsETarsoot.sootFullRhsTag, tagsETarsoot.sootKinRhsTag, tagsEpfr.uTag )); + } equIndex_ = equIndex_ + 1; integrator_->add_variable( tagsETarsoot.sootMassTag.name(), tagsETarsoot.sootFullRhsTag, equIndex_, equIndex_ ); } @@ -378,7 +416,7 @@ namespace Tarsoot { //--------------------------------------------------------------------------- void TarSootInterface::initialize_coal_tarsoot(){ const Tarsoot::TarSootTags tagsETarsoot( Expr::STATE_NONE, particleNumArray_ ); - if( rootParser_["ReactorParameters"]["ReactorType"].as() == "ConstantVolume" ){ + if( reactorType_ == "PSRConstantVolume" ){ if(!isRestart_){ integrator_->copy_from_initial_condition_to_execution( tagsETarsoot.rhotarGasInflowTag.name()); if(haveSoot_){ @@ -390,7 +428,7 @@ namespace Tarsoot { integrator_->lock_field( tagsETarsoot.rhosootInflowTag ); } } - if( rootParser_["ReactorParameters"]["ReactorType"].as() == "ConstantPressure" ){ + if( reactorType_ == "PSRConstantPressure" ){ if(!isRestart_){ integrator_->copy_from_initial_condition_to_execution( tagsETarsoot.tarGasInflowTag.name()); if(haveSoot_){ @@ -407,22 +445,29 @@ namespace Tarsoot { //--------------------------------------------------------------------------- void TarSootInterface::modify_prim_kinrhs_tags_tarsoot(){ const Tarsoot::TarSootTags tagsETarsoot( Expr::STATE_NONE, particleNumArray_ ); + primitiveTags_.push_back( tagsETarsoot.tarGasMassTag ); if(haveSoot_){ primitiveTags_.push_back( tagsETarsoot.sootMassTag ); } - if( rootParser_["ReactorParameters"]["ReactorType"].as() == "ConstantVolume" ){ + if( reactorType_ == "PSRConstantVolume" ){ kinRhsTags_.push_back( tagsETarsoot.rhotarGasKinRhsTag ); if(haveSoot_){ kinRhsTags_.push_back( tagsETarsoot.rhosootKinRhsTag ); } } - if( rootParser_["ReactorParameters"]["ReactorType"].as() == "ConstantPressure" ){ + if( reactorType_ == "PSRConstantPressure" ){ kinRhsTags_.push_back( tagsETarsoot.tarGasKinRhsTag ); if(haveSoot_){ kinRhsTags_.push_back( tagsETarsoot.sootKinRhsTag ); } } + if( reactorType_ == "PFR" ){ + kinRhsTags_.push_back( tagsETarsoot.tarGasFullRhsTag ); + if(haveSoot_){ + kinRhsTags_.push_back( tagsETarsoot.sootFullRhsTag ); + } + } } //--------------------------------------------------------------------------- @@ -432,7 +477,7 @@ namespace Tarsoot { const std::map &rhsIdxMap){ const Tarsoot::TarSootTags tagsETarsoot( Expr::STATE_NONE, particleNumArray_ ); - if( rootParser_["ReactorParameters"]["ReactorType"].as() == "ConstantVolume" ){ + if( reactorType_ == "PSRConstantVolume" ){ primVarIdxMap[tagsETarsoot.tarGasMassTag] = consVarIdxMap.at( tagsETarsoot.rhotarGasMassTag ); kinRhsIdxMap[tagsETarsoot.rhotarGasKinRhsTag] = rhsIdxMap.at( tagsETarsoot.rhotarGasFullRhsTag ); if(haveSoot_){ @@ -441,7 +486,7 @@ namespace Tarsoot { } } - if( rootParser_["ReactorParameters"]["ReactorType"].as() == "ConstantPressure" ){ + if( reactorType_ == "PSRConstantPressure" ){ primVarIdxMap[tagsETarsoot.tarGasMassTag] = consVarIdxMap.at( tagsETarsoot.tarGasMassTag ); kinRhsIdxMap[tagsETarsoot.tarGasKinRhsTag] = rhsIdxMap.at( tagsETarsoot.tarGasFullRhsTag ); if(haveSoot_){ @@ -449,6 +494,14 @@ namespace Tarsoot { kinRhsIdxMap[tagsETarsoot.sootKinRhsTag] = rhsIdxMap.at( tagsETarsoot.sootFullRhsTag ); } } + if( reactorType_ == "PFR" ){ + primVarIdxMap[tagsETarsoot.tarGasMassTag] = consVarIdxMap.at( tagsETarsoot.tarGasMassTag ); + kinRhsIdxMap[tagsETarsoot.tarGasFullRhsTag] = rhsIdxMap.at( tagsETarsoot.tarGasFullRhsTag ); + if(haveSoot_){ + primVarIdxMap[tagsETarsoot.sootMassTag] = consVarIdxMap.at( tagsETarsoot.sootMassTag ); + kinRhsIdxMap[tagsETarsoot.sootFullRhsTag] = rhsIdxMap.at( tagsETarsoot.sootFullRhsTag ); + } + } } void TarSootInterface::dvdu_coal_tarsoot( boost::shared_ptr>& dVdUPart, @@ -458,7 +511,7 @@ namespace Tarsoot { const Tarsoot::TarSootTags tagsETarsoot( Expr::STATE_NONE, particleNumArray_ ); const ReactorEnsembleUtil::ReactorEnsembleTags tagsE( Expr::STATE_NONE ); - if( rootParser_["ReactorParameters"]["ReactorType"].as() == "ConstantVolume" ){ + if( reactorType_ == "PSRConstantVolume" ){ dVdUPart->element( primVarIdxMap.at( tagsETarsoot.tarGasMassTag ), consVarIdxMap.at( tagsE.rhoTag )) = tagsETarsoot.tarPartialRhoTag; dVdUPart->element( primVarIdxMap.at( tagsETarsoot.tarGasMassTag ), consVarIdxMap.at( tagsETarsoot.rhotarGasMassTag )) = tagsE.invrhoTag; if(haveSoot_){ @@ -467,7 +520,7 @@ namespace Tarsoot { } } - if( rootParser_["ReactorParameters"]["ReactorType"].as() == "ConstantPressure" ){ + else{ dVdUPart->element( primVarIdxMap.at( tagsETarsoot.tarGasMassTag ), consVarIdxMap.at( tagsETarsoot.tarGasMassTag )) = 1.0; if(haveSoot_){ dVdUPart->element( primVarIdxMap.at( tagsETarsoot.sootMassTag ), consVarIdxMap.at( tagsETarsoot.sootMassTag )) = 1.0; @@ -486,7 +539,7 @@ namespace Tarsoot { const Expr::Tag& tarGas = tagsETarsoot.tarGasMassTag; auto massTarIdx = primVarIdxMap.at( tagsETarsoot.tarGasMassTag ); - if( rootParser_["ReactorParameters"]["ReactorType"].as() == "ConstantVolume" ){ + if( reactorType_ == "PSRConstantVolume" ){ const Expr::Tag& tarGasRhs = tagsETarsoot.rhotarGasMixRhsTag; const auto& massTarRhsIdx = rhsIdxMap.at( consVarRhsMap.at( tagsETarsoot.rhotarGasMassTag )); @@ -503,7 +556,7 @@ namespace Tarsoot { } } - if( rootParser_["ReactorParameters"]["ReactorType"].as() == "ConstantPressure" ){ + if( reactorType_ == "PSRConstantPressure" ){ const Expr::Tag& tarGasRhs = tagsETarsoot.tarGasMixRhsTag; const auto& massTarRhsIdx = rhsIdxMap.at( consVarRhsMap.at( tagsETarsoot.tarGasMassTag )); diff --git a/src/particles/coal/TarSootReaction/TarSootReactionInterface.h b/src/particles/coal/TarSootReaction/TarSootReactionInterface.h index 2c05c82..03566dc 100755 --- a/src/particles/coal/TarSootReaction/TarSootReactionInterface.h +++ b/src/particles/coal/TarSootReaction/TarSootReactionInterface.h @@ -79,8 +79,13 @@ namespace Tarsoot { o2ConsumTotalTag, ///< o2 consumption by tar and soot oxidation by all particles coProdTotalTag, ///< co production by tar and soot oxidation by all particles h2oProdTotalTag, ///< h2o production by tar and soot oxidation by all particles + o2ConsumTotalPFRTag, ///< o2 consumption by tar and soot oxidation by all particles for plug flow reactor + coProdTotalPFRTag, ///< co production by tar and soot oxidation by all particles for plug flow reactor + h2oProdTotalPFRTag, ///< h2o production by tar and soot oxidation by all particles for plug flow reactor tarSootMassGasSourceTag, ///< gas phase mass source term from tar and soot reaction tarSootHeatGasSourceTag, ///< gas phase energy source term from tar and soot reaction + tarSootHeatGasSourcePFRTag, ///< gas phase energy source term from tar and soot reaction for plug flow reactor + tarSootHeatGasSourceDpDxTag, ///< gas phase energy source term in `Dp/Dx` from tar and soot reaction for plug flow reactor sootFormTag, ///< soot formation from tar sootAggTag, ///< soot agglomeration term sootOxidTag, ///< soot oxidization term in soot equation @@ -88,6 +93,7 @@ namespace Tarsoot { coProductionTarTag, ///< production of CO by tar oxidation h2oProductionTarTag, ///< production of H2O by tar oxidation h2ProductionTarTag, ///< production of h2 during soot formation + h2ProductionTarPFRTag, ///< production of h2 during soot formation for plug flow reactor o2ConsumptionSootTag, ///< consumption of O2 by soot oxidation coProductionSootTag, ///< production of CO by soot oxidation h2oProductionSootTag, ///< production of H2O by soot oxidation @@ -122,6 +128,7 @@ namespace Tarsoot { int& equIndex_; const bool isRestart_; const bool haveSoot_; + std::string reactorType_; public: /** -- GitLab From ffb57a7c66a72aea7afd672b748a3cba842177a1 Mon Sep 17 00:00:00 2001 From: Hang Zhou Date: Thu, 23 Jul 2020 00:40:31 -0600 Subject: [PATCH 06/10] Calculating number of particles per volume, instead of total number of particles in the reactor. The latter depends on the reactor volume. What we care about is the particle loading (number of particles per volume). --- src/ReactorEnsembleUtil.cpp | 3 +- src/ReactorEnsembleUtil.h | 3 +- src/ReactorVolume.h | 93 ------------------------- src/parser/ParseInputFile.cpp | 2 +- src/particles/ParticleInterface.cpp | 19 ++--- src/particles/ParticleInterface.h | 2 +- src/particles/ParticleNumber.h | 103 ---------------------------- 7 files changed, 8 insertions(+), 217 deletions(-) delete mode 100755 src/ReactorVolume.h delete mode 100644 src/particles/ParticleNumber.h diff --git a/src/ReactorEnsembleUtil.cpp b/src/ReactorEnsembleUtil.cpp index e6a5361..89c7adb 100644 --- a/src/ReactorEnsembleUtil.cpp +++ b/src/ReactorEnsembleUtil.cpp @@ -144,8 +144,7 @@ namespace ReactorEnsembleUtil{ dsTag ( Expr::Tag( "ds" , state ) ), dtTag ( Expr::Tag( "dt" , state ) ), mixtureFractionTag( Expr::Tag( "mixture_fraction" , state ) ), - timeTag ( Expr::Tag( "simulation_time" , state ) ), - reactorVolumeTag ( Expr::Tag( "reactor_volume" , state ) ) + timeTag ( Expr::Tag( "simulation_time" , state ) ) { const std::vector& spNames = CanteraObjects::species_names(); moleTags = Expr::tag_list( spNames, state, "X_" ); diff --git a/src/ReactorEnsembleUtil.h b/src/ReactorEnsembleUtil.h index 36eddaf..4c757a3 100644 --- a/src/ReactorEnsembleUtil.h +++ b/src/ReactorEnsembleUtil.h @@ -103,8 +103,7 @@ namespace ReactorEnsembleUtil{ dsTag, ///< dualtime dtTag, ///< timestep mixtureFractionTag,///< mixture fraction (used for initialization) - timeTag, ///< simulation time - reactorVolumeTag; ///< reactor volume + timeTag; ///< simulation time Expr::TagList moleTags, ///< mole fractions massTags, ///< mass fractions diff --git a/src/ReactorVolume.h b/src/ReactorVolume.h deleted file mode 100755 index 603ff69..0000000 --- a/src/ReactorVolume.h +++ /dev/null @@ -1,93 +0,0 @@ - -/** - * @file ReactorVolume.h - * @par Getting the reactor volume - * @author Hang Zhou - * - */ - -#ifndef REACTORVOLUME_H_ -#define REACTORVOLUME_H_ - -#include - -namespace ReactorEnsembleUtil { - - /** - * @class ReactorVolume - * @ingroup ReactorEnsembleUtil - * @brief Getting the reactor volume based on volume shape, radius and height - * - * The expression is given as - * For spherical reactor: - * \f[ - * V = \frac{4}{3}\pi r^3 - * \f] - * Here, \f$r\f$ is the radius of spherical of the reactor. - * For cylinder reactor: - * \f[ - * V = \pi r^2 h - * \f] - * Here, \f$r\f$ is the radius of the circular end of the cylinder. - * \f$h\f$ is the height of the cylinder. - */ - - template - class ReactorVolume : public Expr::Expression { - const double radius_, height_; - const std::string reactorShape_; - - ReactorVolume( const std::string reactorShape, - const double radius, - const double height) - : Expr::Expression(), - reactorShape_(reactorShape), - radius_(radius), - height_(height){ this->set_gpu_runnable( true );} - - public: - class Builder : public Expr::ExpressionBuilder { - const double radius_, height_; - const std::string reactorShape_; - public: - /** - * @brief The mechanism for building a SherwoodNumber object - * @tparam FieldT - * @param reactorVolumeTag reactor volume - * @param reactorShape reactor shape (spherical or cylinder) - * @param radius radius for spherical reactor or radius of the circular end of the cylinder reactor - * @param height height of the cylinder - */ - Builder( const Expr::Tag reactorVolumeTag, - const std::string reactorShape, - const double radius, - const double height) - : Expr::ExpressionBuilder( reactorVolumeTag ), - reactorShape_ ( reactorShape ), - radius_ ( radius ), - height_ ( height ) - {} - - ~Builder(){} - - Expr::ExpressionBase* build() const{ - return new ReactorVolume( reactorShape_, radius_, height_ ); - } - }; - - - void evaluate(){ - using namespace SpatialOps; - - if(reactorShape_ == "Spherical"){ - this->value() <<= 4.0/3.0 * M_PI * radius_ * radius_ * radius_; - } - if(reactorShape_ == "Cylinder"){ - this->value() <<= M_PI * radius_ * radius_ * height_; - } - } - }; - -} // namespace ReactorEnsembleUtil - -#endif /* REACTORVOLUME_H_ */ diff --git a/src/parser/ParseInputFile.cpp b/src/parser/ParseInputFile.cpp index b93400b..9c69391 100644 --- a/src/parser/ParseInputFile.cpp +++ b/src/parser/ParseInputFile.cpp @@ -563,7 +563,7 @@ parse_field_output( const YAML::Node& parser, const int npartsize = particleNumArray.size(); for( size_t i=0; i::Builder ZeroDMixingCPT; typedef ReactorEnsembleUtil::NusseltNumber::Builder NuNumberT; typedef ReactorEnsembleUtil::DivisionExpression::Builder DivideT; + typedef ReactorEnsembleUtil::ProductExpression::Builder ProductT; typedef ReactorEnsembleUtil::SherwoodNumber::Builder ShNumberT; - typedef ReactorEnsembleUtil::ReactorVolume::Builder ReactorVolumeT; typedef Particles::PartMassFraction::Builder MassFracPartT; typedef Particles::PartSize::Builder SizePartT; @@ -91,7 +89,6 @@ namespace Particles { typedef Particles::PartToGasHeatCP::Builder PartToGasHeatCPT; typedef Particles::PartToGasHeatCV::Builder PartToGasHeatCVT; typedef Particles::SourceFromGasMassChange::Builder SourceFromGasMassT; - typedef Particles::ParticleNumber::Builder PartNumT; typedef Particles::ParticleTempMixing::Builder PartTempMixT; typedef Particles::DensitySourceFromGasMassChange::Builder DensitySourceFromGasMassT; typedef Particles::DpDxSourceFromGasMassChange::Builder DpDxSourceFromGasMassT; @@ -119,7 +116,7 @@ namespace Particles { gasDpDxSrcPFRTag ( Expr::Tag( "gas_dpdx_src_pfr" , state )) { massEachPartTags = Expr::tag_list( particleNumArray, state, "mass_each_part_" ); - partNumTags = Expr::tag_list( particleNumArray, state, "num_part_" ); + partNumPerVolumeTags = Expr::tag_list( particleNumArray, state, "num_part_per_volume_" ); partNumFracTags = Expr::tag_list( particleNumArray, state, "num_frac_part_" ); partTempTags = Expr::tag_list( particleNumArray, state, "temp_part_" ); partCpTags = Expr::tag_list( particleNumArray, state, "cp_part_" ); @@ -309,14 +306,9 @@ namespace Particles { } } initRoots_.insert( initFactory_.register_expression( new DivideT( tagsPart.massEachPartTags[i], tagsPart.partMassFracTags[i], tagsPart.partNumFracTags[i]))); - initRoots_.insert( initFactory_.register_expression( new PartNumT( tagsPart.partNumTags[i], tagsPart.partNumFracTags[i], tags.rhoTag, tags.reactorVolumeTag))); + initRoots_.insert( initFactory_.register_expression( new ProductT( tagsPart.partNumPerVolumeTags[i], tagsPart.partNumFracTags[i], tags.rhoTag))); initRoots_.insert( initFactory_.register_expression( new LinearT( tagsPart.partMassFracInitialTags[i], tagsPart.partMassFracTags[i], 1.0, 0.0))); } - - const std::string reactorShape = rootParser_["ReactorParameters"]["ReactorShape"].as("Spherical"); - const double radius = rootParser_["ReactorParameters"]["Radius"].as( 0.001 ); - const double height = rootParser_["ReactorParameters"]["Height"].as( 0.0 ); - initFactory_.register_expression( new ReactorVolumeT( tags.reactorVolumeTag, reactorShape, radius, height)); initRoots_.insert( initFactory_.register_expression( new ViscosityT( tags.dynviscosityTag, tags. tempTag, tags.massTags ) ) ); } @@ -332,7 +324,6 @@ namespace Particles { parse_particle_parameters(); - execFactory.register_expression( new PlaceHolderT( tagsE.reactorVolumeTag )); execFactory.register_expression( new ThermalConducT( tagsE.thermalConducTag, tagsE.tempTag, tagsE.massTags, tagsE.mmwTag ) ); // To simplify the jacobian matrix and because there is no sensitivity in viscosity function in PoKiTT now, // viscosity is set to be constant in present code. @@ -409,7 +400,7 @@ namespace Particles { integrator_->add_variable( tagsEPart.partTempTags[i].name(), tagsEPart.partTempFullRhsTags[i], equIndex_, equIndex_); integrator_->register_root_expression( new DivideT( tagsEPart.massEachPartTags[i], tagsEPart.partMassFracTags[i], tagsEPart.partNumFracTags[i])); - integrator_->register_root_expression( new PartNumT( tagsEPart.partNumTags[i], tagsEPart.partNumFracTags[i], tagsE.rhoTag, tagsE.reactorVolumeTag)); + integrator_->register_root_expression( new ProductT( tagsEPart.partNumPerVolumeTags[i], tagsEPart.partNumFracTags[i], tagsE.rhoTag)); } // modify gas phase equations if(reactorType_ == "PSRConstantPressure" or reactorType_ == "PFR"){ @@ -488,7 +479,6 @@ namespace Particles { } integrator_->copy_from_initial_condition_to_execution( tagsE.dynviscosityTag.name()); } - integrator_->copy_from_initial_condition_to_execution( tagsE.reactorVolumeTag.name()); } for( size_t i = 0;i < nparsize_;i++ ){ if(reactorType_!="PFR"){ @@ -508,7 +498,6 @@ namespace Particles { } } integrator_->lock_field( tagsE.dynviscosityTag ); - integrator_->lock_field( tagsE.reactorVolumeTag ); if(coalimplement_){ CoalInterface_->initialize_coal(); diff --git a/src/particles/ParticleInterface.h b/src/particles/ParticleInterface.h index 7b5036f..7e07244 100755 --- a/src/particles/ParticleInterface.h +++ b/src/particles/ParticleInterface.h @@ -66,7 +66,7 @@ namespace Particles { gasDensitySrcPFRTag, ///< gas density source term because of the change of gas mass for plug flow reactor gasDpDxSrcPFRTag; /// change of `Dp/Dx` term because of the change of gas mass for plug flow reactor Expr::TagList massEachPartTags, ///< mass of each particle - partNumTags, ///< number of particles + partNumPerVolumeTags, ///< number of particles per volume partNumFracTags, ///< number of particles per mass of gas in the reactor partTempTags, ///< particle temperature partCpTags, ///< particle heat capacity diff --git a/src/particles/ParticleNumber.h b/src/particles/ParticleNumber.h deleted file mode 100644 index 64c5ffa..0000000 --- a/src/particles/ParticleNumber.h +++ /dev/null @@ -1,103 +0,0 @@ - -/** - * @file ParticleNumber.h - * @par Calculating number of particles - * @author Hang - */ -#ifndef ParticleNumber_Expr_h -#define ParticleNumber_Expr_h - -#include -#include - -namespace Particles{ - - /** - * @class ParticleNumber - * @ingroup Particles - * @brief Calculating number of particles using number of particles per gas mass and gas mass - * - * The expression is given as - * \f[ - * N_p = n_p \rho V - * \f] - * Here, \f$ n_p\f$ is the number of particles per gas mass. - * \f$ \rho\f$ is the density of gas phase - * \f$ V\f$ is the reactor volume. - * - * The sensitivity of the result is given as - * \f[ - * \frac{\partial N_p}{\partial \phi} = V (\rho \frac{\partial n_p}{\partial \phi} - * + n_p \frac{\partial \rho}{\partial \phi}) - * \f] - */ - - template< typename FieldT > - class ParticleNumber : public Expr::Expression - { - DECLARE_FIELDS( FieldT, pNumFrac_, rho_, reactorVolume_ ) - - ParticleNumber( const Expr::Tag& pNumFracTag, - const Expr::Tag& rhoTag, - const Expr::Tag& reactorVolumeTag) - : Expr::Expression() - { - this->set_gpu_runnable(true); - pNumFrac_ = this->template create_field_request( pNumFracTag ); - rho_ = this->template create_field_request( rhoTag ); - reactorVolume_ = this->template create_field_request( reactorVolumeTag ); - } - - public: - class Builder : public Expr::ExpressionBuilder - { - const Expr::Tag pNumFracTag_, rhoTag_, reactorVolumeTag_; - public: - /** - * @brief The mechanism for building a ParticleNumber object - * @tparam FieldT - * @param pNumTag Number of particle - * @param pNumFracTag Number of particle per gas mass - * @param rhoTag Density of gas - * @param reactorVolumeTag volume of the reactor - */ - Builder( const Expr::Tag& pNumTag, - const Expr::Tag& pNumFracTag, - const Expr::Tag& rhoTag, - const Expr::Tag& reactorVolumeTag) - : ExpressionBuilder(pNumTag), - pNumFracTag_( pNumFracTag), - rhoTag_(rhoTag), - reactorVolumeTag_(reactorVolumeTag) - {} - ~Builder(){} - Expr::ExpressionBase* build() const{ - return new ParticleNumber(pNumFracTag_, rhoTag_, reactorVolumeTag_); - } - }; - - ~ParticleNumber(){} - - void evaluate(){ - using namespace SpatialOps; - FieldT& result = this->value(); - const FieldT& rho = rho_->field_ref(); - const FieldT& pNumFrac = pNumFrac_->field_ref(); - const FieldT& reactorVolume = reactorVolume_->field_ref(); - result <<= pNumFrac * rho * reactorVolume; - } - - void sensitivity( const Expr::Tag& sensVarTag ){ - FieldT & dfdv = this->sensitivity_result( sensVarTag ); - const FieldT& rho = rho_->field_ref(); - const FieldT& pNumFrac = pNumFrac_->field_ref(); - const FieldT& reactorVolume = reactorVolume_->field_ref(); - const FieldT& drhodv = rho_->sens_field_ref(sensVarTag); - const FieldT& dpNumFracdv = pNumFrac_->sens_field_ref(sensVarTag); - dfdv <<= (dpNumFracdv*rho + pNumFrac*drhodv)* reactorVolume; - } - }; - -} // Particles - -#endif // ParticleNumber_Expr_h -- GitLab From 10acb120c6b08774de0983bedc313b5096c61443 Mon Sep 17 00:00:00 2001 From: Hang Zhou <> Date: Thu, 30 Jul 2020 16:02:35 -0600 Subject: [PATCH 07/10] When checking if a speices name read from input file (for example, 'X_O2' and 'Y_O2', or 'X_O2_inflow' and 'Y_O2_inflow') is inflow condition, we need to check if the last seven terms of the name are `_inflow`. (if name.substr(name.size()-7)=="_inflow"). However, the mininum size of name is three, liek `X_H`. Checking the last seven terms will give error when the size of name is less than seven. So, I just check if the last three terms are 'low'. --- src/parser/ParseInputFile.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/parser/ParseInputFile.cpp b/src/parser/ParseInputFile.cpp index 9c69391..d4384b3 100644 --- a/src/parser/ParseInputFile.cpp +++ b/src/parser/ParseInputFile.cpp @@ -362,7 +362,8 @@ parse_initial_inflow_conditions( const YAML::Node& parser, if( name.substr( 0, 2 ) == "X_" || name.substr( 0, 2 ) == "Y_" ){ if(reactorType!="PFR"){ if(parser["InitialConditions"]){ - if( name.substr( name.size() - 4 ) == "flow" ){ // decide if it is inflow parameters + // check if it is inflow parameters ( The minimum size of name is 3. So, just check the last three letters.) + if( name.substr( name.size() - 3 ) == "low" ){ const std::string spnam = name.substr( 2, name.size() - 9 ); uninflowSpecies.erase( spnam ); } -- GitLab From 80acac46acfd908f0445ba4ae7c49539a1233057 Mon Sep 17 00:00:00 2001 From: Hang Zhou <> Date: Tue, 4 Aug 2020 10:30:25 -0600 Subject: [PATCH 08/10] Adding the function which allows setting initial or inflow conditions based on database coresponding to the grid value. For example, when we have various surrounding temperatures for heat transfer, and want to have various inflow temperatures for each surrouding temperature, we can read the values for temperature from the database, like 'Data.txt'. We can give it by `InitialConditions: {-value: FromDatabase -variable:T}'and 'InitialInflowData: {FileName:Data.txt}' in the input file. Also, if we want to set species mole fractions based on database as well, we can give it by `InitialInflowData: {InitialSpeciesSetting: FromDataBase}' or 'InitialInflowData: {InflowSpeciesSetting: FromDataBase}', instead of specifying species in `InitialConditions` or 'InflowConditions'. (The default for `InitialSpeciesSetting` and `InflowSpeciesSetting` is `FromInputFile`. For this, species fractions need to be given in `InitialConditiobs' or 'InflowConditions' in the input file. Fractions of species not specified in the input file or the database are set to be zero.) --- demos/1D_transient/1Dtrans_input.yaml | 1 - demos/2D_steady_state/2Dss_input.yaml | 1 - demos/diff_mechanisms/methane.yaml | 1 - demos/diff_mechanisms/syngas.yaml | 1 - src/CMakeLists.txt | 1 + src/InitialInflowConditionsWriter.cpp | 123 +++++++++++++++++++++++++ src/InitialInflowConditionsWriter.h | 124 ++++++++++++++++++++++++++ src/Main.cpp | 6 ++ src/parser/ParseInputFile.cpp | 65 ++++++++------ 9 files changed, 292 insertions(+), 31 deletions(-) create mode 100644 src/InitialInflowConditionsWriter.cpp create mode 100644 src/InitialInflowConditionsWriter.h diff --git a/demos/1D_transient/1Dtrans_input.yaml b/demos/1D_transient/1Dtrans_input.yaml index 40a0dc1..5596757 100644 --- a/demos/1D_transient/1Dtrans_input.yaml +++ b/demos/1D_transient/1Dtrans_input.yaml @@ -37,6 +37,5 @@ TimeIntegrator: end_time: 2.5e-4 timestep: 1e-6 tolerance: 1e-8 -Restart: True ReactorParameters: ReactorType: PSRConstantVolume diff --git a/demos/2D_steady_state/2Dss_input.yaml b/demos/2D_steady_state/2Dss_input.yaml index 99484ce..8474306 100644 --- a/demos/2D_steady_state/2Dss_input.yaml +++ b/demos/2D_steady_state/2Dss_input.yaml @@ -34,6 +34,5 @@ Output: Fields: - name: T_inflow - name: tau_mix -Restart: False ReactorParameters: ReactorType: PSRConstantVolume diff --git a/demos/diff_mechanisms/methane.yaml b/demos/diff_mechanisms/methane.yaml index ab8672b..b023abb 100644 --- a/demos/diff_mechanisms/methane.yaml +++ b/demos/diff_mechanisms/methane.yaml @@ -34,6 +34,5 @@ Output: Fields: - name: T_inflow - name: p_inflow -Restart: False ReactorParameters: ReactorType: PSRConstantVolume diff --git a/demos/diff_mechanisms/syngas.yaml b/demos/diff_mechanisms/syngas.yaml index 4ebd2c9..12aed2d 100644 --- a/demos/diff_mechanisms/syngas.yaml +++ b/demos/diff_mechanisms/syngas.yaml @@ -38,6 +38,5 @@ Output: Fields: - name: T_inflow - name: p_inflow -Restart: False ReactorParameters: ReactorType: PSRConstantVolume diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 108c49e..2caa6c9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,6 +16,7 @@ add_executable( zodiac Main.cpp ReactorEnsembleUtil.cpp RestartFieldWriter.cpp + InitialInflowConditionsWriter.cpp ${PARSER_SRC} ) target_link_libraries( zodiac ${TPL_LIBRARIES} ) diff --git a/src/InitialInflowConditionsWriter.cpp b/src/InitialInflowConditionsWriter.cpp new file mode 100644 index 0000000..d6f5aa2 --- /dev/null +++ b/src/InitialInflowConditionsWriter.cpp @@ -0,0 +1,123 @@ +#include "InitialInflowConditionsWriter.h" +#include "FieldTypes.h" +#include "ReactorEnsembleUtil.h" + +#include +#include + + +typedef read_from_file ::Builder readT; + +//------------------------------------------------------------------- + +InitialInflowConditionsWriter::InitialInflowConditionsWriter( const YAML::Node parser, + Expr::FieldManagerList& fml, + std::set& initRoots, + Expr::ExpressionFactory& initFactory) + : parser_(parser), + fml_(fml), + initRoots_(initRoots), + initFactory_(initFactory) +{} + +//------------------------------------------------------------------- + +InitialInflowConditionsWriter::~InitialInflowConditionsWriter() +{} + +//------------------------------------------------------------------- +void +InitialInflowConditionsWriter::set_init_inflow_fields_from_file() +{ + const std::string reactorType = parser_["ReactorParameters"]["ReactorType"].as(); + const YAML::Node& fieldsOutput = parser_["Output"]["Fields"]; + const std::string dataFile = parser_["InitialInflowData"]["FileName"].as(); + const int nspec = CanteraObjects::number_species(); + + boost::filesystem::ifstream dataStream( dataFile ); + if( !dataStream.good() ){ + std::ostringstream msg; + msg << "Could not open file " << dataFile << " for reading" << std::endl; + throw std::runtime_error( msg.str() ); + } + std::vector DataVector; + std::string line; + while(std::getline(dataStream, line)){ + DataVector.push_back(line); + } + + if(reactorType!="PFR"){ + const YAML::Node inflow = parser_["InflowConditions"]; + BOOST_FOREACH( const YAML::Node& inflow_Spec, inflow ){ + const std::string variable = inflow_Spec["variable"].as(); + const Expr::Tag tag( variable, Expr::STATE_N ); + const YAML::Node& val = inflow_Spec["value"]; + + if( val.size() <= 1 ){ + long double ld; + if (val.as()=="FromDataBase"){ + std::string alias = variable; + BOOST_FOREACH( const YAML::Node& f, fieldsOutput ){ + const std::string name = f["name"].as(); + if(name == variable){ + alias = f["alias"].as(name); + } + } + initRoots_.insert(initFactory_.register_expression( new readT(tag, alias, DataVector))); + } + } + } + const std::string InflowSpecies = parser_["InitialInflowData"]["InflowSpeciesSetting"].as("FromInputFile"); + if(InflowSpecies == "FromDataBase"){ + BOOST_FOREACH( const std::string& sp_inflow, CanteraObjects::species_names() ){ + if( sp_inflow == CanteraObjects::species_name( nspec - 1 )) continue; + const Expr::Tag tag( "X_"+sp_inflow+"_inflow", Expr::STATE_N ); + std::string alias = "X_"+sp_inflow+"_inflow"; + BOOST_FOREACH( const YAML::Node& f, fieldsOutput ){ + const std::string name = f["name"].as(); + if(name == "X_"+sp_inflow){ + alias = f["alias"].as(name); + } + } + initRoots_.insert(initFactory_.register_expression( new readT(tag, alias, DataVector))); + } + } + } + if(parser_["InitialConditions"]){ + const YAML::Node initial = parser_["InitialConditions"]; + BOOST_FOREACH( const YAML::Node& ic_Spec, initial ){ + const std::string variable = ic_Spec["variable"].as(); + const Expr::Tag tag( variable, Expr::STATE_N ); + const YAML::Node& val = ic_Spec["value"]; + + if( val.size() <= 1 ){ + long double ld; + if (val.as()=="FromDataBase"){ + std::string alias = variable; + BOOST_FOREACH( const YAML::Node& f, fieldsOutput ){ + const std::string name = f["name"].as(); + if(name == variable){ + alias = f["alias"].as(name); + } + } + initRoots_.insert(initFactory_.register_expression( new readT(tag, alias, DataVector))); + } + } + } + const std::string InitialSpecies = parser_["InitialInflowData"]["InitialSpeciesSetting"].as("FromInputFile"); + if(InitialSpecies == "FromDataBase"){ + BOOST_FOREACH( const std::string& sp_ic, CanteraObjects::species_names() ){ + if( sp_ic == CanteraObjects::species_name( nspec - 1 )) continue; + const Expr::Tag tag( "X_"+sp_ic, Expr::STATE_N ); + std::string alias = "X_"+sp_ic; + BOOST_FOREACH( const YAML::Node& f, fieldsOutput ){ + const std::string name = f["name"].as(); + if(name == "X_"+sp_ic){ + alias = f["alias"].as(name); + } + } + initRoots_.insert(initFactory_.register_expression( new readT(tag, alias, DataVector))); + } + } + } +} \ No newline at end of file diff --git a/src/InitialInflowConditionsWriter.h b/src/InitialInflowConditionsWriter.h new file mode 100644 index 0000000..73c8f12 --- /dev/null +++ b/src/InitialInflowConditionsWriter.h @@ -0,0 +1,124 @@ +#ifndef INITIAL_INFLOW_CONDITIONS_WRITER_H +#define INITIAL_INFLOW_CONDITIONS_WRITER_H + +#include +#include +#include "parser/ParseInputFile.h" + +/** + * @class InitialInflowConditionsWriter + * @author Hang Zhou + * + * @brief Setting initial and inflow conditions based on database. + * When having grid variable, like surrounding temperature for heat transfer, + * we can use this class to set responding initial or inflow conditions from the database, + * instead of setting them as constant for all grids from input file. + */ + +class InitialInflowConditionsWriter +{ + const YAML::Node parser_; + Expr::FieldManagerList& fml_; + std::set& initRoots_; + Expr::ExpressionFactory& initFactory_; + +public: + /** + * @param parser yaml node read from input file + * @param fml the FieldManagerList that holds all of the fields that will be considered for output. + * @param initRoots initial root + * @param initFactory initial factory + */ + explicit InitialInflowConditionsWriter( const YAML::Node parser, + Expr::FieldManagerList& fml, + std::set& initRoots, + Expr::ExpressionFactory& initFactory); + + ~InitialInflowConditionsWriter(); + + + /** + * @brief register inflow and initial fields based on database. + */ + void + set_init_inflow_fields_from_file(); +}; + +template< typename FieldT > +class read_from_file : public Expr::Expression +{ + const std::string alias_; + std::vector dataVector_; + + read_from_file( const std::string alias, + const std::vector DataVector) + : Expr::Expression(), + alias_( alias), + dataVector_(DataVector) + { + this->set_gpu_runnable(true); + } + +public: + class Builder : public Expr::ExpressionBuilder + { + const std::string alias_; + std::vector dataVector_; + public: + /** + * @brief The mechanism for building a read_from_file object + * @tparam FieldT + * @param fieldTag field that needs to be registered + * @param alias alias of the field + * @param DataVector vector including all data + */ + Builder( const Expr::Tag fieldTag, + const std::string alias, + const std::vector DataVector) + : Expr::ExpressionBuilder( fieldTag ), + alias_( alias ), + dataVector_( DataVector ) + {} + ~Builder(){} + Expr::ExpressionBase* build() const{ + return new read_from_file( alias_, dataVector_ ); + } + }; + + + void evaluate() + { + using namespace SpatialOps; + FieldT& field = this->value(); + for (const auto& line : dataVector_) { + std::istringstream iss(line); + std::vector result{ std::istream_iterator(iss), {} }; //split line by space + + if(result[0] == alias_){ + typename FieldT::iterator ifld = field.begin(); + int i =1; + for( ;ifld != field.end();++ifld, ++i ){ + *ifld = std::stof(result[i]); + } + break; + } + else{ + if(&line == &dataVector_.back()){ + if(alias_.substr( 0, 2 ) == "X_" || alias_.substr( 0, 2 ) == "Y_"){ + std::cout << "Could not find data for " << alias_ << " in the database file. It is set to be zero." << std::endl; + field <<= 0.0; + } + else{ + std::ostringstream msg; + msg << "Must give data for " << alias_ << " in the database file." << std::endl; + throw std::runtime_error( msg.str()); + } + } + } + + } + } + +}; + +#endif //INITIAL_INFLOW_CONDITIONS_WRITER_H diff --git a/src/Main.cpp b/src/Main.cpp index b3be40d..1c9b59c 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -53,6 +53,7 @@ namespace po = boost::program_options; #include "TransformationMatrixExpressions.h" #include "RestartFieldWriter.h" +#include "InitialInflowConditionsWriter.h" #include #define ASSEMBLER(MatrixT, FieldT, name) \ @@ -195,6 +196,11 @@ int main( int iarg, char* carg[] ) parse_reactor_parameters( parser, integrator->factory() ); + if(parser["InitialInflowData"]){ + InitialInflowConditionsWriter* InitialInflowDatabase = new InitialInflowConditionsWriter( parser, fml, initRoots, initFactory); + InitialInflowDatabase->set_init_inflow_fields_from_file(); + } + if( reactorType == "PSRConstantVolume" ){ kinRhsTags.push_back( tagsE.rhoKinRhsTag ); kinRhsTags.push_back( tagsE.rhoEgyKinRhsTag ); diff --git a/src/parser/ParseInputFile.cpp b/src/parser/ParseInputFile.cpp index d4384b3..fc4a19f 100644 --- a/src/parser/ParseInputFile.cpp +++ b/src/parser/ParseInputFile.cpp @@ -156,9 +156,12 @@ create_ic_inflow_expression( Expr::ExpressionFactory& factory, const YAML::Node& val = parser["value"]; if( val.size() <= 1 ){ + long double ld; typedef Expr::ConstantExpr::Builder ConstExpr; - initRoots.insert( factory.register_expression( new ConstExpr( tag, val.as()))); - // we need to insert it as a root because things like the mixing time will NOT be depended upon in the initial condition tree + if ((std::istringstream(val.as()) >> ld >> std::ws).eof()){ + // we need to insert it as a root because things like the mixing time will NOT be depended upon in the initial condition tree + initRoots.insert( factory.register_expression( new ConstExpr( tag, val.as()))); + } } else{ if( tag.name() == gridSpec.name[0] ){ @@ -407,20 +410,22 @@ parse_initial_inflow_conditions( const YAML::Node& parser, typedef pokitt::MoleToMassFracs::Builder MoleToMassT; typedef pokitt::MassToMoleFracs::Builder MassToMoleT; if(parser["InitialConditions"]){ - if( uninitializedSpecies.size() == CanteraObjects::number_species()){ - std::ostringstream msg; - msg << "\nERROR from " << __FILE__ << " : " << __LINE__ - << "No species composition has been specified in the initial conditions.\n\n"; - throw std::runtime_error( msg.str()); - } + if(parser["InitialInflowData"]["InitialSpeciesSetting"].as("FromInputFile") == "FromInputFile"){ + if( uninitializedSpecies.size() == CanteraObjects::number_species()){ + std::ostringstream msg; + msg << "\nERROR from " << __FILE__ << " : " << __LINE__ + << "No species composition has been specified in the initial conditions.\n\n"; + throw std::runtime_error( msg.str()); + } - // set uninitialized species mole fractions to zero - BOOST_FOREACH( const std::string& sp_ic, uninitializedSpecies ){ - typedef Expr::ConstantExpr::Builder ConstExpr; - if( sp_ic == CanteraObjects::species_name( nspec - 1 )) continue; - const auto ix = CanteraObjects::species_index( sp_ic ); - factory.register_expression( new ConstExpr( tags.moleTags[ix], 0 )); - } + // set uninitialized species mole fractions to zero + BOOST_FOREACH( const std::string& sp_ic, uninitializedSpecies ){ + typedef Expr::ConstantExpr::Builder ConstExpr; + if( sp_ic == CanteraObjects::species_name( nspec - 1 )) continue; + const auto ix = CanteraObjects::species_index( sp_ic ); + factory.register_expression( new ConstExpr( tags.moleTags[ix], 0 )); + } + } // Species N factory.register_expression( new SpeciesN( tags.moleTags[nspec - 1], Expr::tag_list( CanteraObjects::species_names(), Expr::STATE_N, "X_" ), @@ -434,20 +439,23 @@ parse_initial_inflow_conditions( const YAML::Node& parser, if(reactorType!="PFR"){ if( !hasMixtureFraction ){ - if(( uninflowSpecies.size() == CanteraObjects::number_species())){ - std::ostringstream msg; - msg << "\nERROR from " << __FILE__ << " : " << __LINE__ - << "No species composition has been specified in the inflow conditions.\n\n"; - throw std::runtime_error( msg.str()); + if(parser["InitialInflowData"]["InflowSpeciesSetting"].as("FromInputFile") == "FromInputFile"){ + if(( uninflowSpecies.size() == CanteraObjects::number_species())){ + std::ostringstream msg; + msg << "\nERROR from " << __FILE__ << " : " << __LINE__ + << "No species composition has been specified in the inflow conditions.\n\n"; + throw std::runtime_error( msg.str()); + } + + // set unspecified inflow species mole fractions to zero + BOOST_FOREACH( const std::string& sp_inflow, uninflowSpecies ){ + typedef Expr::ConstantExpr::Builder ConstExpr; + if( sp_inflow == CanteraObjects::species_name( nspec - 1 )) continue; + const auto ix = CanteraObjects::species_index( sp_inflow ); + factory.register_expression( new ConstExpr( tags.moleInflowTags[ix], 0 )); + } } - // set unspecified inflow species mole fractions to zero - BOOST_FOREACH( const std::string& sp_inflow, uninflowSpecies ){ - typedef Expr::ConstantExpr::Builder ConstExpr; - if( sp_inflow == CanteraObjects::species_name( nspec - 1 )) continue; - const auto ix = CanteraObjects::species_index( sp_inflow ); - factory.register_expression( new ConstExpr( tags.moleInflowTags[ix], 0 )); - } { // Species N factory.register_expression( new SpeciesN( tags.moleInflowTags[nspec - 1], Expr::tag_list( CanteraObjects::species_names(), Expr::STATE_N, "X_", @@ -558,6 +566,9 @@ parse_field_output( const YAML::Node& parser, if (parser["ReactorParameters"]["ReactorType"].as() == "PFR"){ insert( tags.presTag ); } + for( size_t i=0; i Date: Mon, 10 Aug 2020 15:50:57 -0600 Subject: [PATCH 09/10] Modifying the method to get mole fraction of the last species for initial/inflow condiitons when species fractions are set based on database. When species fractions are given in the input file, `pokitt::ERRORSPECN` is used (error is given when getting fraction of the last species to be negative or bigger than one.) When species fractions are given based on the database, `pokitt::CLIPSPECN' is used. (For the fraction of the last species, it is set to be `1` when value bigger than one is obtained, and is set to be `0` when negative value is obtained.). In this way, we need to be careful when writing the database to make sure the sum of the first (n-1) species fractions is equal or less than 1. --- src/parser/ParseInputFile.cpp | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/src/parser/ParseInputFile.cpp b/src/parser/ParseInputFile.cpp index fc4a19f..290a540 100644 --- a/src/parser/ParseInputFile.cpp +++ b/src/parser/ParseInputFile.cpp @@ -425,12 +425,20 @@ parse_initial_inflow_conditions( const YAML::Node& parser, const auto ix = CanteraObjects::species_index( sp_ic ); factory.register_expression( new ConstExpr( tags.moleTags[ix], 0 )); } + // Species N + factory.register_expression( new SpeciesN( tags.moleTags[nspec - 1], + Expr::tag_list( CanteraObjects::species_names(), Expr::STATE_N, "X_" ), + pokitt::ERRORSPECN ), + true /* allow overwrite */ ); } - // Species N - factory.register_expression( new SpeciesN( tags.moleTags[nspec - 1], - Expr::tag_list( CanteraObjects::species_names(), Expr::STATE_N, "X_" ), - pokitt::ERRORSPECN ), - true /* allow overwrite */ ); + else{ + // Species N + factory.register_expression( new SpeciesN( tags.moleTags[nspec - 1], + Expr::tag_list( CanteraObjects::species_names(), Expr::STATE_N, "X_" ), + pokitt::CLIPSPECN ), + true /* allow overwrite */ ); + } + factory.register_expression( new MixtureMWT( tags.mmwTag, tags.moleTags, pokitt::FractionType::MOLE )); factory.register_expression( new MoleToMassT( tags.massTags, tags.moleTags, tags.mmwTag )); @@ -454,15 +462,21 @@ parse_initial_inflow_conditions( const YAML::Node& parser, const auto ix = CanteraObjects::species_index( sp_inflow ); factory.register_expression( new ConstExpr( tags.moleInflowTags[ix], 0 )); } - } - - { // Species N + // Species N factory.register_expression( new SpeciesN( tags.moleInflowTags[nspec - 1], Expr::tag_list( CanteraObjects::species_names(), Expr::STATE_N, "X_", "_inflow" ), pokitt::ERRORSPECN ), true /* allow overwrite */ ); } + else{ + // Species N + factory.register_expression( new SpeciesN( tags.moleInflowTags[nspec - 1], + Expr::tag_list( CanteraObjects::species_names(), Expr::STATE_N, "X_", + "_inflow" ), + pokitt::CLIPSPECN ), + true /* allow overwrite */ ); + } factory.register_expression( new MoleToMassT( tags.massInflowTags, tags.moleInflowTags, tags.mmwInflowTag )); factory.register_expression( new MixtureMWT( tags.mmwInflowTag, tags.moleInflowTags, pokitt::FractionType::MOLE )); } -- GitLab From 7d750a5248fc37d43d0220fca0f6e2768eb331d9 Mon Sep 17 00:00:00 2001 From: Hang Zhou <> Date: Mon, 10 Aug 2020 16:00:11 -0600 Subject: [PATCH 10/10] Do not need to save mole fractions of all species by default (mass fractions have been saved by default). --- src/parser/ParseInputFile.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/parser/ParseInputFile.cpp b/src/parser/ParseInputFile.cpp index 290a540..45b8f6d 100644 --- a/src/parser/ParseInputFile.cpp +++ b/src/parser/ParseInputFile.cpp @@ -580,9 +580,6 @@ parse_field_output( const YAML::Node& parser, if (parser["ReactorParameters"]["ReactorType"].as() == "PFR"){ insert( tags.presTag ); } - for( size_t i=0; i