GRINS-0.8.0
thermochem_test_common.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // GRINS - General Reacting Incompressible Navier-Stokes
5 //
6 // Copyright (C) 2014-2017 Paul T. Bauman, Roy H. Stogner
7 // Copyright (C) 2010-2013 The PECOS Development Team
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the Version 2.1 GNU Lesser General
11 // Public License as published by the Free Software Foundation.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
21 // Boston, MA 02110-1301 USA
22 //
23 //-----------------------------------------------------------------------el-
24 
25 #ifndef GRINS_THERMOCHEM_TEST_COMMON_H
26 #define GRINS_THERMOCHEM_TEST_COMMON_H
27 
28 #include "grins_config.h"
29 
30 #ifdef GRINS_HAVE_CPPUNIT
31 
32 #include <cppunit/extensions/HelperMacros.h>
33 
34 #include <vector>
35 
36 #include "libmesh/libmesh_common.h"
37 
38 namespace GRINSTesting
39 {
41  {
42  public:
43 
44  static libMesh::Real compute_mass_frac_mixture_prop( const std::vector<libMesh::Real>& properties,
45  const std::vector<libMesh::Real>& mass_fracs )
46  {
47  CPPUNIT_ASSERT_EQUAL( properties.size(), mass_fracs.size() );
48 
49  unsigned int size = properties.size();
50 
51  libMesh::Real mixed_value = 0.0;
52  for( unsigned int s = 0; s < size; s++ )
53  mixed_value += mass_fracs[s]*properties[s];
54 
55  return mixed_value;
56  }
57 
58  static libMesh::Real arrhenius_rate( libMesh::Real A, /* preexponential */
59  libMesh::Real b, /* temp. exponent */
60  libMesh::Real Ea, /* Activation energy */
61  libMesh::Real T )
62  {
63  libMesh::Real RT = GRINS::Constants::R_universal*T;
64 
65  return A*std::pow(T,b)*std::exp(-Ea/RT);
66  }
67 
68  static libMesh::Real compute_third_body_molar_density( const std::vector<libMesh::Real>& molar_densities,
69  const std::vector<libMesh::Real>& three_body_efficiencies )
70  {
71  CPPUNIT_ASSERT_EQUAL( molar_densities.size(), three_body_efficiencies.size() );
72 
73  libMesh::Real M = 0.0;
74 
75  for(unsigned int s = 0; s < molar_densities.size(); s++ )
76  M += molar_densities[s]*three_body_efficiencies[s];
77 
78  return M;
79  }
80 
81  static libMesh::Real nasa7_cp_R_exact( libMesh::Real T,
82  libMesh::Real a0, libMesh::Real a1, libMesh::Real a2,
83  libMesh::Real a3, libMesh::Real a4 )
84  {
85  return a0 + a1*T + a2*T*T + a3*T*T*T + a4*(T*T*T*T);
86  }
87 
88  static libMesh::Real nasa7_h_RT_exact( libMesh::Real T,
89  libMesh::Real a0, libMesh::Real a1, libMesh::Real a2,
90  libMesh::Real a3, libMesh::Real a4, libMesh::Real a5 )
91  {
92  return a0 + a1/2.0*T + a2/3.0*T*T + a3/4.0*T*T*T + a4/5.0*(T*T*T*T) + a5/T;
93  }
94 
95  static libMesh::Real nasa7_s_R_exact( libMesh::Real T,
96  libMesh::Real a0, libMesh::Real a1, libMesh::Real a2,
97  libMesh::Real a3, libMesh::Real a4, libMesh::Real a6 )
98  {
99  return a0*std::log(T) + a1*T + a2/2.0*T*T + a3/3.0*T*T*T + a4/4.0*(T*T*T*T) + a6;
100  }
101 
102  static libMesh::Real nasa9_cp_R_exact( libMesh::Real T,
103  libMesh::Real a0, libMesh::Real a1, libMesh::Real a2,
104  libMesh::Real a3, libMesh::Real a4, libMesh::Real a5, libMesh::Real a6 )
105  {
106  return a0/(T*T) + a1/T + a2 + a3*T + a4*(T*T) + a5*(T*T*T) + a6*(T*T*T*T);
107  }
108 
109  static libMesh::Real nasa9_h_RT_exact( libMesh::Real T,
110  libMesh::Real a0, libMesh::Real a1, libMesh::Real a2, libMesh::Real a3,
111  libMesh::Real a4, libMesh::Real a5, libMesh::Real a6, libMesh::Real a7 )
112  {
113  return -a0/(T*T) + a1*std::log(T)/T + a2 + a3*T/2.0 + a4*(T*T)/3.0
114  + a5*(T*T*T)/4.0 + a6*(T*T*T*T)/5.0 + a7/T;
115  }
116 
117  static libMesh::Real nasa9_s_R_exact( libMesh::Real T,
118  libMesh::Real a0, libMesh::Real a1, libMesh::Real a2, libMesh::Real a3,
119  libMesh::Real a4, libMesh::Real a5, libMesh::Real a6, libMesh::Real a8 )
120  {
121  return -a0/(2.*T*T) - a1/T + a2*std::log(T) + a3*T + a4*(T*T)/2.0
122  + a5*(T*T*T)/3.0 + a6*(T*T*T*T)/4.0 + a8;
123  }
124 
125  };
126 
127 } // end namespace GRINSTesting
128 
129 #endif // GRINS_HAVE_CPPUNIT
130 
131 #endif // GRINS_THERMOCHEM_TEST_COMMON_H
static libMesh::Real nasa7_cp_R_exact(libMesh::Real T, libMesh::Real a0, libMesh::Real a1, libMesh::Real a2, libMesh::Real a3, libMesh::Real a4)
const libMesh::Real R_universal
Universal Gas Constant, R, [J/(kmol-K)].
static libMesh::Real nasa9_s_R_exact(libMesh::Real T, libMesh::Real a0, libMesh::Real a1, libMesh::Real a2, libMesh::Real a3, libMesh::Real a4, libMesh::Real a5, libMesh::Real a6, libMesh::Real a8)
static libMesh::Real compute_third_body_molar_density(const std::vector< libMesh::Real > &molar_densities, const std::vector< libMesh::Real > &three_body_efficiencies)
static libMesh::Real arrhenius_rate(libMesh::Real A, libMesh::Real b, libMesh::Real Ea, libMesh::Real T)
static libMesh::Real nasa9_cp_R_exact(libMesh::Real T, libMesh::Real a0, libMesh::Real a1, libMesh::Real a2, libMesh::Real a3, libMesh::Real a4, libMesh::Real a5, libMesh::Real a6)
static libMesh::Real nasa7_s_R_exact(libMesh::Real T, libMesh::Real a0, libMesh::Real a1, libMesh::Real a2, libMesh::Real a3, libMesh::Real a4, libMesh::Real a6)
static libMesh::Real nasa7_h_RT_exact(libMesh::Real T, libMesh::Real a0, libMesh::Real a1, libMesh::Real a2, libMesh::Real a3, libMesh::Real a4, libMesh::Real a5)
static libMesh::Real compute_mass_frac_mixture_prop(const std::vector< libMesh::Real > &properties, const std::vector< libMesh::Real > &mass_fracs)
static libMesh::Real nasa9_h_RT_exact(libMesh::Real T, libMesh::Real a0, libMesh::Real a1, libMesh::Real a2, libMesh::Real a3, libMesh::Real a4, libMesh::Real a5, libMesh::Real a6, libMesh::Real a7)

Generated on Tue Dec 19 2017 12:47:29 for GRINS-0.8.0 by  doxygen 1.8.9.1