antioch-0.4.0
Functions
constant_lewis_unit.C File Reference
#include <iostream>
#include <cmath>
#include <limits>
#include "antioch/constant_lewis_diffusivity.h"

Go to the source code of this file.

Functions

template<typename Scalar >
int test_val (const Scalar val, const Scalar val_exact, const Scalar tol, const std::string &val_name)
 
template<typename Scalar >
int tester ()
 
int main ()
 

Function Documentation

int main ( )

Definition at line 84 of file constant_lewis_unit.C.

85 {
86  return ( tester<double>() ||
87  tester<long double>() ||
88  tester<float>()
89  );
90 }
template<typename Scalar >
int test_val ( const Scalar  val,
const Scalar  val_exact,
const Scalar  tol,
const std::string &  val_name 
)

Definition at line 41 of file constant_lewis_unit.C.

Referenced by tester().

42 {
43  using std::abs;
44 
45  int return_flag = 0;
46 
47  const Scalar rel_error = abs( (val - val_exact)/val_exact);
48 
49  if( rel_error > tol )
50  {
51  std::cerr << "Error: Mismatch in " << val_name << std::endl
52  << val_name << " = " << val << std::endl
53  << val_name+"_exact = " << val_exact << std::endl
54  << "rel_error = " << rel_error << std::endl
55  << "tol = " << tol << std::endl;
56  return_flag = 1;
57  }
58 
59  return return_flag;
60 }
template<typename Scalar >
int tester ( )

Definition at line 63 of file constant_lewis_unit.C.

References cp(), Antioch::SpeciesDiffusionBase< ConstantLewisDiffusivity< CoeffType >, CoeffType >::D(), Antioch::KineticsModel::D, and test_val().

64 {
65  const Scalar Le = 1.4;
66 
68 
69  const Scalar rho = 3.14;
70 
71  const Scalar cp = 2.71;
72 
73  const Scalar k = 42.0;
74 
75  const Scalar tol = std::numeric_limits<Scalar>::epsilon() * 2;
76 
77  const Scalar D = diff.D( rho, cp, k );
78 
79  const Scalar D_exact = k/(Le*rho*cp);
80 
81  return test_val( D, D_exact, tol, std::string("D") );
82 }
Compute species diffusivity based on constant Lewis number.
Scalar cp(Scalar T, Scalar a0, Scalar a1, Scalar a2, Scalar a3, Scalar a4, Scalar a5, Scalar a6)
int test_val(const Scalar val, const Scalar val_exact, const Scalar tol, const std::string &val_name)

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