Cantera  3.1.0
Loading...
Searching...
No Matches
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
15#include "cantera/base/Units.h"
17#include "ReactionRate.h"
18#include "MultiRate.h"
19
20namespace Cantera
21{
22
23class AnyValue;
24class AnyMap;
25class 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 * @ingroup otherRateGroup
36 */
37class CustomFunc1Rate final : public ReactionRate
38{
39public:
40 CustomFunc1Rate() = default;
41 CustomFunc1Rate(const AnyMap& node, const UnitStack& rate_units);
42
43 unique_ptr<MultiRateBase> newMultiRate() const override {
44 return make_unique<MultiRate<CustomFunc1Rate, ArrheniusData>>();
45 }
46
47 const string type() const override { return "custom-rate-function"; }
48
49 void getParameters(AnyMap& rateNode, const Units& rate_units=Units(0.)) const;
51
52 void validate(const string& equation, const Kinetics& kin) override;
53
54 //! Update information specific to reaction
55 /*!
56 * @param shared_data data shared by all reactions of a given type
57 */
58 double evalFromStruct(const ArrheniusData& shared_data) const;
59
60 //! Set custom rate
61 /**
62 * The call to the Func1 object takes a single argument (temperature) and
63 * does not depend on parameters handled in C++.
64 */
65 void setRateFunction(shared_ptr<Func1> f);
66
67protected:
68 shared_ptr<Func1> m_ratefunc;
69};
70
71
72}
73
74#endif
Header for reaction rates that involve Arrhenius-type kinetics.
Header for unit conversion utilities, which are used to translate user input from input files (See In...
A map of string keys to values whose type can vary at runtime.
Definition AnyMap.h:431
Custom reaction rate depending only on temperature.
Definition Custom.h:38
unique_ptr< MultiRateBase > newMultiRate() const override
Create a rate evaluator for reactions of a particular derived type.
Definition Custom.h:43
void validate(const string &equation, const Kinetics &kin) override
Validate the reaction rate expression.
Definition Custom.cpp:24
const string type() const override
String identifying reaction rate specialization.
Definition Custom.h:47
double evalFromStruct(const ArrheniusData &shared_data) const
Update information specific to reaction.
Definition Custom.cpp:32
void setRateFunction(shared_ptr< Func1 > f)
Set custom rate.
Definition Custom.cpp:18
Public interface for kinetics managers.
Definition Kinetics.h:125
Abstract base class for reaction rate definitions; this base class is used by user-facing APIs to acc...
virtual void getParameters(AnyMap &node) const
Get parameters.
A representation of the units associated with a dimensional quantity.
Definition Units.h:35
This file contains definitions of constants, types and terms that are used in internal routines and a...
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595
Data container holding shared data specific to ArrheniusRate.
Definition Arrhenius.h:30
Unit aggregation utility.
Definition Units.h:105