ElectronIReaction<> completed
a. Separate CSV table lookup to Bolsig reaction rate class
b. BolsigFitReactionRate
c. Instantiation changed
d. Support for hasElectron predicate
This commit is contained in:
parent
70a5b812e5
commit
738f93bdf0
9 changed files with 530 additions and 7 deletions
|
|
@ -81,8 +81,8 @@ ElectronIReaction
|
|||
)
|
||||
:
|
||||
ReactionType<ReactionThermo>(species, thermoDatabase, dict),
|
||||
k_(species, dict),
|
||||
ke_(new CSV<scalar> ("k", dict))
|
||||
k_(species, dict)// ,
|
||||
// ke_(new CSV<scalar> ("k", dict))
|
||||
{}
|
||||
|
||||
|
||||
|
|
@ -124,7 +124,10 @@ Foam::scalar Foam::ElectronIReaction
|
|||
const scalarField& c
|
||||
) const
|
||||
{
|
||||
return ke_->value(this->En());
|
||||
// 1 Vm^2 -> 1e21 Td
|
||||
// m^3/s -> NA m^3/kmol/s
|
||||
// return ke_->value(this->En() / 1e-21) * ReactionThermo::NA;
|
||||
return k_(this->En(), this->Te(), c);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -63,8 +63,6 @@ class ElectronIReaction
|
|||
|
||||
ReactionRate k_;
|
||||
|
||||
autoPtr<TableBase<scalar> > ke_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
|
|
@ -179,6 +177,10 @@ public:
|
|||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
|
||||
|
||||
//- Check whether electron reaction
|
||||
virtual bool hasElectron() const {return true;}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -376,6 +376,10 @@ public:
|
|||
virtual void write(Ostream&) const;
|
||||
|
||||
|
||||
//- Check whether electron reaction
|
||||
virtual bool hasElectron() const {return false;}
|
||||
|
||||
|
||||
// Ostream Operator
|
||||
|
||||
friend Ostream& operator<< <ReactionThermo>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,137 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::BolsigFitReactionRate
|
||||
|
||||
Description
|
||||
BolsigFit reaction rate given by:
|
||||
|
||||
k = A * T^beta * exp(-Ta/T)
|
||||
|
||||
SourceFiles
|
||||
BolsigFitReactionRateI.H
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef BolsigFitReactionRate_H
|
||||
#define BolsigFitReactionRate_H
|
||||
|
||||
#include "scalarField.H"
|
||||
#include "typeInfo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class BolsigFitReactionRate Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class BolsigFitReactionRate
|
||||
{
|
||||
// Private data
|
||||
|
||||
scalar A_;
|
||||
scalar B_;
|
||||
scalar C_;
|
||||
scalar D_;
|
||||
scalar E_;
|
||||
scalar threshold_;
|
||||
// scalar beta_;
|
||||
// scalar Ta_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
inline BolsigFitReactionRate
|
||||
(
|
||||
const scalar A,
|
||||
const scalar B,
|
||||
const scalar C,
|
||||
const scalar D,
|
||||
const scalar E,
|
||||
const scalar threshold
|
||||
);
|
||||
|
||||
//- Construct from Istream
|
||||
inline BolsigFitReactionRate
|
||||
(
|
||||
const speciesTable& species,
|
||||
Istream& is
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
inline BolsigFitReactionRate
|
||||
(
|
||||
const speciesTable& species,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the type name
|
||||
static word type()
|
||||
{
|
||||
return "BolsigFit";
|
||||
}
|
||||
|
||||
inline scalar operator()
|
||||
(
|
||||
const scalar p,
|
||||
const scalar T,
|
||||
const scalarField& c
|
||||
) const;
|
||||
|
||||
//- Write to stream
|
||||
inline void write(Ostream& os) const;
|
||||
|
||||
|
||||
// Ostream Operator
|
||||
|
||||
inline friend Ostream& operator<<
|
||||
(
|
||||
Ostream&,
|
||||
const BolsigFitReactionRate&
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "BolsigFitReactionRateI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
|
@ -0,0 +1,139 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::BolsigFitReactionRate::BolsigFitReactionRate
|
||||
(
|
||||
const scalar A,
|
||||
const scalar B,
|
||||
const scalar C,
|
||||
const scalar D,
|
||||
const scalar E,
|
||||
const scalar threshold
|
||||
)
|
||||
:
|
||||
A_(A),
|
||||
B_(B),
|
||||
C_(C),
|
||||
D_(D),
|
||||
E_(E),
|
||||
threshold_(threshold)
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::BolsigFitReactionRate::BolsigFitReactionRate
|
||||
(
|
||||
const speciesTable&,
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
A_(readScalar(is.readBegin("BolsigFitReactionRate(Istream&)"))),
|
||||
B_(readScalar(is)),
|
||||
C_(readScalar(is)),
|
||||
D_(readScalar(is)),
|
||||
E_(readScalar(is)),
|
||||
threshold_(readScalar(is))
|
||||
{
|
||||
is.readEnd("BolsigFitReactionRate(Istream&)");
|
||||
}
|
||||
|
||||
|
||||
inline Foam::BolsigFitReactionRate::BolsigFitReactionRate
|
||||
(
|
||||
const speciesTable&,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
A_(readScalar(dict.lookup("A"))),
|
||||
B_(readScalar(dict.lookup("B"))),
|
||||
C_(readScalar(dict.lookup("C"))),
|
||||
D_(readScalar(dict.lookup("D"))),
|
||||
E_(readScalar(dict.lookup("E"))),
|
||||
threshold_(readScalar(dict.lookup("EnThreshold")))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::scalar Foam::BolsigFitReactionRate::operator()
|
||||
(
|
||||
const scalar p,
|
||||
const scalar T,
|
||||
const scalarField&
|
||||
) const
|
||||
{
|
||||
const scalar oneTd = 1.0e-21; // 1e-21 Vm^2 = 1 Td
|
||||
const scalar NA = 6.0221417930e+23; // mol^-1
|
||||
const scalar mol2kmol = 1000.0; //mol/kmol^-1
|
||||
|
||||
// p is actually E/n in Vm^2 unit
|
||||
scalar x = p / oneTd;
|
||||
|
||||
scalar ak = 0.0;
|
||||
|
||||
// threshold_ is E/n threshold in Td unit
|
||||
if (x > threshold_)
|
||||
{
|
||||
scalar x2 = x * x;
|
||||
scalar x3 = x2 * x;
|
||||
scalar lnx = log(x);
|
||||
ak = exp(A_ + B_*lnx + C_/x + D_/x2 + E_/x3) * NA * mol2kmol;
|
||||
}
|
||||
|
||||
return ak > 0.0 ? ak : 0.0;
|
||||
}
|
||||
|
||||
|
||||
inline void Foam::BolsigFitReactionRate::write(Ostream& os) const
|
||||
{
|
||||
os.writeKeyword("A") << A_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("B") << B_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("C") << C_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("D") << D_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("EnThreshold") << threshold_ << token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const BolsigFitReactionRate& arr
|
||||
)
|
||||
{
|
||||
os << token::BEGIN_LIST
|
||||
<< arr.A_ << token::SPACE
|
||||
<< arr.B_ << token::SPACE
|
||||
<< arr.C_ << token::SPACE
|
||||
<< arr.D_ << token::SPACE
|
||||
<< arr.E_ << token::SPACE
|
||||
<< arr.threshold_
|
||||
<< token::END_LIST;
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
|
@ -0,0 +1,134 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::BolsigTableReactionRate
|
||||
|
||||
Description
|
||||
BolsigTable reaction rate given by:
|
||||
|
||||
k = A * T^beta * exp(-Ta/T)
|
||||
|
||||
SourceFiles
|
||||
BolsigTableReactionRateI.H
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef BolsigTableReactionRate_H
|
||||
#define BolsigTableReactionRate_H
|
||||
|
||||
#include "scalarField.H"
|
||||
#include "typeInfo.H"
|
||||
|
||||
#include "CSV.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class BolsigTableReactionRate Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class BolsigTableReactionRate
|
||||
{
|
||||
// Private data
|
||||
|
||||
// scalar A_;
|
||||
// scalar B_;
|
||||
// scalar C_;
|
||||
// scalar D_;
|
||||
// scalar E_;
|
||||
// scalar beta_;
|
||||
// scalar Ta_;
|
||||
|
||||
autoPtr<TableBase<scalar> > ke_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
inline BolsigTableReactionRate
|
||||
(
|
||||
);
|
||||
|
||||
//- Construct from Istream
|
||||
inline BolsigTableReactionRate
|
||||
(
|
||||
const speciesTable& species,
|
||||
Istream& is
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
inline BolsigTableReactionRate
|
||||
(
|
||||
const speciesTable& species,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the type name
|
||||
static word type()
|
||||
{
|
||||
return "BolsigTable";
|
||||
}
|
||||
|
||||
inline scalar operator()
|
||||
(
|
||||
const scalar p,
|
||||
const scalar T,
|
||||
const scalarField& c
|
||||
) const;
|
||||
|
||||
//- Write to stream
|
||||
inline void write(Ostream& os) const;
|
||||
|
||||
|
||||
// Ostream Operator
|
||||
|
||||
inline friend Ostream& operator<<
|
||||
(
|
||||
Ostream&,
|
||||
const BolsigTableReactionRate&
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "BolsigTableReactionRateI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::BolsigTableReactionRate::BolsigTableReactionRate
|
||||
(
|
||||
)
|
||||
:
|
||||
ke_(NULL)
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::BolsigTableReactionRate::BolsigTableReactionRate
|
||||
(
|
||||
const speciesTable&,
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
ke_(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
inline Foam::BolsigTableReactionRate::BolsigTableReactionRate
|
||||
(
|
||||
const speciesTable&,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
ke_(new CSV<scalar> ("k", dict))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::scalar Foam::BolsigTableReactionRate::operator()
|
||||
(
|
||||
const scalar p,
|
||||
const scalar T,
|
||||
const scalarField&
|
||||
) const
|
||||
{
|
||||
const scalar NA = 6.0221417930e+23; // mol^-1
|
||||
const scalar mol2kmol = 1000.0; //mol/kmol^-1
|
||||
const scalar oneTd = 1.0e-21; // 1e-21 Vm^2 = 1 Td
|
||||
|
||||
// p is actually E/n in Vm^2 unit
|
||||
scalar coef = ke_->value(p / oneTd) * NA * mol2kmol;
|
||||
// Info << ke_->value(p * 1e21) << endl;
|
||||
return coef;
|
||||
// return ke_->value(p / 1e-21) * NA * mol2kmol;
|
||||
}
|
||||
|
||||
|
||||
inline void Foam::BolsigTableReactionRate::write(Ostream& os) const
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
inline Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const BolsigTableReactionRate& arr
|
||||
)
|
||||
{
|
||||
os << token::BEGIN_LIST
|
||||
<< token::END_LIST;
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
|
@ -120,8 +120,6 @@ namespace Foam
|
|||
\
|
||||
makeIRReactions(Thermo, ReactionRate) \
|
||||
\
|
||||
makeReaction(Thermo, ElectronIReaction, ReactionRate) \
|
||||
\
|
||||
makeReaction(Thermo, NonEquilibriumReversibleReaction, ReactionRate)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -40,15 +40,26 @@ License
|
|||
#include "SRIFallOffFunction.H"
|
||||
#include "TroeFallOffFunction.H"
|
||||
|
||||
#include "BolsigTableReactionRate.H"
|
||||
#include "BolsigFitReactionRate.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#define makeElectronReactions(Thermo) \
|
||||
\
|
||||
makeReaction(Thermo, ElectronIReaction, ArrheniusReactionRate) \
|
||||
makeReaction(Thermo, ElectronIReaction, BolsigFitReactionRate) \
|
||||
makeReaction(Thermo, ElectronIReaction, BolsigTableReactionRate)
|
||||
|
||||
|
||||
#define makeReactions(Thermo, Reaction) \
|
||||
\
|
||||
defineTemplateTypeNameAndDebug(Reaction, 0); \
|
||||
defineTemplateRunTimeSelectionTable(Reaction, Istream); \
|
||||
defineTemplateRunTimeSelectionTable(Reaction, dictionary); \
|
||||
\
|
||||
makeElectronReactions(Thermo) \
|
||||
\
|
||||
makeIRNReactions(Thermo, ArrheniusReactionRate) \
|
||||
makeIRNReactions(Thermo, infiniteReactionRate) \
|
||||
makeIRNReactions(Thermo, LandauTellerReactionRate) \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue