GRINS-0.8.0
arrhenius_catalycity.C
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 // GRINS
27 
28 int main()
29 {
30  double gamma0 = 0.01;
31 
32  double Ta = 300.0;
33 
34  GRINS::ArrheniusCatalycity gamma( gamma0, Ta );
35 
36  double T1 = 10.0;
37 
38  double tol = std::numeric_limits<double>::epsilon()*10;
39 
40  int return_flag = 0;
41 
42  {
43  double gamma_exact = gamma0*std::exp(-Ta/T1);
44  double dgamma_exact = gamma0*(Ta/(T1*T1))*std::exp(-Ta/T1);
45 
46  if( std::fabs( gamma(T1) - gamma_exact ) > tol )
47  {
48  std::cerr << "Error: mismatch in gamma" << std::endl
49  << " gamma = " << gamma(T1) << std::endl
50  << " gamma exact = " << gamma_exact << std::endl;
51 
52  return_flag = 1;
53  }
54 
55  if( std::fabs( gamma.dT(T1) - dgamma_exact ) > tol )
56  {
57  std::cerr << "Error: mismatch in dgamma_dT" << std::endl
58  << " dgamma_dT = " << gamma.dT(T1) << std::endl
59  << " dgamma_dT exact = " << dgamma_exact << std::endl;
60 
61  return_flag = 1;
62  }
63  }
64 
65  std::vector<double> params;
66  params.push_back( 1.0e-5 );
67  params.push_back( 400.0 );
68 
69  gamma.set_params( params );
70 
71  {
72  double gamma_exact = params[0]*std::exp(-params[1]/T1);
73  double dgamma_exact = params[0]*(params[1]/(T1*T1))*std::exp(-params[1]/T1);
74 
75  if( std::fabs( gamma(T1) - gamma_exact ) > tol )
76  {
77  std::cerr << "Error: mismatch in gamma" << std::endl
78  << " gamma = " << gamma(T1) << std::endl
79  << " gamma exact = " << gamma_exact << std::endl;
80 
81  return_flag = 1;
82  }
83 
84  if( std::fabs( gamma.dT(T1) - dgamma_exact ) > tol )
85  {
86  std::cerr << "Error: mismatch in dgamma_dT" << std::endl
87  << " dgamma_dT = " << gamma.dT(T1) << std::endl
88  << " dgamma_dT exact = " << dgamma_exact << std::endl;
89 
90  return_flag = 1;
91  }
92  }
93 
94  return return_flag;
95 }
int main()
virtual void set_params(const std::vector< libMesh::Real > &params)
virtual libMesh::Real dT(const libMesh::Real T) const

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