28 #ifndef ANTIOCH_NASA7_CURVE_FIT_H
29 #define ANTIOCH_NASA7_CURVE_FIT_H
37 template<
typename CoeffType=
double>
38 class NASA7CurveFit :
public NASACurveFitBase<CoeffType>
45 NASA7CurveFit(
const std::vector<CoeffType>& coeffs,
const std::vector<CoeffType> & temp );
55 template <
typename StateType>
66 template <
typename StateType>
77 template <
typename StateType>
89 template <
typename StateType>
101 template <
typename StateType>
109 template<
typename CoeffType>
120 template<
typename CoeffType>
127 this->
_temp.resize(3);
128 this->
_temp[0] = 300.L;
129 this->
_temp[1] = 1000.L;
130 this->
_temp[2] = 5000.L;
136 template<
typename CoeffType>
137 template <
typename StateType>
143 const UIntType interval = this->interval(cache.
T);
144 const unsigned int begin_interval =
Antioch::min(interval);
145 const unsigned int end_interval =
Antioch::max(interval)+1;
150 for (
unsigned int i=begin_interval; i != end_interval; ++i)
152 const CoeffType *
const a =
153 this->coefficients(i);
156 StateType(a[0] + a[1]*cache.
T + a[2]*cache.
T2 + a[3]*cache.
T3 + a[4]*cache.
T4),
163 template<
typename CoeffType>
164 template<
typename StateType>
170 const UIntType interval = this->interval(cache.
T);
171 const unsigned int begin_interval =
Antioch::min(interval);
172 const unsigned int end_interval =
Antioch::max(interval)+1;
176 for (
unsigned int i=begin_interval; i != end_interval; ++i)
178 const CoeffType *a = this->coefficients(interval);
184 a[1]*cache.
T/2.0L + a[2]*cache.
T2/3.0L + a[3]*cache.
T3/4.0L +
185 a[4]*cache.
T4/5.0L + a[5]/cache.
T),
191 template<
typename CoeffType>
192 template<
typename StateType>
198 const UIntType interval = this->interval(cache.
T);
199 const unsigned int begin_interval =
Antioch::min(interval);
200 const unsigned int end_interval =
Antioch::max(interval)+1;
204 for (
unsigned int i=begin_interval; i != end_interval; ++i)
206 const CoeffType *a = this->coefficients(interval);
211 StateType( a[0]*cache.
lnT
212 + a[1]*cache.
T + a[2]*cache.
T2/2.0L + a[3]*cache.
T3/3.0L
213 + a[4]*cache.
T4/4.0L + a[6]),
219 template<
typename CoeffType>
220 template<
typename StateType>
227 const UIntType interval = this->interval(cache.
T);
228 const unsigned int begin_interval =
Antioch::min(interval);
229 const unsigned int end_interval =
Antioch::max(interval)+1;
233 for (
unsigned int i=begin_interval; i != end_interval; ++i)
235 const CoeffType *a = this->coefficients(interval);
241 StateType(a[5]/cache.
T - a[0]*cache.
lnT
243 - a[1]/2.L*cache.
T - a[2]*cache.
T2/6.L
244 - a[3]*cache.
T3/12.L - a[4]*cache.
T4/20.L),
250 template <
typename CoeffType>
251 template <
typename StateType>
257 const UIntType interval = this->interval(cache.
T);
258 const unsigned int begin_interval =
Antioch::min(interval);
259 const unsigned int end_interval =
Antioch::max(interval)+1;
267 for (
unsigned int i=begin_interval; i != end_interval; ++i)
269 const CoeffType *
const a =
270 this->coefficients(i);
273 StateType(- a[5]/cache.
T2 - a[0]/cache.
T
274 - a[1]/2.L - a[2]*cache.
T/3.L
275 - a[3]*cache.
T2/4.L - a[4]*cache.
T3/5.L),
285 #endif //ANTIOCH_NASA7_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
StateType s_over_R(const TempCache< StateType > &cache) const
std::vector< CoeffType > _temp
The temperatures.
Antioch::enable_if_c< is_eigen< T >::value, typename value_type< T >::type >::type min(const T &in)
StateType h_RT_minus_s_R(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)
StateType h_over_RT(const TempCache< StateType > &cache) const
void check_coeff_size() const
const StateType cp_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.
NASA7CurveFit(const std::vector< CoeffType > &coeffs)
StateType dh_RT_minus_s_R_dT(const TempCache< StateType > &cache) const