antioch-0.4.0
nasa_evaluator_unit.C
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // Antioch - A Gas Dynamics Thermochemistry Library
5 //
6 // Copyright (C) 2014-2016 Paul T. Bauman, Benjamin S. Kirk,
7 // Sylvain Plessis, Roy H. Stonger
8 //
9 // Copyright (C) 2013 The PECOS Development Team
10 //
11 // This library is free software; you can redistribute it and/or
12 // modify it under the terms of the Version 2.1 GNU Lesser General
13 // Public License as published by the Free Software Foundation.
14 //
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
23 // Boston, MA 02110-1301 USA
24 //
25 //-----------------------------------------------------------------------el-
26 //
27 // $Id$
28 //
29 //--------------------------------------------------------------------------
30 //--------------------------------------------------------------------------
31 
32 // C++
33 #include <cmath>
34 #include <limits>
35 
36 // Antioch
37 #include "antioch_config.h"
40 #include "antioch/cea_curve_fit.h"
43 #include "antioch/temp_cache.h"
44 #include "antioch/cea_mixture.h"
45 #include "antioch/cea_evaluator.h"
48 
49 template <typename Scalar, typename NASAFit>
50 int test_cp( const std::string& species_name, unsigned int species, Scalar cp_exact, Scalar T,
52 {
53  using std::abs;
54 
55  int return_flag = 0;
56 
57  const Scalar tol = std::numeric_limits<Scalar>::epsilon() * 1000;
58 
59  typedef typename Antioch::template TempCache<Scalar> Cache;
60 
61  const Scalar cp = thermo.cp(Cache(T), species);
62 
63  if( abs( (cp_exact - cp)/cp_exact ) > tol )
64  {
65  std::cerr << std::scientific << std::setprecision(16)
66  << "Error: Mismatch in species specific heat."
67  << "\nspecies = " << species_name
68  << "\ncp = " << cp
69  << "\ncp_exact = " << cp_exact
70  << "\ndifference = " << (cp_exact - cp)
71  << "\ntolerance = " << tol
72  << "\nT = " << T << std::endl;
73  return_flag = 1;
74  }
75 
76  return return_flag;
77 }
78 
79 template <typename Scalar, typename NASAFit>
80 int test_h( const std::string& species_name, unsigned int species, Scalar h_exact, Scalar T,
82 {
83  using std::abs;
84 
85  int return_flag = 0;
86 
87  const Scalar tol = std::numeric_limits<Scalar>::epsilon() * 10;
88 
89  typedef typename Antioch::template TempCache<Scalar> Cache;
90 
91  const Scalar h = thermo.h(Cache(T), species);
92 
93  if( abs( (h_exact - h)/h_exact ) > tol )
94  {
95  std::cerr << std::scientific << std::setprecision(16)
96  << "Error: Mismatch in species total enthalpy."
97  << "\nspecies = " << species_name
98  << "\nh = " << h
99  << "\nh_exact = " << h_exact
100  << "\ndifference = " << (h_exact - h)
101  << "\ntolerance = " << tol
102  << "\nT = " << T << std::endl;
103  return_flag = 1;
104  }
105 
106  return return_flag;
107 }
108 
109 template <typename Scalar, typename NASAFit>
110 int test_s( const std::string& species_name, unsigned int species, Scalar s_exact, Scalar T,
112 {
113  using std::abs;
114 
115  int return_flag = 0;
116 
117  const Scalar tol = std::numeric_limits<Scalar>::epsilon() * 1000;
118 
119  typedef typename Antioch::template TempCache<Scalar> Cache;
120 
121  const Scalar s = thermo.s_over_R(Cache(T), species);
122 
123  if( abs( (s_exact - s)/s_exact ) > tol )
124  {
125  std::cerr << std::scientific << std::setprecision(16)
126  << "Error: Mismatch in species entropie."
127  << "\nspecies = " << species_name
128  << "\ns = " << s
129  << "\ns_exact = " << s_exact
130  << "\ndifference = " << (s_exact - s)
131  << "\ntolerance = " << tol
132  << "\nT = " << T << std::endl;
133  return_flag = 1;
134  }
135 
136  return return_flag;
137 }
138 
139 template <typename Scalar, typename NASAFit>
140 int test_g( const std::string& species_name, unsigned int species, Scalar g_exact, Scalar T,
142 {
143  using std::abs;
144 
145  int return_flag = 0;
146 
147  const Scalar tol = std::numeric_limits<Scalar>::epsilon() * 1000;
148 
149  typedef typename Antioch::template TempCache<Scalar> Cache;
150 
151  const Scalar g = thermo.h_over_RT(Cache(T), species)
152  - thermo.s_over_R(Cache(T), species) ;
153 
154  if( abs( (g_exact - g)/g_exact ) > tol )
155  {
156  std::cerr << std::scientific << std::setprecision(16)
157  << "Error: Mismatch in species free energy (Gibbs energy)."
158  << "\nspecies = " << species_name
159  << "\ng = " << g
160  << "\ng_exact = " << g_exact
161  << "\ndifference = " << (g_exact - g)
162  << "\ntolerance = " << tol
163  << "\nT = " << T << std::endl;
164  return_flag = 1;
165  }
166 
167  return return_flag;
168 }
169 
170 template <typename Scalar>
171 Scalar cea_cp( Scalar T, Scalar a0, Scalar a1, Scalar a2,
172  Scalar a3, Scalar a4, Scalar a5, Scalar a6 )
173 {
174  if( T < 200.1)
175  T = 200.1L;
176 
177  return a0/(T*T) + a1/T + a2 + a3*T + a4*(T*T) + a5*(T*T*T) + a6*(T*T*T*T);
178 }
179 
180 template <typename Scalar>
181 Scalar cea_h( Scalar T, Scalar a0, Scalar a1, Scalar a2,
182  Scalar a3, Scalar a4, Scalar a5, Scalar a6,
183  Scalar a8 )
184 {
185  return -a0/(T*T) + a1*std::log(T)/T + a2 + a3*T/2.0L + a4*(T*T)/3.0L + a5*(T*T*T)/4.0L + a6*(T*T*T*T)/5.0L + a8/T;
186 }
187 template <typename Scalar>
188 Scalar cea_s( Scalar T, Scalar a0, Scalar a1, Scalar a2,
189  Scalar a3, Scalar a4, Scalar a5, Scalar a6,
190  Scalar a9 )
191 {
192  return -a0/(2.L*T*T) - a1/T + a2*std::log(T) + a3*T + a4*(T*T)/2.0L + a5*(T*T*T)/3.0L + a6*(T*T*T*T)/4.0L + a9;
193 }
194 
195 template <typename Scalar>
196 Scalar nasa_cp( Scalar T, Scalar a0, Scalar a1, Scalar a2,
197  Scalar a3, Scalar a4)
198 {
199  if( T < 200.1)
200  T = 200.1L;
201 
202  return a0 + a1*T + a2*T*T + a3*T*T*T + a4*T*T*T*T;
203 }
204 
205 template <typename Scalar>
206 Scalar nasa_h( Scalar T, Scalar a0, Scalar a1, Scalar a2,
207  Scalar a3, Scalar a4, Scalar a5)
208 {
209  return a0 + a1*T/2.0L + a2*T*T/3.0L + a3*T*T*T/4.0L +
210  a4*T*T*T*T/5.0L + a5/T;
211 }
212 template <typename Scalar>
213 Scalar nasa_s( Scalar T, Scalar a0, Scalar a1, Scalar a2,
214  Scalar a3, Scalar a4, Scalar a6)
215 {
216  return a0*std::log(T) + a1*T + a2*T*T/2.0L + a3*T*T*T/3.0L +
217  a4*T*T*T*T/4.0L + a6;
218 }
219 
220 
221 
222 template <typename Scalar>
223 int tester(const std::string & nasa_filename)
224 {
225  std::vector<std::string> species_str_list;
226  const unsigned int n_species = 5;
227  species_str_list.reserve(n_species);
228  species_str_list.push_back( "N2" );
229  species_str_list.push_back( "O2" );
230  species_str_list.push_back( "OH" );
231  species_str_list.push_back( "O" );
232  species_str_list.push_back( "H2" );
233 
234  const Scalar Mm_H = 1.008e-3L;
235  const Scalar Mm_N = 14.008e-3L;
236  const Scalar Mm_O = 16.000e-3L;
237  const Scalar Mm_N2 = 2.L * Mm_N;
238  const Scalar Mm_O2 = 2.L * Mm_O;
239  const Scalar Mm_H2 = 2.L * Mm_H;
240  const Scalar Mm_OH = Mm_H + Mm_O;
241 
242  Antioch::ChemicalMixture<Scalar> chem_mixture( species_str_list );
243 
244 // backward compatibility
245  Antioch::CEAThermoMixture<Scalar> cea_mixture( chem_mixture );
247  Antioch::CEAEvaluator<Scalar> thermo( cea_mixture );
248 
249 // explicit
251  Antioch::read_nasa_mixture_data( nasa_mixture, nasa_filename, Antioch::CHEMKIN );
253 
254  //const Scalar P = 100000.0;
255  const Scalar T1 = 190.0;
256  const Scalar T2 = 1500.0;
257  const Scalar T3 = 10000.0;
258  const Scalar T4 = 800.0;
259 
260  const Scalar R_N2 = Antioch::Constants::R_universal<Scalar>()/Mm_N2;
261  const Scalar R_O2 = Antioch::Constants::R_universal<Scalar>()/Mm_O2;
262  const Scalar R_H2 = Antioch::Constants::R_universal<Scalar>()/Mm_H2;
263  const Scalar R_O = Antioch::Constants::R_universal<Scalar>()/Mm_O;
264  const Scalar R_OH = Antioch::Constants::R_universal<Scalar>()/Mm_OH;
265 
266 // declare everyone here, easier
267  const Scalar cea_N2_a1[10] = { 2.21037122e+04, -3.81846145e+02, 6.08273815e+00, -8.53091381e-03, 1.38464610e-05,
268  -9.62579293e-09, 2.51970560e-12, 0.00000000e+00, 7.10845911e+02, -1.07600320e+01};
269  const Scalar cea_N2_a2[10] = { 5.87709908e+05, -2.23924255e+03, 6.06694267e+00, -6.13965296e-04, 1.49179819e-07,
270  -1.92309442e-11, 1.06194871e-15, 0.00000000e+00, 1.28320618e+04, -1.58663484e+01};
271  const Scalar cea_N2_a3[10] = { 8.30971200e+08, -6.42048187e+05, 2.02020507e+02, -3.06501961e-02, 2.48685558e-06,
272  -9.70579208e-11, 1.43751673e-15, 0.00000000e+00, 4.93850663e+06, -1.67204791e+03};
273  const Scalar cea_O2_a1[10] = {-3.42556269e+04, 4.84699986e+02, 1.11901159e+00, 4.29388743e-03, -6.83627313e-07,
274  -2.02337478e-09, 1.03904064e-12, 0.00000000e+00, -3.39145434e+03, 1.84969912e+01};
275  const Scalar cea_O2_a2[10] = {-1.03793994e+06, 2.34483275e+03, 1.81972949e+00, 1.26784887e-03, -2.18807142e-07,
276  2.05372411e-11, -8.19349062e-16, 0.00000000e+00, -1.68901253e+04, 1.73871835e+01};
277  const Scalar cea_O2_a3[10] = { 4.97515261e+08, -2.86602339e+05, 6.69015464e+01, -6.16971869e-03, 3.01623757e-07,
278  -7.42087888e-12, 7.27744063e-17, 0.00000000e+00, 2.29348755e+06, -5.53044968e+02};
279  const Scalar cea_OH_a1[10] = {-1.99886366e+03, 9.30014295e+01, 3.05085385e+00, 1.52953035e-03, -3.15789256e-06,
280  3.31544734e-09, -1.13876303e-12, 0.00000000e+00, 3.24004397e+03, 4.67411290e+00};
281  const Scalar cea_OH_a2[10] = { 1.01739349e+06, -2.50995748e+03, 5.11654809e+00, 1.30529875e-04, -8.28431902e-08,
282  2.00647550e-11, -1.55699342e-15, 0.00000000e+00, 2.04452334e+04, -1.10128250e+01};
283  const Scalar cea_OH_a3[10] = { 2.84724229e+08, -1.85953704e+05, 5.00825057e+01, -5.14238586e-03, 2.87554326e-07,
284  -8.22883906e-12, 9.56725603e-17, 0.00000000e+00, 1.46864630e+06, -4.02356407e+02};
285  const Scalar cea_O_a1[10] = {-7.95361130e+03, 1.60717779e+02, 1.96622644e+00, 1.01367031e-03, -1.11041542e-06,
286  6.51750750e-10, -1.58477925e-13, 0.00000000e+00, 2.84036244e+04, 8.40424182e+00};
287  const Scalar cea_O_a2[10] = { 2.61902026e+05, -7.29872203e+02, 3.31717727e+00, -4.28133436e-04, 1.03610459e-07,
288  -9.43830433e-12, 2.72503830e-16, 0.00000000e+00, 3.39242806e+04, -6.67958535e-01};
289  const Scalar cea_O_a3[10] = { 1.77900426e+08, -1.08232826e+05, 2.81077837e+01, -2.97523226e-03, 1.85499753e-07,
290  -5.79623154e-12, 7.19172016e-17, 0.00000000e+00, 8.89094263e+05, -2.18172815e+02};
291  const Scalar cea_H2_a1[10] = { 4.07832281e+04, -8.00918545e+02, 8.21470167e+00, -1.26971436e-02, 1.75360493e-05,
292  -1.20286016e-08, 3.36809316e-12, 0.00000000e+00, 2.68248438e+03, -3.04378866e+01};
293  const Scalar cea_H2_a2[10] = { 5.60812338e+05, -8.37149134e+02, 2.97536304e+00, 1.25224993e-03, -3.74071842e-07,
294  5.93662825e-11, -3.60699573e-15, 0.00000000e+00, 5.33981585e+03, -2.20276405e+00};
295  const Scalar cea_H2_a3[10] = { 4.96671613e+08, -3.14744812e+05, 7.98388750e+01, -8.41450419e-03, 4.75306044e-07,
296  -1.37180973e-11, 1.60537460e-16, 0.00000000e+00, 2.48835466e+06, -6.69552419e+02};
297 
298  const Scalar nasa_N2_a2[7] = { 0.02926640E+02, 0.14879768E-02, -0.05684760E-05, 0.10097038E-09, -0.06753351E-13,
299  -0.09227977E+04, 0.05980528E+02};
300  const Scalar nasa_N2_a1[7] = { 0.03298677E+02, 0.14082404E-02, -0.03963222E-04, 0.05641515E-07, -0.02444854E-10,
301  -0.10208999E+04, 0.03950372E+02};
302  const Scalar nasa_O2_a2[7] = { 3.28253784E+00, 1.48308754E-03, -7.57966669E-07, 2.09470555E-10, -2.16717794E-14,
303  -1.08845772E+03, 5.45323129E+00};
304  const Scalar nasa_O2_a1[7] = { 3.78245636E+00, -2.99673416E-03, 9.84730201E-06, -9.68129509E-09, 3.24372837E-12,
305  -1.06394356E+03, 3.65767573E+00};
306  const Scalar nasa_OH_a2[7] = { 3.09288767E+00, 5.48429716E-04, 1.26505228E-07, -8.79461556E-11, 1.17412376E-14,
307  3.85865700E+03, 4.47669610E+00};
308  const Scalar nasa_OH_a1[7] = { 3.99201543E+00, -2.40131752E-03, 4.61793841E-06, -3.88113333E-09, 1.36411470E-12,
309  3.61508056E+03, -1.03925458E-01};
310  const Scalar nasa_O_a2[7] = { 2.56942078E+00, -8.59741137E-05, 4.19484589E-08, -1.00177799E-11, 1.22833691E-15,
311  2.92175791E+04, 4.78433864E+00};
312  const Scalar nasa_O_a1[7] = { 3.16826710E+00, -3.27931884E-03, 6.64306396E-06, -6.12806624E-09, 2.11265971E-12,
313  2.91222592E+04, 2.05193346E+00};
314  const Scalar nasa_H2_a2[7] = { 3.33727920E+00, -4.94024731E-05, 4.99456778E-07, -1.79566394E-10, 2.00255376E-14,
315  -9.50158922E+02, -3.20502331E+00};
316  const Scalar nasa_H2_a1[7] = { 2.34433112E+00, 7.98052075E-03, -1.94781510E-05, 2.01572094E-08, -7.37611761E-12,
317  -9.17935173E+02, 6.83010238E-01};
318 
319  int return_flag = 0;
320 
321 
322  // Test N2 cp
323  {
324  unsigned int index = 0;
325 
326 // CEA
327  const Scalar cea_cp_N2_1 = R_N2*cea_cp( T1, cea_N2_a1[0], cea_N2_a1[1], cea_N2_a1[2], cea_N2_a1[3], cea_N2_a1[4], cea_N2_a1[5], cea_N2_a1[6]);
328 
329  const Scalar cea_cp_N2_2 = R_N2*cea_cp( T2, cea_N2_a2[0], cea_N2_a2[1], cea_N2_a2[2], cea_N2_a2[3], cea_N2_a2[4], cea_N2_a2[5], cea_N2_a2[6]);
330 
331  const Scalar cea_cp_N2_3 = R_N2*cea_cp( T3, cea_N2_a3[0], cea_N2_a3[1], cea_N2_a3[2], cea_N2_a3[3], cea_N2_a3[4], cea_N2_a3[5], cea_N2_a3[6]);
332 
333  const Antioch::Species species = chem_mixture.species_list()[index];
334  const std::string species_name = chem_mixture.species_inverse_name_map().find(species)->second;
335 
336  int return_flag_temp = 0;
337 
338  return_flag_temp = test_cp( species_name, index, cea_cp_N2_1, T1, thermo );
339  if( return_flag_temp != 0 ) return_flag = 1;
340 
341  return_flag_temp = test_cp( species_name, index, cea_cp_N2_2, T2, thermo );
342  if( return_flag_temp != 0 ) return_flag = 1;
343 
344  return_flag_temp = test_cp( species_name, index, cea_cp_N2_3, T3, thermo );
345  if( return_flag_temp != 0 ) return_flag = 1;
346 
347 
348 // NASA [300 - 1000] [1000 - 5000]
349 
350  const Scalar nasa_cp_N2_1 = R_N2 * nasa_cp(T4, nasa_N2_a1[0], nasa_N2_a1[1], nasa_N2_a1[2], nasa_N2_a1[3], nasa_N2_a1[4]);
351 
352  const Scalar nasa_cp_N2_2 = R_N2 * nasa_cp(T2, nasa_N2_a2[0], nasa_N2_a2[1], nasa_N2_a2[2], nasa_N2_a2[3], nasa_N2_a2[4]);
353 
354  return_flag_temp = test_cp( species_name, index, nasa_cp_N2_1, T4, nasa_thermo );
355  if( return_flag_temp != 0 ) return_flag = 1;
356 
357  return_flag_temp = test_cp( species_name, index, nasa_cp_N2_2, T2, nasa_thermo );
358  if( return_flag_temp != 0 ) return_flag = 1;
359 
360  }
361 
362  // Test O2 cp
363  {
364  unsigned int index = 1;
365  const Scalar cp_1 = R_O2*cea_cp( T1, cea_O2_a1[0], cea_O2_a1[1], cea_O2_a1[2], cea_O2_a1[3], cea_O2_a1[4], cea_O2_a1[5], cea_O2_a1[6]);
366 
367  const Scalar cp_2 = R_O2*cea_cp( T2, cea_O2_a2[0], cea_O2_a2[1], cea_O2_a2[2], cea_O2_a2[3], cea_O2_a2[4], cea_O2_a2[5], cea_O2_a2[6]);
368 
369  const Scalar cp_3 = R_O2*cea_cp( T3, cea_O2_a3[0], cea_O2_a3[1], cea_O2_a3[2], cea_O2_a3[3], cea_O2_a3[4], cea_O2_a3[5], cea_O2_a3[6]);
370 
371  const Antioch::Species species = chem_mixture.species_list()[index];
372  const std::string species_name = chem_mixture.species_inverse_name_map().find(species)->second;
373 
374  int return_flag_temp = 0;
375  return_flag_temp = test_cp( species_name, index, cp_1, T1, thermo );
376  if( return_flag_temp != 0 ) return_flag = 1;
377 
378  return_flag_temp = test_cp( species_name, index, cp_2, T2, thermo );
379  if( return_flag_temp != 0 ) return_flag = 1;
380 
381  return_flag_temp = test_cp( species_name, index, cp_3, T3, thermo );
382  if( return_flag_temp != 0 ) return_flag = 1;
383 
384 // NASA [300 - 1000] [1000 - 5000]
385  const Scalar nasa_cp_O2_1 = R_O2 * nasa_cp(T4, nasa_O2_a1[0], nasa_O2_a1[1], nasa_O2_a1[2], nasa_O2_a1[3], nasa_O2_a1[4]);
386 
387  const Scalar nasa_cp_O2_2 = R_O2 * nasa_cp(T2, nasa_O2_a2[0], nasa_O2_a2[1], nasa_O2_a2[2], nasa_O2_a2[3], nasa_O2_a2[4]);
388 
389  return_flag_temp = test_cp( species_name, index, nasa_cp_O2_1, T4, nasa_thermo );
390  if( return_flag_temp != 0 ) return_flag = 1;
391 
392  return_flag_temp = test_cp( species_name, index, nasa_cp_O2_2, T2, nasa_thermo );
393  if( return_flag_temp != 0 ) return_flag = 1;
394  }
395 
396  // Test OH cp
397  {
398  unsigned int index = 2;
399  const Scalar cp_1 = R_OH*cea_cp( T1, cea_OH_a1[0], cea_OH_a1[1], cea_OH_a1[2], cea_OH_a1[3], cea_OH_a1[4], cea_OH_a1[5], cea_OH_a1[6]);
400 
401  const Scalar cp_2 = R_OH*cea_cp( T2, cea_OH_a2[0], cea_OH_a2[1], cea_OH_a2[2], cea_OH_a2[3], cea_OH_a2[4], cea_OH_a2[5], cea_OH_a2[6]);
402 
403  const Scalar cp_3 = R_OH*cea_cp( T3, cea_OH_a3[0], cea_OH_a3[1], cea_OH_a3[2], cea_OH_a3[3], cea_OH_a3[4], cea_OH_a3[5], cea_OH_a3[6]);
404 
405  const Antioch::Species species = chem_mixture.species_list()[index];
406  const std::string species_name = chem_mixture.species_inverse_name_map().find(species)->second;
407 
408  int return_flag_temp = 0;
409  return_flag_temp = test_cp( species_name, index, cp_1, T1, thermo );
410  if( return_flag_temp != 0 ) return_flag = 1;
411 
412  return_flag_temp = test_cp( species_name, index, cp_2, T2, thermo );
413  if( return_flag_temp != 0 ) return_flag = 1;
414 
415  return_flag_temp = test_cp( species_name, index, cp_3, T3, thermo );
416  if( return_flag_temp != 0 ) return_flag = 1;
417 
418 // NASA [300 - 1000] [1000 - 5000]
419  const Scalar nasa_cp_OH_1 = R_OH * nasa_cp(T4, nasa_OH_a1[0], nasa_OH_a1[1], nasa_OH_a1[2], nasa_OH_a1[3], nasa_OH_a1[4]);
420 
421  const Scalar nasa_cp_OH_2 = R_OH * nasa_cp(T2, nasa_OH_a2[0], nasa_OH_a2[1], nasa_OH_a2[2], nasa_OH_a2[3], nasa_OH_a2[4]);
422 
423  return_flag_temp = test_cp( species_name, index, nasa_cp_OH_1, T4, nasa_thermo );
424  if( return_flag_temp != 0 ) return_flag = 1;
425 
426  return_flag_temp = test_cp( species_name, index, nasa_cp_OH_2, T2, nasa_thermo );
427  }
428 
429 
430  // Test O cp
431  {
432  unsigned int index = 3;
433  const Scalar cp_1 = R_O*cea_cp( T1, cea_O_a1[0], cea_O_a1[1], cea_O_a1[2], cea_O_a1[3], cea_O_a1[4], cea_O_a1[5], cea_O_a1[6]);
434 
435  const Scalar cp_2 = R_O*cea_cp( T2, cea_O_a2[0], cea_O_a2[1], cea_O_a2[2], cea_O_a2[3], cea_O_a2[4], cea_O_a2[5], cea_O_a2[6]);
436 
437  const Scalar cp_3 = R_O*cea_cp( T3, cea_O_a3[0], cea_O_a3[1], cea_O_a3[2], cea_O_a3[3], cea_O_a3[4], cea_O_a3[5], cea_O_a3[6]);
438 
439  const Antioch::Species species = chem_mixture.species_list()[index];
440  const std::string species_name = chem_mixture.species_inverse_name_map().find(species)->second;
441 
442  int return_flag_temp = 0;
443  return_flag_temp = test_cp( species_name, index, cp_1, T1, thermo );
444  if( return_flag_temp != 0 ) return_flag = 1;
445 
446  return_flag_temp = test_cp( species_name, index, cp_2, T2, thermo );
447  if( return_flag_temp != 0 ) return_flag = 1;
448 
449  return_flag_temp = test_cp( species_name, index, cp_3, T3, thermo );
450  if( return_flag_temp != 0 ) return_flag = 1;
451 
452 // NASA [300 - 1000] [1000 - 5000]
453  const Scalar nasa_cp_O_1 = R_O * nasa_cp(T4, nasa_O_a1[0], nasa_O_a1[1], nasa_O_a1[2], nasa_O_a1[3], nasa_O_a1[4]);
454 
455  const Scalar nasa_cp_O_2 = R_O * nasa_cp(T2, nasa_O_a2[0], nasa_O_a2[1], nasa_O_a2[2], nasa_O_a2[3], nasa_O_a2[4]);
456 
457  return_flag_temp = test_cp( species_name, index, nasa_cp_O_1, T4, nasa_thermo );
458  if( return_flag_temp != 0 ) return_flag = 1;
459 
460  return_flag_temp = test_cp( species_name, index, nasa_cp_O_2, T2, nasa_thermo );
461  }
462 
463 
464  // Test H2 cp
465  {
466  unsigned int index = 4;
467  const Scalar cp_1 = R_H2*cea_cp( T1, cea_H2_a1[0], cea_H2_a1[1], cea_H2_a1[2], cea_H2_a1[3], cea_H2_a1[4], cea_H2_a1[5], cea_H2_a1[6]);
468 
469  const Scalar cp_2 = R_H2*cea_cp( T2, cea_H2_a2[0], cea_H2_a2[1], cea_H2_a2[2], cea_H2_a2[3], cea_H2_a2[4], cea_H2_a2[5], cea_H2_a2[6]);
470 
471  const Scalar cp_3 = R_H2*cea_cp( T3, cea_H2_a3[0], cea_H2_a3[1], cea_H2_a3[2], cea_H2_a3[3], cea_H2_a3[4], cea_H2_a3[5], cea_H2_a3[6]);
472 
473  const Antioch::Species species = chem_mixture.species_list()[index];
474  const std::string species_name = chem_mixture.species_inverse_name_map().find(species)->second;
475 
476  int return_flag_temp = 0;
477  return_flag_temp = test_cp( species_name, index, cp_1, T1, thermo );
478  if( return_flag_temp != 0 ) return_flag = 1;
479 
480  return_flag_temp = test_cp( species_name, index, cp_2, T2, thermo );
481  if( return_flag_temp != 0 ) return_flag = 1;
482 
483  return_flag_temp = test_cp( species_name, index, cp_3, T3, thermo );
484  if( return_flag_temp != 0 ) return_flag = 1;
485 
486 
487 // NASA [300 - 1000] [1000 - 5000]
488  const Scalar nasa_cp_H2_1 = R_H2 * nasa_cp(T4, nasa_H2_a1[0], nasa_H2_a1[1], nasa_H2_a1[2], nasa_H2_a1[3], nasa_H2_a1[4]);
489 
490  const Scalar nasa_cp_H2_2 = R_H2 * nasa_cp(T2, nasa_H2_a2[0], nasa_H2_a2[1], nasa_H2_a2[2], nasa_H2_a2[3], nasa_H2_a2[4]);
491 
492  return_flag_temp = test_cp( species_name, index, nasa_cp_H2_1, T4, nasa_thermo );
493  if( return_flag_temp != 0 ) return_flag = 1;
494 
495  return_flag_temp = test_cp( species_name, index, nasa_cp_H2_2, T2, nasa_thermo );
496  if( return_flag_temp != 0 ) return_flag = 1;
497  }
498 
499 // h, s, && g
500 
501 
502  // Test N2 h
503  {
504  unsigned int index = 0;
505  const Scalar h_N2_1 = R_N2 * T1 * cea_h( T1, cea_N2_a1[0], cea_N2_a1[1], cea_N2_a1[2], cea_N2_a1[3], cea_N2_a1[4], cea_N2_a1[5], cea_N2_a1[6],cea_N2_a1[8]);
506  const Scalar s_N2_1 = cea_s( T1, cea_N2_a1[0], cea_N2_a1[1], cea_N2_a1[2], cea_N2_a1[3], cea_N2_a1[4], cea_N2_a1[5], cea_N2_a1[6],cea_N2_a1[9]);
507  const Scalar g_N2_1 = h_N2_1/(R_N2 * T1) - s_N2_1; // h/(R*T) - s/R
508 
509  const Scalar h_N2_2 = R_N2 * T2 * cea_h( T2, cea_N2_a2[0], cea_N2_a2[1], cea_N2_a2[2], cea_N2_a2[3], cea_N2_a2[4], cea_N2_a2[5], cea_N2_a2[6],cea_N2_a2[8]);
510  const Scalar s_N2_2 = cea_s( T2, cea_N2_a2[0], cea_N2_a2[1], cea_N2_a2[2], cea_N2_a2[3], cea_N2_a2[4], cea_N2_a2[5], cea_N2_a2[6],cea_N2_a2[9]);
511  const Scalar g_N2_2 = h_N2_2/(R_N2 * T2) - s_N2_2;
512 
513  const Scalar h_N2_3 = R_N2 * T3 * cea_h( T3, cea_N2_a3[0], cea_N2_a3[1], cea_N2_a3[2], cea_N2_a3[3], cea_N2_a3[4], cea_N2_a3[5], cea_N2_a3[6],cea_N2_a3[8]);
514  const Scalar s_N2_3 = cea_s( T3, cea_N2_a3[0], cea_N2_a3[1], cea_N2_a3[2], cea_N2_a3[3], cea_N2_a3[4], cea_N2_a3[5], cea_N2_a3[6],cea_N2_a3[9]);
515  const Scalar g_N2_3 = h_N2_3 /(R_N2 * T3) - s_N2_3;
516 
517 
518  const Antioch::Species species = chem_mixture.species_list()[index];
519  const std::string species_name = chem_mixture.species_inverse_name_map().find(species)->second;
520 
521  int return_flag_temp = 0;
522  return_flag_temp = test_h( species_name, index, h_N2_1, T1, thermo );
523  if( return_flag_temp != 0 ) return_flag = 1;
524 
525  return_flag_temp = test_h( species_name, index, h_N2_2, T2, thermo );
526  if( return_flag_temp != 0 ) return_flag = 1;
527 
528  return_flag_temp = test_h( species_name, index, h_N2_3, T3, thermo );
529  if( return_flag_temp != 0 ) return_flag = 1;
530 
531  return_flag_temp = test_s( species_name, index, s_N2_1, T1, thermo );
532  if( return_flag_temp != 0 ) return_flag = 1;
533 
534  return_flag_temp = test_s( species_name, index, s_N2_2, T2, thermo );
535  if( return_flag_temp != 0 ) return_flag = 1;
536 
537  return_flag_temp = test_s( species_name, index, s_N2_3, T3, thermo );
538  if( return_flag_temp != 0 ) return_flag = 1;
539 
540  return_flag_temp = test_g( species_name, index, g_N2_1, T1, thermo );
541  if( return_flag_temp != 0 ) return_flag = 1;
542 
543  return_flag_temp = test_g( species_name, index, g_N2_2, T2, thermo );
544  if( return_flag_temp != 0 ) return_flag = 1;
545 
546  return_flag_temp = test_g( species_name, index, g_N2_3, T3, thermo );
547  if( return_flag_temp != 0 ) return_flag = 1;
548 
549 // NASA [300 - 1000] [1000 - 5000]
550  const Scalar nasa_h_N2_1 = R_N2 * T4 * nasa_h(T4, nasa_N2_a1[0], nasa_N2_a1[1], nasa_N2_a1[2], nasa_N2_a1[3], nasa_N2_a1[4], nasa_N2_a1[5]);
551  const Scalar nasa_s_N2_1 = nasa_s(T4, nasa_N2_a1[0], nasa_N2_a1[1], nasa_N2_a1[2], nasa_N2_a1[3], nasa_N2_a1[4], nasa_N2_a1[6]);
552  const Scalar nasa_g_N2_1 = nasa_h_N2_1/(R_N2 * T4) - nasa_s_N2_1;
553 
554  const Scalar nasa_h_N2_2 = R_N2 * T2 * nasa_h(T2, nasa_N2_a2[0], nasa_N2_a2[1], nasa_N2_a2[2], nasa_N2_a2[3], nasa_N2_a2[4], nasa_N2_a2[5]);
555  const Scalar nasa_s_N2_2 = nasa_s(T2, nasa_N2_a2[0], nasa_N2_a2[1], nasa_N2_a2[2], nasa_N2_a2[3], nasa_N2_a2[4], nasa_N2_a2[6]);
556  const Scalar nasa_g_N2_2 = nasa_h_N2_2/(R_N2 * T2) - nasa_s_N2_2;
557 
558  return_flag_temp = test_h( species_name, index, nasa_h_N2_1, T4, nasa_thermo );
559  if( return_flag_temp != 0 ) return_flag = 1;
560 
561  return_flag_temp = test_h( species_name, index, nasa_h_N2_2, T2, nasa_thermo );
562  if( return_flag_temp != 0 ) return_flag = 1;
563 
564  return_flag_temp = test_s( species_name, index, nasa_s_N2_1, T4, nasa_thermo );
565  if( return_flag_temp != 0 ) return_flag = 1;
566 
567  return_flag_temp = test_s( species_name, index, nasa_s_N2_2, T2, nasa_thermo );
568  if( return_flag_temp != 0 ) return_flag = 1;
569 
570  return_flag_temp = test_g( species_name, index, nasa_g_N2_1, T4, nasa_thermo );
571  if( return_flag_temp != 0 ) return_flag = 1;
572 
573  return_flag_temp = test_g( species_name, index, nasa_g_N2_2, T2, nasa_thermo );
574  if( return_flag_temp != 0 ) return_flag = 1;
575 
576  }
577 
578  // Test O2 h
579  {
580  unsigned int index = 1;
581  const Scalar h_1 = R_O2*T1*cea_h( T1, cea_O2_a1[0], cea_O2_a1[1], cea_O2_a1[2], cea_O2_a1[3], cea_O2_a1[4], cea_O2_a1[5], cea_O2_a1[6],cea_O2_a1[8]);
582  const Scalar s_1 = cea_s( T1, cea_O2_a1[0], cea_O2_a1[1], cea_O2_a1[2], cea_O2_a1[3], cea_O2_a1[4], cea_O2_a1[5], cea_O2_a1[6],cea_O2_a1[9]);
583  const Scalar g_1 = h_1/(R_O2*T1) - s_1;
584 
585  const Scalar h_2 = R_O2*T2*cea_h( T2, cea_O2_a2[0], cea_O2_a2[1], cea_O2_a2[2], cea_O2_a2[3], cea_O2_a2[4], cea_O2_a2[5], cea_O2_a2[6],cea_O2_a2[8]);
586  const Scalar s_2 = cea_s( T2, cea_O2_a2[0], cea_O2_a2[1], cea_O2_a2[2], cea_O2_a2[3], cea_O2_a2[4], cea_O2_a2[5], cea_O2_a2[6],cea_O2_a2[9]);
587  const Scalar g_2 = h_2/(R_O2*T2) - s_2;
588 
589  const Scalar h_3 = R_O2*T3*cea_h( T3, cea_O2_a3[0], cea_O2_a3[1], cea_O2_a3[2], cea_O2_a3[3], cea_O2_a3[4], cea_O2_a3[5], cea_O2_a3[6],cea_O2_a3[8]);
590  const Scalar s_3 = cea_s( T3, cea_O2_a3[0], cea_O2_a3[1], cea_O2_a3[2], cea_O2_a3[3], cea_O2_a3[4], cea_O2_a3[5], cea_O2_a3[6],cea_O2_a3[9]);
591  const Scalar g_3 = h_3/(R_O2*T3) - s_3;
592 
593  const Antioch::Species species = chem_mixture.species_list()[index];
594  const std::string species_name = chem_mixture.species_inverse_name_map().find(species)->second;
595 
596  int return_flag_temp = 0;
597  return_flag_temp = test_h( species_name, index, h_1, T1, thermo );
598  if( return_flag_temp != 0 ) return_flag = 1;
599 
600  return_flag_temp = test_h( species_name, index, h_2, T2, thermo );
601  if( return_flag_temp != 0 ) return_flag = 1;
602 
603  return_flag_temp = test_h( species_name, index, h_3, T3, thermo );
604  if( return_flag_temp != 0 ) return_flag = 1;
605 
606  return_flag_temp = test_s( species_name, index, s_1, T1, thermo );
607  if( return_flag_temp != 0 ) return_flag = 1;
608 
609  return_flag_temp = test_s( species_name, index, s_2, T2, thermo );
610  if( return_flag_temp != 0 ) return_flag = 1;
611 
612  return_flag_temp = test_s( species_name, index, s_3, T3, thermo );
613  if( return_flag_temp != 0 ) return_flag = 1;
614 
615  return_flag_temp = test_g( species_name, index, g_1, T1, thermo );
616  if( return_flag_temp != 0 ) return_flag = 1;
617 
618  return_flag_temp = test_g( species_name, index, g_2, T2, thermo );
619  if( return_flag_temp != 0 ) return_flag = 1;
620 
621  return_flag_temp = test_g( species_name, index, g_3, T3, thermo );
622  if( return_flag_temp != 0 ) return_flag = 1;
623 
624 // NASA [300 - 1000] [1000 - 5000]
625  const Scalar nasa_h_O2_1 = R_O2 * T4 * nasa_h(T4, nasa_O2_a1[0], nasa_O2_a1[1], nasa_O2_a1[2], nasa_O2_a1[3], nasa_O2_a1[4], nasa_O2_a1[5]);
626  const Scalar nasa_s_O2_1 = nasa_s(T4, nasa_O2_a1[0], nasa_O2_a1[1], nasa_O2_a1[2], nasa_O2_a1[3], nasa_O2_a1[4], nasa_O2_a1[6]);
627  const Scalar nasa_g_O2_1 = nasa_h_O2_1/(R_O2*T4) - nasa_s_O2_1;
628 
629  const Scalar nasa_h_O2_2 = R_O2 * T2 * nasa_h(T2, nasa_O2_a2[0], nasa_O2_a2[1], nasa_O2_a2[2], nasa_O2_a2[3], nasa_O2_a2[4], nasa_O2_a2[5]);
630  const Scalar nasa_s_O2_2 = nasa_s(T2, nasa_O2_a2[0], nasa_O2_a2[1], nasa_O2_a2[2], nasa_O2_a2[3], nasa_O2_a2[4], nasa_O2_a2[6]);
631  const Scalar nasa_g_O2_2 = nasa_h_O2_2/(R_O2*T2) - nasa_s_O2_2;
632 
633  return_flag_temp = test_h( species_name, index, nasa_h_O2_1, T4, nasa_thermo );
634  if( return_flag_temp != 0 ) return_flag = 1;
635 
636  return_flag_temp = test_h( species_name, index, nasa_h_O2_2, T2, nasa_thermo );
637  if( return_flag_temp != 0 ) return_flag = 1;
638 
639  return_flag_temp = test_s( species_name, index, nasa_s_O2_1, T4, nasa_thermo );
640  if( return_flag_temp != 0 ) return_flag = 1;
641 
642  return_flag_temp = test_s( species_name, index, nasa_s_O2_2, T2, nasa_thermo );
643  if( return_flag_temp != 0 ) return_flag = 1;
644 
645  return_flag_temp = test_g( species_name, index, nasa_g_O2_1, T4, nasa_thermo );
646  if( return_flag_temp != 0 ) return_flag = 1;
647 
648  return_flag_temp = test_g( species_name, index, nasa_g_O2_2, T2, nasa_thermo );
649  if( return_flag_temp != 0 ) return_flag = 1;
650 
651  }
652 
653  // Test OH h
654  {
655  unsigned int index = 2;
656  const Scalar h_1 = R_OH*T1*cea_h( T1, cea_OH_a1[0], cea_OH_a1[1], cea_OH_a1[2], cea_OH_a1[3], cea_OH_a1[4], cea_OH_a1[5], cea_OH_a1[6],cea_OH_a1[8]);
657  const Scalar s_1 = cea_s( T1, cea_OH_a1[0], cea_OH_a1[1], cea_OH_a1[2], cea_OH_a1[3], cea_OH_a1[4], cea_OH_a1[5], cea_OH_a1[6],cea_OH_a1[9]);
658  const Scalar g_1 = h_1/(R_OH*T1) - s_1;
659 
660  const Scalar h_2 = R_OH*T2*cea_h( T2, cea_OH_a2[0], cea_OH_a2[1], cea_OH_a2[2], cea_OH_a2[3], cea_OH_a2[4], cea_OH_a2[5], cea_OH_a2[6],cea_OH_a2[8]);
661  const Scalar s_2 = cea_s( T2, cea_OH_a2[0], cea_OH_a2[1], cea_OH_a2[2], cea_OH_a2[3], cea_OH_a2[4], cea_OH_a2[5], cea_OH_a2[6],cea_OH_a2[9]);
662  const Scalar g_2 = h_2/(R_OH*T2) - s_2;
663 
664  const Scalar h_3 = R_OH*T3*cea_h( T3, cea_OH_a3[0], cea_OH_a3[1], cea_OH_a3[2], cea_OH_a3[3], cea_OH_a3[4], cea_OH_a3[5], cea_OH_a3[6],cea_OH_a3[8]);
665  const Scalar s_3 = cea_s( T3, cea_OH_a3[0], cea_OH_a3[1], cea_OH_a3[2], cea_OH_a3[3], cea_OH_a3[4], cea_OH_a3[5], cea_OH_a3[6],cea_OH_a3[9]);
666  const Scalar g_3 = h_3/(R_OH*T3) - s_3;
667 
668  const Antioch::Species species = chem_mixture.species_list()[index];
669  const std::string species_name = chem_mixture.species_inverse_name_map().find(species)->second;
670 
671  int return_flag_temp = 0;
672  return_flag_temp = test_h( species_name, index, h_1, T1, thermo );
673  if( return_flag_temp != 0 ) return_flag = 1;
674 
675  return_flag_temp = test_h( species_name, index, h_2, T2, thermo );
676  if( return_flag_temp != 0 ) return_flag = 1;
677 
678  return_flag_temp = test_h( species_name, index, h_3, T3, thermo );
679  if( return_flag_temp != 0 ) return_flag = 1;
680 
681  return_flag_temp = test_s( species_name, index, s_1, T1, thermo );
682  if( return_flag_temp != 0 ) return_flag = 1;
683 
684  return_flag_temp = test_s( species_name, index, s_2, T2, thermo );
685  if( return_flag_temp != 0 ) return_flag = 1;
686 
687  return_flag_temp = test_s( species_name, index, s_3, T3, thermo );
688  if( return_flag_temp != 0 ) return_flag = 1;
689 
690  return_flag_temp = test_g( species_name, index, g_1, T1, thermo );
691  if( return_flag_temp != 0 ) return_flag = 1;
692 
693  return_flag_temp = test_g( species_name, index, g_2, T2, thermo );
694  if( return_flag_temp != 0 ) return_flag = 1;
695 
696  return_flag_temp = test_g( species_name, index, g_3, T3, thermo );
697  if( return_flag_temp != 0 ) return_flag = 1;
698 
699 // NASA [300 - 1000] [1000 - 5000]
700  const Scalar nasa_h_OH_1 = R_OH * T4 * nasa_h(T4, nasa_OH_a1[0], nasa_OH_a1[1], nasa_OH_a1[2], nasa_OH_a1[3], nasa_OH_a1[4], nasa_OH_a1[5]);
701  const Scalar nasa_s_OH_1 = nasa_s(T4, nasa_OH_a1[0], nasa_OH_a1[1], nasa_OH_a1[2], nasa_OH_a1[3], nasa_OH_a1[4], nasa_OH_a1[6]);
702  const Scalar nasa_g_OH_1 = nasa_h_OH_1/(R_OH*T4) - nasa_s_OH_1;
703 
704  const Scalar nasa_h_OH_2 = R_OH * T2 * nasa_h(T2, nasa_OH_a2[0], nasa_OH_a2[1], nasa_OH_a2[2], nasa_OH_a2[3], nasa_OH_a2[4], nasa_OH_a2[5]);
705  const Scalar nasa_s_OH_2 = nasa_s(T2, nasa_OH_a2[0], nasa_OH_a2[1], nasa_OH_a2[2], nasa_OH_a2[3], nasa_OH_a2[4], nasa_OH_a2[6]);
706  const Scalar nasa_g_OH_2 = nasa_h_OH_2/(R_OH*T2) - nasa_s_OH_2;
707 
708  return_flag_temp = test_h( species_name, index, nasa_h_OH_1, T4, nasa_thermo );
709  if( return_flag_temp != 0 ) return_flag = 1;
710 
711  return_flag_temp = test_h( species_name, index, nasa_h_OH_2, T2, nasa_thermo );
712  if( return_flag_temp != 0 ) return_flag = 1;
713 
714  return_flag_temp = test_s( species_name, index, nasa_s_OH_1, T4, nasa_thermo );
715  if( return_flag_temp != 0 ) return_flag = 1;
716 
717  return_flag_temp = test_s( species_name, index, nasa_s_OH_2, T2, nasa_thermo );
718  if( return_flag_temp != 0 ) return_flag = 1;
719 
720  return_flag_temp = test_g( species_name, index, nasa_g_OH_1, T4, nasa_thermo );
721  if( return_flag_temp != 0 ) return_flag = 1;
722 
723  return_flag_temp = test_g( species_name, index, nasa_g_OH_2, T2, nasa_thermo );
724  if( return_flag_temp != 0 ) return_flag = 1;
725  }
726 
727  // Test O h
728  {
729  unsigned int index = 3;
730  const Scalar h_1 = R_O*T1*cea_h( T1, cea_O_a1[0], cea_O_a1[1], cea_O_a1[2], cea_O_a1[3], cea_O_a1[4], cea_O_a1[5], cea_O_a1[6],cea_O_a1[8]);
731  const Scalar s_1 = cea_s( T1, cea_O_a1[0], cea_O_a1[1], cea_O_a1[2], cea_O_a1[3], cea_O_a1[4], cea_O_a1[5], cea_O_a1[6],cea_O_a1[9]);
732  const Scalar g_1 = h_1/(R_O*T1) - s_1;
733 
734  const Scalar h_2 = R_O*T2*cea_h( T2, cea_O_a2[0], cea_O_a2[1], cea_O_a2[2], cea_O_a2[3], cea_O_a2[4], cea_O_a2[5], cea_O_a2[6],cea_O_a2[8]);
735  const Scalar s_2 = cea_s( T2, cea_O_a2[0], cea_O_a2[1], cea_O_a2[2], cea_O_a2[3], cea_O_a2[4], cea_O_a2[5], cea_O_a2[6],cea_O_a2[9]);
736  const Scalar g_2 = h_2/(R_O*T2) - s_2;
737 
738  const Scalar h_3 = R_O*T3*cea_h( T3, cea_O_a3[0], cea_O_a3[1], cea_O_a3[2], cea_O_a3[3], cea_O_a3[4], cea_O_a3[5], cea_O_a3[6],cea_O_a3[8]);
739  const Scalar s_3 = cea_s( T3, cea_O_a3[0], cea_O_a3[1], cea_O_a3[2], cea_O_a3[3], cea_O_a3[4], cea_O_a3[5], cea_O_a3[6],cea_O_a3[9]);
740  const Scalar g_3 = h_3/(R_O*T3) - s_3;
741 
742  const Antioch::Species species = chem_mixture.species_list()[index];
743  const std::string species_name = chem_mixture.species_inverse_name_map().find(species)->second;
744 
745  int return_flag_temp = 0;
746  return_flag_temp = test_h( species_name, index, h_1, T1, thermo );
747  if( return_flag_temp != 0 ) return_flag = 1;
748 
749  return_flag_temp = test_h( species_name, index, h_2, T2, thermo );
750  if( return_flag_temp != 0 ) return_flag = 1;
751 
752  return_flag_temp = test_h( species_name, index, h_3, T3, thermo );
753  if( return_flag_temp != 0 ) return_flag = 1;
754 
755  return_flag_temp = test_s( species_name, index, s_1, T1, thermo );
756  if( return_flag_temp != 0 ) return_flag = 1;
757 
758  return_flag_temp = test_s( species_name, index, s_2, T2, thermo );
759  if( return_flag_temp != 0 ) return_flag = 1;
760 
761  return_flag_temp = test_s( species_name, index, s_3, T3, thermo );
762  if( return_flag_temp != 0 ) return_flag = 1;
763 
764  return_flag_temp = test_g( species_name, index, g_1, T1, thermo );
765  if( return_flag_temp != 0 ) return_flag = 1;
766 
767  return_flag_temp = test_g( species_name, index, g_2, T2, thermo );
768  if( return_flag_temp != 0 ) return_flag = 1;
769 
770  return_flag_temp = test_g( species_name, index, g_3, T3, thermo );
771  if( return_flag_temp != 0 ) return_flag = 1;
772 
773 // NASA [300 - 1000] [1000 - 5000]
774  const Scalar nasa_h_O_1 = R_O * T4 * nasa_h(T4, nasa_O_a1[0], nasa_O_a1[1], nasa_O_a1[2], nasa_O_a1[3], nasa_O_a1[4], nasa_O_a1[5]);
775  const Scalar nasa_s_O_1 = nasa_s(T4, nasa_O_a1[0], nasa_O_a1[1], nasa_O_a1[2], nasa_O_a1[3], nasa_O_a1[4], nasa_O_a1[6]);
776  const Scalar nasa_g_O_1 = nasa_h_O_1/(R_O*T4) - nasa_s_O_1;
777 
778  const Scalar nasa_h_O_2 = R_O * T2 * nasa_h(T2, nasa_O_a2[0], nasa_O_a2[1], nasa_O_a2[2], nasa_O_a2[3], nasa_O_a2[4], nasa_O_a2[5]);
779  const Scalar nasa_s_O_2 = nasa_s(T2, nasa_O_a2[0], nasa_O_a2[1], nasa_O_a2[2], nasa_O_a2[3], nasa_O_a2[4], nasa_O_a2[6]);
780  const Scalar nasa_g_O_2 = nasa_h_O_2/(R_O*T2) - nasa_s_O_2;
781 
782  return_flag_temp = test_h( species_name, index, nasa_h_O_1, T4, nasa_thermo );
783  if( return_flag_temp != 0 ) return_flag = 1;
784 
785  return_flag_temp = test_h( species_name, index, nasa_h_O_2, T2, nasa_thermo );
786  if( return_flag_temp != 0 ) return_flag = 1;
787 
788  return_flag_temp = test_s( species_name, index, nasa_s_O_1, T4, nasa_thermo );
789  if( return_flag_temp != 0 ) return_flag = 1;
790 
791  return_flag_temp = test_s( species_name, index, nasa_s_O_2, T2, nasa_thermo );
792  if( return_flag_temp != 0 ) return_flag = 1;
793 
794  return_flag_temp = test_g( species_name, index, nasa_g_O_1, T4, nasa_thermo );
795  if( return_flag_temp != 0 ) return_flag = 1;
796 
797  return_flag_temp = test_g( species_name, index, nasa_g_O_2, T2, nasa_thermo );
798  if( return_flag_temp != 0 ) return_flag = 1;
799  }
800 
801  // Test H2 h
802  {
803  unsigned int index = 4;
804  const Scalar h_1 = R_H2*T1*cea_h( T1, cea_H2_a1[0], cea_H2_a1[1], cea_H2_a1[2], cea_H2_a1[3], cea_H2_a1[4], cea_H2_a1[5], cea_H2_a1[6],cea_H2_a1[8]);
805  const Scalar s_1 = cea_s( T1, cea_H2_a1[0], cea_H2_a1[1], cea_H2_a1[2], cea_H2_a1[3], cea_H2_a1[4], cea_H2_a1[5], cea_H2_a1[6],cea_H2_a1[9]);
806  const Scalar g_1 = h_1/(R_H2*T1) - s_1;
807 
808  const Scalar h_2 = R_H2*T2*cea_h( T2, cea_H2_a2[0], cea_H2_a2[1], cea_H2_a2[2], cea_H2_a2[3], cea_H2_a2[4], cea_H2_a2[5], cea_H2_a2[6],cea_H2_a2[8]);
809  const Scalar s_2 = cea_s( T2, cea_H2_a2[0], cea_H2_a2[1], cea_H2_a2[2], cea_H2_a2[3], cea_H2_a2[4], cea_H2_a2[5], cea_H2_a2[6],cea_H2_a2[9]);
810  const Scalar g_2 = h_2/(R_H2*T2) - s_2;
811 
812  const Scalar h_3 = R_H2*T3*cea_h( T3, cea_H2_a3[0], cea_H2_a3[1], cea_H2_a3[2], cea_H2_a3[3], cea_H2_a3[4], cea_H2_a3[5], cea_H2_a3[6],cea_H2_a3[8]);
813  const Scalar s_3 = cea_s( T3, cea_H2_a3[0], cea_H2_a3[1], cea_H2_a3[2], cea_H2_a3[3], cea_H2_a3[4], cea_H2_a3[5], cea_H2_a3[6],cea_H2_a3[9]);
814  const Scalar g_3 = h_3/(R_H2*T3) - s_3;
815 
816  const Antioch::Species species = chem_mixture.species_list()[index];
817  const std::string species_name = chem_mixture.species_inverse_name_map().find(species)->second;
818 
819  int return_flag_temp = 0;
820  return_flag_temp = test_h( species_name, index, h_1, T1, thermo );
821  if( return_flag_temp != 0 ) return_flag = 1;
822 
823  return_flag_temp = test_h( species_name, index, h_2, T2, thermo );
824  if( return_flag_temp != 0 ) return_flag = 1;
825 
826  return_flag_temp = test_h( species_name, index, h_3, T3, thermo );
827  if( return_flag_temp != 0 ) return_flag = 1;
828 
829  return_flag_temp = test_s( species_name, index, s_1, T1, thermo );
830  if( return_flag_temp != 0 ) return_flag = 1;
831 
832  return_flag_temp = test_s( species_name, index, s_2, T2, thermo );
833  if( return_flag_temp != 0 ) return_flag = 1;
834 
835  return_flag_temp = test_s( species_name, index, s_3, T3, thermo );
836  if( return_flag_temp != 0 ) return_flag = 1;
837 
838  return_flag_temp = test_g( species_name, index, g_1, T1, thermo );
839  if( return_flag_temp != 0 ) return_flag = 1;
840 
841  return_flag_temp = test_g( species_name, index, g_2, T2, thermo );
842  if( return_flag_temp != 0 ) return_flag = 1;
843 
844  return_flag_temp = test_g( species_name, index, g_3, T3, thermo );
845  if( return_flag_temp != 0 ) return_flag = 1;
846 
847 return return_flag;
848 
849 // NASA [300 - 1000] [1000 - 5000]
850  const Scalar nasa_h_H2_1 = R_H2 * T4 * nasa_h(T4, nasa_H2_a1[0], nasa_H2_a1[1], nasa_H2_a1[2], nasa_H2_a1[3], nasa_H2_a1[4], nasa_H2_a1[5]);
851  const Scalar nasa_s_H2_1 = nasa_s(T4, nasa_H2_a1[0], nasa_H2_a1[1], nasa_H2_a1[2], nasa_H2_a1[3], nasa_H2_a1[4], nasa_H2_a1[6]);
852  const Scalar nasa_g_H2_1 = nasa_h_H2_1/(R_H2 * T4) - nasa_s_H2_1;
853 
854  const Scalar nasa_h_H2_2 = R_H2 * T2 * nasa_h(T2, nasa_H2_a2[0], nasa_H2_a2[1], nasa_H2_a2[2], nasa_H2_a2[3], nasa_H2_a2[4], nasa_H2_a2[5]);
855  const Scalar nasa_s_H2_2 = nasa_s(T2, nasa_H2_a2[0], nasa_H2_a2[1], nasa_H2_a2[2], nasa_H2_a2[3], nasa_H2_a2[4], nasa_H2_a2[6]);
856  const Scalar nasa_g_H2_2 = nasa_h_H2_2/(R_H2 * T2) - nasa_s_H2_2;
857 
858  return_flag_temp = test_h( species_name, index, nasa_h_H2_1, T4, nasa_thermo );
859  if( return_flag_temp != 0 ) return_flag = 1;
860 
861  return_flag_temp = test_h( species_name, index, nasa_h_H2_2, T2, nasa_thermo );
862  if( return_flag_temp != 0 ) return_flag = 1;
863 
864  return_flag_temp = test_s( species_name, index, nasa_s_H2_1, T4, nasa_thermo );
865  if( return_flag_temp != 0 ) return_flag = 1;
866 
867  return_flag_temp = test_s( species_name, index, nasa_s_H2_2, T2, nasa_thermo );
868  if( return_flag_temp != 0 ) return_flag = 1;
869 
870  return_flag_temp = test_g( species_name, index, nasa_g_H2_1, T4, nasa_thermo );
871  if( return_flag_temp != 0 ) return_flag = 1;
872 
873  return_flag_temp = test_g( species_name, index, nasa_g_H2_2, T2, nasa_thermo );
874  if( return_flag_temp != 0 ) return_flag = 1;
875  }
876 
877  return return_flag;
878 }
879 
880 
881 int main(int argc, char* argv[])
882 {
883  if( argc < 2 )
884  {
885  // TODO: Need more consistent error handling.
886  std::cerr << "Error: Must specify NASA thermodynamics set input file." << std::endl;
887  antioch_error();
888  }
889 // We're not getting the full long double precision yet?
890  return (tester<double>(std::string(argv[1])) ||
891 // tester<long double>(std::string(argv[1])) ||
892  tester<float>(std::string(argv[1])));
893 }
unsigned int Species
StateType h_over_RT(const TempCache< StateType > &cache, unsigned int species) const
h over RT, directly from the curve fit
int test_s(const std::string &species_name, unsigned int species, Scalar s_exact, Scalar T, const Antioch::NASAEvaluator< Scalar, NASAFit > &thermo)
const std::vector< Species > & species_list() const
Scalar cea_s(Scalar T, Scalar a0, Scalar a1, Scalar a2, Scalar a3, Scalar a4, Scalar a5, Scalar a6, Scalar a9)
Scalar nasa_s(Scalar T, Scalar a0, Scalar a1, Scalar a2, Scalar a3, Scalar a4, Scalar a6)
StateType s_over_R(const TempCache< StateType > &cache, unsigned int species) const
s over R, directly from the curve fit
#define antioch_error()
Scalar cp(Scalar T, Scalar a0, Scalar a1, Scalar a2, Scalar a3, Scalar a4, Scalar a5, Scalar a6)
void read_nasa_mixture_data(NASAThermoMixture< NumericType, CurveType > &thermo, const std::string &filename=DefaultSourceFilename::thermo_data(), ParsingType=ASCII, bool verbose=true)
int tester(const std::string &nasa_filename)
Scalar nasa_h(Scalar T, Scalar a0, Scalar a1, Scalar a2, Scalar a3, Scalar a4, Scalar a5)
const std::map< Species, std::string > & species_inverse_name_map() const
h(const TempCache< StateType > &cache, unsigned int species) const ANTIOCH_AUTOFUNC(StateType
static const std::string & thermo_data()
Scalar cea_cp(Scalar T, Scalar a0, Scalar a1, Scalar a2, Scalar a3, Scalar a4, Scalar a5, Scalar a6)
int test_cp(const std::string &species_name, unsigned int species, Scalar cp_exact, Scalar T, const Antioch::NASAEvaluator< Scalar, NASAFit > &thermo)
Scalar nasa_cp(Scalar T, Scalar a0, Scalar a1, Scalar a2, Scalar a3, Scalar a4)
Class storing chemical mixture properties.
int main(int argc, char *argv[])
int test_g(const std::string &species_name, unsigned int species, Scalar g_exact, Scalar T, const Antioch::NASAEvaluator< Scalar, NASAFit > &thermo)
StateType cp(const TempCache< StateType > &cache, unsigned int species) const
We currently need different specializations for scalar vs vector inputs here.
Scalar g(const std::vector< Scalar > &thermo, const Scalar &T)
Scalar cea_h(Scalar T, Scalar a0, Scalar a1, Scalar a2, Scalar a3, Scalar a4, Scalar a5, Scalar a6, Scalar a8)
int test_h(const std::string &species_name, unsigned int species, Scalar h_exact, Scalar T, const Antioch::NASAEvaluator< Scalar, NASAFit > &thermo)

Generated on Thu Jul 7 2016 11:09:46 for antioch-0.4.0 by  doxygen 1.8.8