Cantera 2.6.0

Custom.h
Go to the documentation of this file.
1/**
2 * @file Custom.h
3 *
4 * @warning This file is an experimental part of the %Cantera API and
5 * may be changed or removed without notice.
6 */
7
8// This file is part of Cantera. See License.txt in the top-level directory or
9// at https://cantera.org/license.txt for license and copyright information.
10
11#ifndef CT_CUSTOM_H
12#define CT_CUSTOM_H
13
14#include "cantera/base/ct_defs.h"
15#include "cantera/base/Units.h"
16#include "cantera/kinetics/Arrhenius.h"
17#include "ReactionRate.h"
18#include "MultiRate.h"
19
20 namespace Cantera
21{
22
23 class AnyValue;
24 class AnyMap;
25 class Func1;
26
27
28//! Custom reaction rate depending only on temperature
29/**
30 * The rate expression is provided by a Func1 object taking a single
31 * argument (temperature) and does not use a formalized parameterization.
32 *
33 * @warning This class is an experimental part of the %Cantera API and
34 * may be changed or removed without notice.
35 */
36 class CustomFunc1Rate final : public ReactionRate
37{
38 public:
39 CustomFunc1Rate();
40 CustomFunc1Rate(const AnyMap& node, const UnitStack& rate_units)
41 : CustomFunc1Rate()
42 {
43 setParameters(node, rate_units);
44 }
45
46 unique_ptr<MultiRateBase> newMultiRate() const override {
47 return unique_ptr<MultiRateBase>(new MultiRate<CustomFunc1Rate, ArrheniusData>);
48 }
49
50 const std::string type() const override { return "custom-rate-function"; }
51
52 void getParameters(AnyMap& rateNode, const Units& rate_units=Units(0.)) const;
53 using ReactionRate::getParameters;
54
55 virtual void validate(const std::string& equation, const Kinetics& kin) override;
56
57 //! Update information specific to reaction
58 /*!
59 * @param shared_data data shared by all reactions of a given type
60 */
61 double evalFromStruct(const ArrheniusData& shared_data) const;
62
63 //! Set custom rate
64 /**
65 * The call to the Func1 object takes a single argument (temperature) and
66 * does not depend on parameters handled in C++.
67 */
68 void setRateFunction(shared_ptr<Func1> f);
69
70 protected:
71 shared_ptr<Func1> m_ratefunc;
72};
73
74
75}
76
77#endif
Arrhenius.h
Header for reaction rates that involve Arrhenius-type kinetics.
MultiRate.h
ReactionRate.h
Units.h
Header for unit conversion utilities, which are used to translate user input from input files (See In...
Cantera::AnyMap
A map of string keys to values whose type can vary at runtime.
Definition: AnyMap.h:399
Cantera::CustomFunc1Rate
Custom reaction rate depending only on temperature.
Definition: Custom.h:37
Cantera::CustomFunc1Rate::newMultiRate
unique_ptr< MultiRateBase > newMultiRate() const override
Create a rate evaluator for reactions of a particular derived type.
Definition: Custom.h:46
Cantera::CustomFunc1Rate::type
const std::string type() const override
String identifying reaction rate specialization.
Definition: Custom.h:50
Cantera::CustomFunc1Rate::validate
virtual void validate(const std::string &equation, const Kinetics &kin) override
Validate the reaction rate expression.
Definition: Custom.cpp:22
Cantera::CustomFunc1Rate::evalFromStruct
double evalFromStruct(const ArrheniusData &shared_data) const
Update information specific to reaction.
Definition: Custom.cpp:30
Cantera::CustomFunc1Rate::setRateFunction
void setRateFunction(shared_ptr< Func1 > f)
Set custom rate.
Definition: Custom.cpp:17
Cantera::Kinetics
Public interface for kinetics managers.
Definition: Kinetics.h:114
Cantera::MultiRate
A class template handling ReactionRate specializations.
Definition: MultiRate.h:21
Cantera::ReactionRate
Abstract base class for reaction rate definitions; this base class is used by user-facing APIs to acc...
Definition: ReactionRate.h:45
Cantera::ReactionRate::setParameters
virtual void setParameters(const AnyMap &node, const UnitStack &units)
Set parameters.
Definition: ReactionRate.h:88
Cantera::ReactionRate::getParameters
virtual void getParameters(AnyMap &node) const
Get parameters.
Definition: ReactionRate.h:172
Cantera::Units
A representation of the units associated with a dimensional quantity.
Definition: Units.h:30
ct_defs.h
This file contains definitions of constants, types and terms that are used in internal routines and a...
Cantera
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:557
Cantera::ArrheniusData
Data container holding shared data specific to ArrheniusRate.
Definition: Arrhenius.h:30
Cantera::UnitStack
Unit aggregation utility.
Definition: Units.h:99