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

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