Cantera
2.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
include
cantera
kinetics
FalloffFactory.h
Go to the documentation of this file.
1
/**
2
* @file FalloffFactory.h
3
* Parameterizations for reaction falloff functions. Used by classes
4
* that implement gas-phase kinetics (GasKinetics, GRI_30_Kinetics)
5
* (see \ref falloffGroup and class \link Cantera::Falloff Falloff\endlink).
6
*/
7
// Copyright 2001 California Institute of Technology
8
9
#ifndef CT_NEWFALLOFF_H
10
#define CT_NEWFALLOFF_H
11
12
#include "
cantera/base/ct_defs.h
"
13
#include "
reaction_defs.h
"
14
#include "
cantera/base/FactoryBase.h
"
15
#include "
cantera/base/ct_thread.h
"
16
17
namespace
Cantera
18
{
19
20
/**
21
* @defgroup falloffGroup Falloff Parameterizations
22
* This section describes the parameterizations used
23
* to describe the fall-off in reaction rate constants
24
* due to intermolecular energy transfer.
25
*
26
* @ingroup chemkinetics
27
*/
28
29
/**
30
* Base class for falloff function calculators. Each instance of a
31
* subclass of Falloff computes one falloff function.
32
*
33
* @ingroup falloffGroup
34
*/
35
class
Falloff
36
{
37
public
:
38
39
//! Default constructor is empty
40
Falloff
() {}
41
42
//! default destructor is empty
43
virtual
~Falloff
() {}
44
45
/**
46
* Initialize. Must be called before any other method is
47
* invoked.
48
*
49
* @param c Vector of coefficients of the parameterization.
50
* The number and meaning of these coefficients is
51
* subclass-dependent.
52
*/
53
virtual
void
init
(
const
vector_fp
& c) =0;
54
55
/**
56
* Update the temperature-dependent portions of the falloff
57
* function, if any. This method evaluates temperature-dependent
58
* intermediate results and stores them in the 'work' array.
59
* If not overloaded, the default behavior is to do nothing.
60
* @param T Temperature [K].
61
* @param work storage space for intermediate results.
62
*/
63
virtual
void
updateTemp
(doublereal T, doublereal* work)
const
{}
64
65
/**
66
* The falloff function. This is defined so that the
67
* rate coefficient is
68
*
69
* \f[ k = F(Pr)\frac{Pr}{1 + Pr}. \f]
70
*
71
* Here \f$ Pr \f$ is the reduced pressure, defined by
72
*
73
* \f[
74
* Pr = \frac{k_0 [M]}{k_\infty}.
75
* \f]
76
*
77
* @param pr reduced pressure (dimensionless).
78
* @param work array of size workSize() containing cached
79
* temperature-dependent intermediate results from a prior call
80
* to updateTemp.
81
*
82
* @return Returns the value of the falloff function \f$ F \f$ defined above
83
*/
84
virtual
doublereal
F
(doublereal pr,
const
doublereal* work)
const
=0;
85
86
/**
87
* The size of the work array required.
88
*/
89
virtual
size_t
workSize
() =0;
90
91
protected
:
92
private
:
93
};
94
95
96
97
/**
98
* Factory class to construct falloff function calculators.
99
* The falloff factory is accessed through static method factory:
100
*
101
* @code
102
* Falloff* f = FalloffFactory::factory()->newFalloff(type, c)
103
* @endcode
104
*
105
* @ingroup falloffGroup
106
*/
107
class
FalloffFactory
:
public
FactoryBase
108
{
109
public
:
110
111
/**
112
* Return a pointer to the factory. On the first call, a new
113
* instance is created. Since there is no need to instantiate
114
* more than one factory, on all subsequent calls, a pointer
115
* to the existing factory is returned.
116
*/
117
static
FalloffFactory
*
factory
() {
118
ScopedLock lock(
falloff_mutex
) ;
119
if
(!
s_factory
) {
120
s_factory
=
new
FalloffFactory
;
121
}
122
return
s_factory
;
123
}
124
125
virtual
void
deleteFactory
() {
126
ScopedLock lock(
falloff_mutex
);
127
if
(
s_factory
) {
128
delete
s_factory
;
129
s_factory
= 0;
130
}
131
}
132
133
/**
134
* Destructor doesn't do anything. We do not delete statically
135
* created single instance of this class here, because it would
136
* create an infinite loop if destructor is called for that
137
* single instance. Instead, to delete single instance, we
138
* call delete[] from FalloffMng's destructor.
139
*/
140
virtual
~FalloffFactory
() {
141
}
142
143
144
//! Return a pointer to a new falloff function calculator.
145
/*!
146
*
147
* @param type Integer flag specifying the type of falloff function.
148
* The standard types are defined in file reaction_defs.h. A factory
149
* class derived from FalloffFactory may define other types as well.
150
*
151
* @param c input vector of doubles which populates the falloff
152
* parameterization.
153
*
154
* @return Returns a pointer to a new Falloff class.
155
*/
156
virtual
Falloff
*
newFalloff
(
int
type,
const
vector_fp
& c);
157
158
private
:
159
//! Pointer to the single instance of the factory
160
static
FalloffFactory
*
s_factory
;
161
162
//! default constructor, which is defined as private
163
FalloffFactory
() {}
164
165
//! Mutex for use when calling the factory
166
static
mutex_t
falloff_mutex
;
167
};
168
169
}
170
#endif
171
172
Generated by
1.8.2