| Cantera 3.0.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
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 * @ingroup otherRateGroup
36 */
37 class CustomFunc1Rate final : public ReactionRate
38{
39 public:
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;
50 using ReactionRate::getParameters;
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
67 protected:
68 shared_ptr<Func1> m_ratefunc;
69};
70
71
72}
73
74#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:427
Cantera::CustomFunc1Rate
Custom reaction rate depending only on temperature.
Definition Custom.h:38
Cantera::CustomFunc1Rate::newMultiRate
unique_ptr< MultiRateBase > newMultiRate() const override
Create a rate evaluator for reactions of a particular derived type.
Definition Custom.h:43
Cantera::CustomFunc1Rate::validate
void validate(const string &equation, const Kinetics &kin) override
Validate the reaction rate expression.
Definition Custom.cpp:24
Cantera::CustomFunc1Rate::type
const string type() const override
String identifying reaction rate specialization.
Definition Custom.h:47
Cantera::CustomFunc1Rate::evalFromStruct
double evalFromStruct(const ArrheniusData &shared_data) const
Update information specific to reaction.
Definition Custom.cpp:32
Cantera::CustomFunc1Rate::setRateFunction
void setRateFunction(shared_ptr< Func1 > f)
Set custom rate.
Definition Custom.cpp:18
Cantera::Kinetics
Public interface for kinetics managers.
Definition Kinetics.h:126
Cantera::ReactionRate
Abstract base class for reaction rate definitions; this base class is used by user-facing APIs to acc...
Definition ReactionRate.h:49
Cantera::ReactionRate::getParameters
virtual void getParameters(AnyMap &node) const
Get parameters.
Definition ReactionRate.h:241
Cantera::Units
A representation of the units associated with a dimensional quantity.
Definition Units.h:35
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:564
Cantera::ArrheniusData
Data container holding shared data specific to ArrheniusRate.
Definition Arrhenius.h:30
Cantera::UnitStack
Unit aggregation utility.
Definition Units.h:105