antioch-0.4.0
Functions
blottner_viscosity_unit.C File Reference
#include <iostream>
#include <cmath>
#include "antioch/blottner_viscosity.h"

Go to the source code of this file.

Functions

template<typename Scalar >
int test_viscosity (const Scalar mu, const Scalar mu_exact, const Scalar tol)
 
template<typename Scalar >
int tester ()
 
int main ()
 

Function Documentation

int main ( )

Definition at line 97 of file blottner_viscosity_unit.C.

98 {
99  return (tester<double>() ||
100  tester<long double>() ||
101  tester<float>());
102 }
template<typename Scalar >
int test_viscosity ( const Scalar  mu,
const Scalar  mu_exact,
const Scalar  tol 
)

Definition at line 40 of file blottner_viscosity_unit.C.

Referenced by tester().

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

Definition at line 62 of file blottner_viscosity_unit.C.

References Antioch::BlottnerViscosity< CoeffType >::reset_coeffs(), and test_viscosity().

63 {
64  const Scalar a = 3.14e-3;
65  const Scalar b = 2.71e-2;
66  const Scalar c = 42.0e-5;
67 
69 
70  std::cout << mu << std::endl;
71 
72  const Scalar T = 1521.2;
73 
74  // octave gives
75  const Scalar mu_exact = 0.144422234167703;
76 
77  int return_flag = 0;
78 
79  const Scalar tol = 1.0e-14;
80 
81  return_flag = test_viscosity( mu(T), mu_exact, tol );
82 
83  const Scalar a2 = 1e-3;
84  const Scalar b2 = 2e-2;
85  const Scalar c2 = 3e-5;
86 
87  mu.reset_coeffs( a2, b2, c2 );
88 
89  // octave gives
90  const Scalar mu_exact2 = 0.122172495548880;
91 
92  return_flag = test_viscosity( mu(T), mu_exact2, tol );
93 
94  return return_flag;
95 }
int test_viscosity(const Scalar mu, const Scalar mu_exact, const Scalar tol)

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