14 ReactorSurface::ReactorSurface()
22 double ReactorSurface::area()
const
27 void ReactorSurface::setArea(
double a)
32 void ReactorSurface::setKinetics(Kinetics* kin) {
39 size_t i = kin->surfacePhaseIndex();
41 throw CanteraError(
"ReactorSurface::setKinetics",
42 "Specified surface kinetics manager does not represent a surface "
43 "kinetics mechanism.");
45 m_thermo =
dynamic_cast<SurfPhase*
>(&kin->thermo(i));
46 m_cov.resize(m_thermo->nSpecies());
47 m_thermo->getCoverages(m_cov.data());
50 void ReactorSurface::setReactor(ReactorBase* reactor)
55 void ReactorSurface::setCoverages(
const double* cov)
57 copy(cov, cov + m_cov.size(), m_cov.begin());
60 void ReactorSurface::setCoverages(
const Composition& cov)
62 m_thermo->setCoveragesByName(cov);
63 m_thermo->getCoverages(m_cov.data());
66 void ReactorSurface::setCoverages(
const std::string& cov)
68 m_thermo->setCoveragesByName(cov);
69 m_thermo->getCoverages(m_cov.data());
72 void ReactorSurface::getCoverages(
double* cov)
const
74 copy(m_cov.begin(), m_cov.end(), cov);
77 void ReactorSurface::syncCoverages()
79 m_thermo->setCoveragesNoNorm(m_cov.data());
82 void ReactorSurface::addSensitivityReaction(
size_t i)
84 if (i >= m_kinetics->nReactions()) {
85 throw CanteraError(
"ReactorSurface::addSensitivityReaction",
86 "Reaction number out of range ({})", i);
88 size_t p = m_reactor->network().registerSensitivityParameter(
89 m_kinetics->reactionString(i), 1.0, 1.0);
90 m_params.emplace_back(
91 SensitivityParameter{i, p, 1.0, SensParameterType::reaction});
94 void ReactorSurface::setSensitivityParameters(
const double* params)
96 for (
auto& p : m_params) {
97 p.value = m_kinetics->multiplier(p.local);
98 m_kinetics->setMultiplier(p.local, p.value*params[p.global]);
102 void ReactorSurface::resetSensitivityParameters()
104 for (
auto& p : m_params) {
105 m_kinetics->setMultiplier(p.local, p.value);
Base class for kinetics managers and also contains the kineticsmgr module documentation (see Kinetics...
Header file for class ReactorSurface.
Header for a simple thermodynamics model of a surface phase derived from ThermoPhase,...
const size_t npos
index returned by functions to indicate "no position"
std::map< std::string, double > Composition
Map from string names to doubles.
Namespace for the Cantera kernel.