27 #ifndef ANTIOCH_NASA9_CURVE_FIT_H
28 #define ANTIOCH_NASA9_CURVE_FIT_H
69 template<
typename CoeffType=
double>
70 class NASA9CurveFit :
public NASACurveFitBase<CoeffType>
75 NASA9CurveFit(
const std::vector<CoeffType>& coeffs,
const std::vector<CoeffType>& temps );
91 template <
typename StateType>
103 template <
typename StateType>
115 template <
typename StateType>
128 template <
typename StateType>
141 template <
typename StateType>
155 template<
typename CoeffType>
158 const std::vector<CoeffType>& temp )
167 template<
typename CoeffType>
180 template<
typename CoeffType>
186 this->_temp.resize(3);
187 this->_temp[0] = 200.L;
188 this->_temp[1] = 1000.L;
189 this->_temp[2] = 6000.L;
192 if( coeffs.size()/n_coeffs == 3 )
193 this->_temp.push_back(20000.L);
196 template<
typename CoeffType>
197 template <
typename StateType>
203 const UIntType interval = this->interval(cache.
T);
204 const unsigned int begin_interval =
Antioch::min(interval);
205 const unsigned int end_interval =
Antioch::max(interval)+1;
211 for (
unsigned int i=begin_interval; i != end_interval; ++i)
213 const CoeffType *
const a =
214 this->coefficients(i);
217 StateType(a[0]/cache.
T2 + a[1]/cache.
T + a[2] + a[3]*cache.
T +
218 a[4]*cache.
T2 + a[5]*cache.
T3 + a[6]*cache.
T4),
226 template<
typename CoeffType>
227 template<
typename StateType>
233 const UIntType interval = this->interval(cache.
T);
234 const unsigned int begin_interval =
Antioch::min(interval);
235 const unsigned int end_interval =
Antioch::max(interval)+1;
239 for (
unsigned int i=begin_interval; i != end_interval; ++i)
241 const CoeffType *a = this->coefficients(interval);
246 StateType( -a[0]/cache.
T2 + a[1]*cache.
lnT/cache.
T + a[2] +
247 a[3]*cache.
T/2.0L + a[4]*cache.
T2/3.0L + a[5]*cache.
T3/4.0L +
248 a[6]*cache.
T4/5.0L + a[7]/cache.
T),
254 template<
typename CoeffType>
255 template<
typename StateType>
261 const UIntType interval = this->interval(cache.
T);
262 const unsigned int begin_interval =
Antioch::min(interval);
263 const unsigned int end_interval =
Antioch::max(interval)+1;
267 for (
unsigned int i=begin_interval; i != end_interval; ++i)
269 const CoeffType *a = this->coefficients(interval);
274 StateType( -a[0]/cache.
T2/2.0 - a[1]/cache.
T + a[2]*cache.
lnT
275 + a[3]*cache.
T + a[4]*cache.
T2/2.0 + a[5]*cache.
T3/3.0
276 + a[6]*cache.
T4/4.0 + a[8]),
282 template<
typename CoeffType>
283 template<
typename StateType>
290 const UIntType interval = this->interval(cache.
T);
291 const unsigned int begin_interval =
Antioch::min(interval);
292 const unsigned int end_interval =
Antioch::max(interval)+1;
296 for (
unsigned int i=begin_interval; i != end_interval; ++i)
298 const CoeffType *a = this->coefficients(interval);
304 StateType(-a[0]/cache.
T2/2.0 + (a[1] + a[7])/cache.
T +
305 a[1]*cache.
lnT/cache.
T - a[2]*cache.
lnT +
306 (a[2] - a[8]) - a[3]*cache.
T/2.0 -
307 a[4]*cache.
T2/6.0 - a[5]*cache.
T3/12.0 -
314 template <
typename CoeffType>
315 template <
typename StateType>
321 const UIntType interval = this->interval(cache.
T);
322 const unsigned int begin_interval =
Antioch::min(interval);
323 const unsigned int end_interval =
Antioch::max(interval)+1;
331 for (
unsigned int i=begin_interval; i != end_interval; ++i)
333 const CoeffType *
const a =
334 this->coefficients(i);
337 StateType(a[0]/cache.
T3 - a[7]/cache.
T2 -
338 a[1]*cache.
lnT/cache.
T2 - a[2]/cache.
T -
339 a[3]/2. - a[4]*cache.
T/3. - a[5]*cache.
T2/4. -
349 #endif // ANTIOCH_NASA9_CURVE_FIT_H
Antioch::enable_if_c< is_eigen< T >::value, typename value_type< T >::type >::type max(const T &in)
void check_temp_coeff_size_consistency() const
const StateType cp_over_R(const TempCache< StateType > &cache) const
void init_nasa9_temps(const std::vector< CoeffType > &coeffs, unsigned n_coeffs)
Antioch::enable_if_c< is_eigen< T >::value, typename value_type< T >::type >::type min(const T &in)
StateType h_over_RT(const TempCache< StateType > &cache) const
enable_if_c< is_eigen< T1 >::value &&is_eigen< T2 >::value, typename state_type< T1 >::type >::type if_else(const Condition &condition, const T1 &if_true, const T2 &if_false)
void check_coeff_size() const
StateType dh_RT_minus_s_R_dT(const TempCache< StateType > &cache) const
StateType h_RT_minus_s_R(const TempCache< StateType > &cache) const
StateType s_over_R(const TempCache< StateType > &cache) const
The parameters are reduced parameters.
_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > zero_clone(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &ex)
unsigned int _n_coeffs
The number of coefficients in each interval.