Reaction has new attr Te En and new reaction rate

This commit is contained in:
ignis 2016-06-19 18:49:33 +09:00
parent 7e84351905
commit bef8f8f584
6 changed files with 397 additions and 4 deletions

View file

@ -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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "ElectronIReaction.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::ElectronIReaction<ReactionType, ReactionThermo, ReactionRate>::
ElectronIReaction
(
const ReactionType<ReactionThermo>& reaction,
const ReactionRate& k
)
:
ReactionType<ReactionThermo>(reaction),
k_(k)
{}
template
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::ElectronIReaction<ReactionType, ReactionThermo, ReactionRate>::
ElectronIReaction
(
const speciesTable& species,
const HashPtrTable<ReactionThermo>& thermoDatabase,
Istream& is
)
:
ReactionType<ReactionThermo>(species, thermoDatabase, is),
k_(species, is)
{}
template
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::ElectronIReaction<ReactionType, ReactionThermo, ReactionRate>::
ElectronIReaction
(
const speciesTable& species,
const HashPtrTable<ReactionThermo>& thermoDatabase,
const dictionary& dict
)
:
ReactionType<ReactionThermo>(species, thermoDatabase, dict),
k_(species, dict)
{}
template
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::ElectronIReaction<ReactionType, ReactionThermo, ReactionRate>::
ElectronIReaction
(
const ElectronIReaction<ReactionType, ReactionThermo,ReactionRate>& irr,
const speciesTable& species
)
:
ReactionType<ReactionThermo>(irr, species),
k_(irr.k_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template
<
template<class> 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> class ReactionType,
class ReactionThermo,
class ReactionRate
>
void Foam::ElectronIReaction<ReactionType, ReactionThermo, ReactionRate>::
write
(
Ostream& os
) const
{
ReactionType<ReactionThermo>::write(os);
k_.write(os);
}
// ************************************************************************* //

View file

@ -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 <http://www.gnu.org/licenses/>.
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> class ReactionType,
class ReactionThermo,
class ReactionRate
>
class ElectronIReaction
:
public ReactionType<ReactionThermo>
{
// 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<ReactionThermo>& 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<ReactionThermo>& thermoDatabase,
Istream& is
);
//- Construct from dictionary
ElectronIReaction
(
const speciesTable& species,
const HashPtrTable<ReactionThermo>& thermoDatabase,
const dictionary& dict
);
//- Construct and return a clone
virtual autoPtr<Reaction<ReactionThermo> > clone() const
{
return autoPtr<Reaction<ReactionThermo> >
(
new ElectronIReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>(*this)
);
}
//- Construct and return a clone with new speciesTable
virtual autoPtr<Reaction<ReactionThermo> > clone
(
const speciesTable& species
) const
{
return autoPtr<Reaction<ReactionThermo> >
(
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
// ************************************************************************* //

View file

@ -153,7 +153,9 @@ Foam::Reaction<ReactionThermo>::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<ReactionThermo>::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<ReactionThermo>::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<ReactionThermo>::Reaction
:
ReactionThermo::thermoType(*thermoDatabase[species[0]]),
name_(dict.dictName()),
species_(species)
species_(species),
Te_(0.0),
En_(0.0)
{
setLRhs
(

View file

@ -140,6 +140,12 @@ private:
//- Specie info for the right-hand-side of the reaction
List<specieCoeffs> 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<specieCoeffs>& lhs() const;
inline const List<specieCoeffs>& rhs() const;

View file

@ -46,6 +46,34 @@ inline const word& Reaction<ReactionThermo>::name() const
}
template<class ReactionThermo>
inline scalar& Reaction<ReactionThermo>::Te()
{
return Te_;
}
template<class ReactionThermo>
inline scalar Reaction<ReactionThermo>::Te() const
{
return Te_;
}
template<class ReactionThermo>
inline scalar& Reaction<ReactionThermo>::En()
{
return En_;
}
template<class ReactionThermo>
inline scalar Reaction<ReactionThermo>::En() const
{
return En_;
}
template<class ReactionThermo>
inline const List<typename Reaction<ReactionThermo>::specieCoeffs>&
Reaction<ReactionThermo>::lhs() const

View file

@ -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)