antioch-0.4.0
Functions
sutherland_viscosity_unit.C File Reference
#include <iostream>
#include <cmath>
#include <limits>
#include "antioch/sutherland_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 99 of file sutherland_viscosity_unit.C.

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

Definition at line 42 of file sutherland_viscosity_unit.C.

Referenced by tester().

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

Definition at line 65 of file sutherland_viscosity_unit.C.

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

66 {
67  const Scalar mu_ref = 1.0e-3L;
68  const Scalar T_ref = 300.0L;
69 
70  Antioch::SutherlandViscosity<Scalar> mu(mu_ref,T_ref);
71 
72  std::cout << mu << std::endl;
73 
74  const Scalar T = 1521.2L;
75 
76  // bc with scale=40 gives
77  const Scalar mu_exact = .0325778060534850406481862157435995107036L;
78 
79  int return_flag = 0;
80 
81  const Scalar tol = std::numeric_limits<Scalar>::epsilon() * 10;
82 
83  return_flag = test_viscosity( mu(T), mu_exact, tol );
84 
85  const Scalar mu_ref2 = 3.14159e-3L;
86  const Scalar T_ref2 = 420.42L;
87 
88  mu.reset_coeffs(mu_ref2,T_ref2);
89 
90  // bc with scale=40 gives
91  const Scalar mu_exact2 = .0959985656417205050367745642313443587197L;
92 
93  return_flag = test_viscosity( mu(T), mu_exact2, tol );
94 
95  return return_flag;
96 }
int test_viscosity(const Scalar mu, const Scalar mu_exact, const Scalar tol)

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