From bef8f8f5847ec3f111b1a5df30be8ec9810ba893 Mon Sep 17 00:00:00 2001 From: ignis Date: Sun, 19 Jun 2016 18:49:33 +0900 Subject: [PATCH] Reaction has new attr Te En and new reaction rate --- .../ElectronIReaction/ElectronIReaction.C | 145 +++++++++++++ .../ElectronIReaction/ElectronIReaction.H | 195 ++++++++++++++++++ .../reaction/Reactions/Reaction/Reaction.C | 17 +- .../reaction/Reactions/Reaction/Reaction.H | 12 ++ .../reaction/Reactions/Reaction/ReactionI.H | 28 +++ .../specie/reaction/reactions/makeReaction.H | 4 + 6 files changed, 397 insertions(+), 4 deletions(-) create mode 100644 src/thermophysicalModels/specie/reaction/Reactions/ElectronIReaction/ElectronIReaction.C create mode 100644 src/thermophysicalModels/specie/reaction/Reactions/ElectronIReaction/ElectronIReaction.H diff --git a/src/thermophysicalModels/specie/reaction/Reactions/ElectronIReaction/ElectronIReaction.C b/src/thermophysicalModels/specie/reaction/Reactions/ElectronIReaction/ElectronIReaction.C new file mode 100644 index 00000000..cba498f3 --- /dev/null +++ b/src/thermophysicalModels/specie/reaction/Reactions/ElectronIReaction/ElectronIReaction.C @@ -0,0 +1,145 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "ElectronIReaction.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +< + template class ReactionType, + class ReactionThermo, + class ReactionRate +> +Foam::ElectronIReaction:: +ElectronIReaction +( + const ReactionType& reaction, + const ReactionRate& k +) +: + ReactionType(reaction), + k_(k) +{} + + +template +< + template class ReactionType, + class ReactionThermo, + class ReactionRate +> +Foam::ElectronIReaction:: +ElectronIReaction +( + const speciesTable& species, + const HashPtrTable& thermoDatabase, + Istream& is +) +: + ReactionType(species, thermoDatabase, is), + k_(species, is) +{} + + +template +< + template class ReactionType, + class ReactionThermo, + class ReactionRate +> +Foam::ElectronIReaction:: +ElectronIReaction +( + const speciesTable& species, + const HashPtrTable& thermoDatabase, + const dictionary& dict +) +: + ReactionType(species, thermoDatabase, dict), + k_(species, dict) +{} + + +template +< + template class ReactionType, + class ReactionThermo, + class ReactionRate +> +Foam::ElectronIReaction:: +ElectronIReaction +( + const ElectronIReaction& irr, + const speciesTable& species +) +: + ReactionType(irr, species), + k_(irr.k_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +< + template class ReactionType, + class ReactionThermo, + class ReactionRate +> +Foam::scalar Foam::ElectronIReaction +< + ReactionType, + ReactionThermo, + ReactionRate +>::kf +( + const scalar p, + const scalar T, + const scalarField& c +) const +{ + return k_(p, this->Te(), c); +} + + +template +< + template class ReactionType, + class ReactionThermo, + class ReactionRate +> +void Foam::ElectronIReaction:: +write +( + Ostream& os +) const +{ + ReactionType::write(os); + k_.write(os); +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/reaction/Reactions/ElectronIReaction/ElectronIReaction.H b/src/thermophysicalModels/specie/reaction/Reactions/ElectronIReaction/ElectronIReaction.H new file mode 100644 index 00000000..070445ea --- /dev/null +++ b/src/thermophysicalModels/specie/reaction/Reactions/ElectronIReaction/ElectronIReaction.H @@ -0,0 +1,195 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::ElectronIReaction + +Description + Simple extension of Reaction to handle reversible reactions using + equilibrium thermodynamics. + +SourceFiles + ElectronIReaction.C + +\*---------------------------------------------------------------------------*/ + +#ifndef ElectronIReaction_H +#define ElectronIReaction_H + +#include "Reaction.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class ElectronIReaction Declaration +\*---------------------------------------------------------------------------*/ + +template +< + template class ReactionType, + class ReactionThermo, + class ReactionRate +> +class ElectronIReaction +: + public ReactionType +{ + // Private data + + ReactionRate k_; + + + // Private Member Functions + + //- Disallow default bitwise assignment + void operator= + ( + const ElectronIReaction + < + ReactionType, + ReactionThermo, + ReactionRate + >& + ); + + +public: + + //- Runtime type information + TypeName("electronI"); + + + // Constructors + + //- Construct from components + ElectronIReaction + ( + const ReactionType& reaction, + const ReactionRate& reactionRate + ); + + //- Construct as copy given new speciesTable + ElectronIReaction + ( + const ElectronIReaction + < + ReactionType, + ReactionThermo, + ReactionRate + >&, + const speciesTable& species + ); + + //- Construct from Istream + ElectronIReaction + ( + const speciesTable& species, + const HashPtrTable& thermoDatabase, + Istream& is + ); + + //- Construct from dictionary + ElectronIReaction + ( + const speciesTable& species, + const HashPtrTable& thermoDatabase, + const dictionary& dict + ); + + //- Construct and return a clone + virtual autoPtr > clone() const + { + return autoPtr > + ( + new ElectronIReaction + < + ReactionType, + ReactionThermo, + ReactionRate + >(*this) + ); + } + + //- Construct and return a clone with new speciesTable + virtual autoPtr > clone + ( + const speciesTable& species + ) const + { + return autoPtr > + ( + new ElectronIReaction + < + ReactionType, + ReactionThermo, + ReactionRate + > + ( + *this, + species + ) + ); + } + + + //- Destructor + virtual ~ElectronIReaction() + {} + + + // Member Functions + + // ElectronIReaction rate coefficients + + //- Forward rate constant + virtual scalar kf + ( + const scalar p, + const scalar T, + const scalarField& c + ) const; + + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "ElectronIReaction.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.C b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.C index 9624749b..29f12ffa 100644 --- a/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.C +++ b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.C @@ -153,7 +153,9 @@ Foam::Reaction::Reaction name_("un-named-reaction-" + Foam::name(getNewReactionID())), species_(species), lhs_(lhs), - rhs_(rhs) + rhs_(rhs), + Te_(0.0), + En_(0.0) { setThermo(thermoDatabase); } @@ -170,7 +172,10 @@ Foam::Reaction::Reaction name_(r.name() + "Copy"), species_(species), lhs_(r.lhs_), - rhs_(r.rhs_) + rhs_(r.rhs_), + Te_(r.Te_), + En_(r.En_) + {} @@ -322,7 +327,9 @@ Foam::Reaction::Reaction : ReactionThermo::thermoType(*thermoDatabase[species[0]]), name_("un-named-reaction" + Foam::name(getNewReactionID())), - species_(species) + species_(species), + Te_(0.0), + En_(0.0) { setLRhs(is, species, lhs_, rhs_); setThermo(thermoDatabase); @@ -339,7 +346,9 @@ Foam::Reaction::Reaction : ReactionThermo::thermoType(*thermoDatabase[species[0]]), name_(dict.dictName()), - species_(species) + species_(species), + Te_(0.0), + En_(0.0) { setLRhs ( diff --git a/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.H b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.H index 8ba7d40d..a2ea0e3e 100644 --- a/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.H +++ b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.H @@ -140,6 +140,12 @@ private: //- Specie info for the right-hand-side of the reaction List rhs_; + //- Electron temperature parameter + scalar Te_; + + //- Reduced electric field parameter + scalar En_; + // Private Member Functions @@ -304,6 +310,12 @@ public: inline word& name(); inline const word& name() const; + inline scalar& Te(); + inline scalar Te() const; + + inline scalar& En(); + inline scalar En() const; + // - Access to basic components of the reaction inline const List& lhs() const; inline const List& rhs() const; diff --git a/src/thermophysicalModels/specie/reaction/Reactions/Reaction/ReactionI.H b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/ReactionI.H index 6dece80b..1448a68f 100644 --- a/src/thermophysicalModels/specie/reaction/Reactions/Reaction/ReactionI.H +++ b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/ReactionI.H @@ -46,6 +46,34 @@ inline const word& Reaction::name() const } +template +inline scalar& Reaction::Te() +{ + return Te_; +} + + +template +inline scalar Reaction::Te() const +{ + return Te_; +} + + +template +inline scalar& Reaction::En() +{ + return En_; +} + + +template +inline scalar Reaction::En() const +{ + return En_; +} + + template inline const List::specieCoeffs>& Reaction::lhs() const diff --git a/src/thermophysicalModels/specie/reaction/reactions/makeReaction.H b/src/thermophysicalModels/specie/reaction/reactions/makeReaction.H index 0b72f680..b26495ee 100644 --- a/src/thermophysicalModels/specie/reaction/reactions/makeReaction.H +++ b/src/thermophysicalModels/specie/reaction/reactions/makeReaction.H @@ -38,6 +38,8 @@ Description #include "ReversibleReaction.H" #include "NonEquilibriumReversibleReaction.H" +#include "ElectronIReaction.H" + #include "thermo.H" #include "sutherlandTransport.H" @@ -118,6 +120,8 @@ namespace Foam \ makeIRReactions(Thermo, ReactionRate) \ \ + makeReaction(Thermo, ElectronIReaction, ReactionRate) \ + \ makeReaction(Thermo, NonEquilibriumReversibleReaction, ReactionRate)