antioch-0.4.0
Functions
rotational_relaxation_unit.C File Reference
#include "antioch/rotational_relaxation.h"
#include "antioch/metaprogramming.h"
#include <iostream>
#include <iomanip>
#include <limits>
#include <cmath>

Go to the source code of this file.

Functions

const long double pi (3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825)
 
template<typename Scalar >
Scalar F (const Scalar &x)
 
template<typename Scalar >
Scalar Z (const Scalar &T, const Scalar &eps_kb, const Scalar &z_298)
 
template<typename Scalar >
int tester ()
 
int main ()
 

Function Documentation

template<typename Scalar >
Scalar F ( const Scalar &  x)

Definition at line 40 of file rotational_relaxation_unit.C.

References pi(), and std::pow().

Referenced by tester(), and Z().

41 {
42  return 1.L + std::pow(pi,1.5)/2.L * std::sqrt(x)
43  + (pi*pi/4.L + 2.L) * x
44  + std::pow(pi * x,1.5);
45 }
Antioch::enable_if_c< Antioch::is_valarray< T >::value, typename Antioch::state_type< T >::type >::type pow(const T &in, const T2 &n)
const long double pi(3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825)
int main ( )

Definition at line 90 of file rotational_relaxation_unit.C.

91 {
92  return (tester<double>() ||
93  tester<long double>() ||
94  tester<float>());
95 }
const long double pi ( 3.  141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825)

Referenced by F().

template<typename Scalar >
int tester ( )

Definition at line 55 of file rotational_relaxation_unit.C.

References Z(), and z().

56 {
57  using std::abs;
58 
59  int return_flag = 0;
60  const Scalar tol = (std::numeric_limits<Scalar>::epsilon() * 10 < 5e-17)?5e-17:
61  std::numeric_limits<Scalar>::epsilon() * 10;
62 
63  const Scalar eps_kb = 97.53L; // N2 value
64  const Scalar z_298 = 4.0L; // N2 value
65 
66  Antioch::RotationalRelaxation<Scalar> rot(z_298,eps_kb);
67 
68  for(Scalar T = 300.1; T <= 2500.1; T += 10.)
69  {
70  Scalar z = rot(T);
71  Scalar z_exact = Z(T,eps_kb,z_298);
72 
73  if( abs( (z - z_exact)/z_exact) > tol )
74  {
75  std::cout << std::scientific << std::setprecision(16)
76  << "Error: Mismatch in rotational relaxation values." << std::endl
77  << " T = " << T << std::endl
78  << " z = " << z << std::endl
79  << " z_exact = " << z_exact << std::endl
80  << " relative error = " << std::abs(z - z_exact)/z_exact << std::endl
81  << " tolerance = " << tol << std::endl;
82 
83  return_flag = 1;
84  }
85  }
86 
87  return return_flag;
88 }
Scalar Z(const Scalar &T, const Scalar &eps_kb, const Scalar &z_298)
Scalar z(const Scalar &T, const Scalar &eps_kb, const Scalar &z_298)
template<typename Scalar >
Scalar Z ( const Scalar &  T,
const Scalar &  eps_kb,
const Scalar &  z_298 
)

Definition at line 48 of file rotational_relaxation_unit.C.

References F().

Referenced by tester(), and vectester().

49 {
50  return z_298 * F(eps_kb / 298.L) / F(eps_kb / T);
51 }
Scalar F(const Scalar &x)

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