Cantera  2.5.1
Nasa9PolyMultiTempRegion.h
Go to the documentation of this file.
1 /**
2  * @file Nasa9PolyMultiTempRegion.h
3  * Header for a single-species standard state object derived
4  * from \link Cantera::SpeciesThermoInterpType
5  * SpeciesThermoInterpType\endlink based
6  * on the NASA 9 coefficient temperature polynomial form
7  * applied to multiple temperature regions
8  * (see \ref spthermo and class \link Cantera::Nasa9PolyMultiTempRegion Nasa9PolyMultiTempRegion\endlink).
9  *
10  * This parameterization has multiple NASA temperature regions.
11  */
12 
13 // This file is part of Cantera. See License.txt in the top-level directory or
14 // at https://cantera.org/license.txt for license and copyright information.
15 
16 #ifndef CT_NASA9POLYMULTITEMPREGION_H
17 #define CT_NASA9POLYMULTITEMPREGION_H
18 
20 
21 namespace Cantera
22 {
23 //! The NASA 9 polynomial parameterization for a single species encompassing
24 //! multiple temperature regions.
25 /*!
26  * The parameterization used in each temperature range is described in the
27  * documentation for class Nasa9Poly1.
28  *
29  * These NASA representations may have multiple temperature regions through the
30  * use of this Nasa9PolyMultiTempRegion object, which uses multiple copies of
31  * the Nasa9Poly1 object to handle multiple temperature regions.
32  *
33  * @ingroup spthermo
34  * @see Nasa9Poly1
35  */
37 {
38 public:
40 
41  //! Constructor with all input data
42  /*!
43  * @param regionPts Vector of pointers to Nasa9Poly1 objects. These objects
44  * all refer to the temperature regions for the same species. The vector
45  * must be in increasing temperature region format. Together they
46  * represent the reference temperature parameterization for a single
47  * species.
48  *
49  * Note, after the constructor, we will own the underlying Nasa9Poly1
50  * objects and be responsible for owning them.
51  */
52  Nasa9PolyMultiTempRegion(std::vector<Nasa9Poly1*> &regionPts);
53 
54  //! Constructor with all input data
55  /*!
56  * @param tlow Minimum temperature
57  * @param thigh Maximum temperature
58  * @param pref reference pressure (Pa).
59  * @param coeffs Vector of coefficients used to set the parameters for the
60  * standard state. The vector has 1 + 11*`nzones` elements
61  * in the following order:
62  * - `coeffs[0]`: Number of zones (`nzones`)
63  * - `coeffs[1 + 11*zone]`: minimum temperature within zone
64  * - `coeffs[2 + 11*zone]`: maximum temperature within zone
65  * - `coeffs[3:11 + 11*zone]`: 9 coefficient parameterization
66  * where `zone` runs from zero to `nzones`-1.
67  */
68  Nasa9PolyMultiTempRegion(double tlow, double thigh, double pref,
69  const double* coeffs);
70 
71  //! Set the array of polynomial coefficients for each temperature region
72  /*!
73  * @param regions Map where each key is the minimum temperature for a
74  * region and each value is the array of 9 polynomial
75  * coefficients for that region.
76  */
77  void setParameters(const std::map<double, vector_fp>& regions);
78 
79  virtual ~Nasa9PolyMultiTempRegion();
80 
81  virtual int reportType() const;
82 
83  virtual size_t temperaturePolySize() const { return 7; }
84  virtual void updateTemperaturePoly(double T, double* T_poly) const;
85 
86  //! @copydoc Nasa9Poly1::updateProperties
87  virtual void updateProperties(const doublereal* tt,
88  doublereal* cp_R, doublereal* h_RT,
89  doublereal* s_R) const;
90 
91  virtual void updatePropertiesTemp(const doublereal temp,
92  doublereal* cp_R, doublereal* h_RT,
93  doublereal* s_R) const;
94 
95  virtual size_t nCoeffs() const;
96 
97  //! This utility function reports back the type of parameterization and all
98  //! of the parameters for the species, index.
99  /*!
100  * All parameters are output variables
101  *
102  * @param n Species index
103  * @param type Integer type of the standard type
104  * @param tlow output - Minimum temperature
105  * @param thigh output - Maximum temperature
106  * @param pref output - reference pressure (Pa).
107  * @param coeffs Vector of coefficients used to set the parameters for
108  * the standard state. There are 1 + 11*nzones coefficients.
109  * coeffs[0] is equal to nTempZones.
110  * index = 1
111  * for each zone:
112  * coeffs[index] = minTempZone
113  * coeffs[index+1] = maxTempZone
114  * coeffs[index+2+i] from i =0,9 are the coefficients themselves
115  */
116  virtual void reportParameters(size_t& n, int& type,
117  doublereal& tlow, doublereal& thigh,
118  doublereal& pref,
119  doublereal* const coeffs) const;
120 
121 protected:
122  //! Lower boundaries of each temperature regions
124 
125  //! Individual temperature region objects
126  std::vector<std::unique_ptr<Nasa9Poly1>> m_regionPts;
127 
128  //! current region
129  mutable int m_currRegion;
130 };
131 
132 }
133 #endif
Header for a single-species standard state object derived from SpeciesThermoInterpType based on the N...
The NASA 9 polynomial parameterization for a single species encompassing multiple temperature regions...
virtual int reportType() const
Returns an integer representing the type of parameterization.
vector_fp m_lowerTempBounds
Lower boundaries of each temperature regions.
void setParameters(const std::map< double, vector_fp > &regions)
Set the array of polynomial coefficients for each temperature region.
virtual void updatePropertiesTemp(const doublereal temp, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const
Compute the reference-state property of one species.
virtual size_t nCoeffs() const
This utility function returns the number of coefficients for a given type of species parameterization...
virtual void reportParameters(size_t &n, int &type, doublereal &tlow, doublereal &thigh, doublereal &pref, doublereal *const coeffs) const
This utility function reports back the type of parameterization and all of the parameters for the spe...
std::vector< std::unique_ptr< Nasa9Poly1 > > m_regionPts
Individual temperature region objects.
virtual void updateTemperaturePoly(double T, double *T_poly) const
Given the temperature T, compute the terms of the temperature polynomial T_poly.
virtual void updateProperties(const doublereal *tt, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const
Update the properties for this species, given a temperature polynomial.
virtual size_t temperaturePolySize() const
Number of terms in the temperature polynomial for this parameterization.
Abstract Base class for the thermodynamic manager for an individual species' reference state.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Definition: ct_defs.h:180
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:264