antioch-0.4.0
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
AntiochTesting::ArrheniusRateValarrayDoubleTest Class Reference
Inheritance diagram for AntiochTesting::ArrheniusRateValarrayDoubleTest:
AntiochTesting::ArrheniusRateValarrayTest< double > AntiochTesting::ArrheniusRateVectorTestBase< std::valarray< double > > AntiochTesting::ArrheniusRateTestHelper< Antioch::value_type< std::valarray< double > >::type > AntiochTesting::ReactionRateVectorTestBase< Antioch::ArrheniusRate< Antioch::value_type< std::valarray< double > >::type >, std::valarray< double > >

Public Member Functions

 CPPUNIT_TEST_SUITE (ArrheniusRateValarrayDoubleTest)
 
 CPPUNIT_TEST (test_standard_rate)
 
 CPPUNIT_TEST (test_standard_deriv)
 
 CPPUNIT_TEST (test_standard_rate_and_deriv)
 
 CPPUNIT_TEST_SUITE_END ()
 
virtual void setUp ()
 
virtual void tearDown ()
 
virtual void init ()
 
virtual void clear ()
 
void test_standard_rate ()
 
void test_standard_deriv ()
 
void test_standard_rate_and_deriv ()
 
void test_rate (const Antioch::ArrheniusRate< Antioch::value_type< std::valarray< double > >::type > &reaction_rate, const std::valarray< double > &T, typename Antioch::value_type< std::valarray< double > >::typetol)
 
void test_deriv (const Antioch::ArrheniusRate< Antioch::value_type< std::valarray< double > >::type > &reaction_rate, const std::valarray< double > &T, typename Antioch::value_type< std::valarray< double > >::typetol)
 
void test_rate_and_deriv (const Antioch::ArrheniusRate< Antioch::value_type< std::valarray< double > >::type > &reaction_rate, const std::valarray< double > &T, typename Antioch::value_type< std::valarray< double > >::typetol)
 

Protected Member Functions

virtual std::valarray< double > exact_rate (std::valarray< double >T)
 
virtual std::valarray< double > exact_deriv (std::valarray< double >T)
 
void reset_params (Antioch::value_type< std::valarray< double > >::typeCf, Antioch::value_type< std::valarray< double > >::typeEa)
 
void reset_params (Antioch::value_type< std::valarray< double > >::typeCf, Antioch::value_type< std::valarray< double > >::typeEa, Antioch::value_type< std::valarray< double > >::typeR)
 
Antioch::value_type
< std::valarray< double >
>::type 
value (Antioch::value_type< std::valarray< double > >::typeT)
 
Antioch::value_type
< std::valarray< double >
>::type 
deriv (Antioch::value_type< std::valarray< double > >::typeT)
 
std::valarray< double > setup_T (const std::valarray< double > &example)
 

Protected Attributes

Antioch::ArrheniusRate
< typename Antioch::value_type
< std::valarray< double >
>::type > * 
_rate
 
Antioch::value_type
< std::valarray< double >
>::type 
_Cf
 
Antioch::value_type
< std::valarray< double >
>::type 
_Ea
 
Antioch::value_type
< std::valarray< double >
>::type 
_R
 
std::valarray< double > * _example
 

Detailed Description

Definition at line 75 of file arrhenius_rate_valarray_test.C.

Member Function Documentation

virtual void AntiochTesting::ArrheniusRateVectorTestBase< std::valarray< double > >::clear ( )
inlinevirtualinherited

Definition at line 64 of file arrhenius_rate_vector_test_base.h.

65  {
66  delete _rate;
67  }
Antioch::ArrheniusRate< typename Antioch::value_type< std::valarray< double > >::type > * _rate
AntiochTesting::ArrheniusRateValarrayDoubleTest::CPPUNIT_TEST ( test_standard_rate  )
AntiochTesting::ArrheniusRateValarrayDoubleTest::CPPUNIT_TEST ( test_standard_deriv  )
AntiochTesting::ArrheniusRateValarrayDoubleTest::CPPUNIT_TEST ( test_standard_rate_and_deriv  )
AntiochTesting::ArrheniusRateValarrayDoubleTest::CPPUNIT_TEST_SUITE ( ArrheniusRateValarrayDoubleTest  )
AntiochTesting::ArrheniusRateValarrayDoubleTest::CPPUNIT_TEST_SUITE_END ( )
Antioch::value_type< std::valarray< double > >::type AntiochTesting::ArrheniusRateTestHelper< Antioch::value_type< std::valarray< double > >::type >::deriv ( Antioch::value_type< std::valarray< double > >::type  T)
inlineprotectedinherited

Definition at line 65 of file arrhenius_rate_test_helper.h.

66  {
67  using std::exp;
68  return _Ea/(_R*T*T)*_Cf *exp(-_Ea/(_R*T));
69  }
virtual std::valarray< double > AntiochTesting::ArrheniusRateVectorTestBase< std::valarray< double > >::exact_deriv ( std::valarray< double >  T)
inlineprotectedvirtualinherited

Implements AntiochTesting::ReactionRateVectorTestBase< Antioch::ArrheniusRate< Antioch::value_type< std::valarray< double > >::type >, std::valarray< double > >.

Definition at line 111 of file arrhenius_rate_vector_test_base.h.

112  {
113  PairScalars e_deriv = *(this->_example);
114  for (unsigned int tuple=0; tuple != ANTIOCH_N_TUPLES; ++tuple)
115  {
116  e_deriv[2*tuple] = this->deriv(T[2*tuple]);
117  e_deriv[2*tuple+1] = this->deriv(T[2*tuple+1]);
118  }
119  return e_deriv;
120  }
Antioch::value_type< std::valarray< double > >::type deriv(Antioch::value_type< std::valarray< double > >::typeT)
virtual std::valarray< double > AntiochTesting::ArrheniusRateVectorTestBase< std::valarray< double > >::exact_rate ( std::valarray< double >  T)
inlineprotectedvirtualinherited

Implements AntiochTesting::ReactionRateVectorTestBase< Antioch::ArrheniusRate< Antioch::value_type< std::valarray< double > >::type >, std::valarray< double > >.

Definition at line 100 of file arrhenius_rate_vector_test_base.h.

101  {
102  PairScalars e_rate = *(this->_example);
103  for (unsigned int tuple=0; tuple != ANTIOCH_N_TUPLES; ++tuple)
104  {
105  e_rate[2*tuple] = this->value(T[2*tuple]);
106  e_rate[2*tuple+1] = this->value(T[2*tuple+1]);
107  }
108  return e_rate;
109  }
Antioch::value_type< std::valarray< double > >::type value(Antioch::value_type< std::valarray< double > >::typeT)
virtual void AntiochTesting::ArrheniusRateVectorTestBase< std::valarray< double > >::init ( )
inlinevirtualinherited

Definition at line 52 of file arrhenius_rate_vector_test_base.h.

53  {
54  typedef typename Antioch::value_type<PairScalars>::type Scalar;
55 
56  Scalar Cf = 1.4L;
57  Scalar Ea = 5.0L;
58  Scalar R = 1.0L; // Ea in K
59 
60  this->reset_params(Cf,Ea,R);
62  }
Antioch::ArrheniusRate< typename Antioch::value_type< std::valarray< double > >::type > * _rate
void reset_params(Antioch::value_type< std::valarray< double > >::typeCf, Antioch::value_type< std::valarray< double > >::typeEa)
void AntiochTesting::ArrheniusRateTestHelper< Antioch::value_type< std::valarray< double > >::type >::reset_params ( Antioch::value_type< std::valarray< double > >::type  Cf,
Antioch::value_type< std::valarray< double > >::type  Ea 
)
inlineprotectedinherited

Definition at line 46 of file arrhenius_rate_test_helper.h.

void AntiochTesting::ArrheniusRateTestHelper< Antioch::value_type< std::valarray< double > >::type >::reset_params ( Antioch::value_type< std::valarray< double > >::type  Cf,
Antioch::value_type< std::valarray< double > >::type  Ea,
Antioch::value_type< std::valarray< double > >::type  R 
)
inlineprotectedinherited
virtual void AntiochTesting::ArrheniusRateValarrayTest< double >::setUp ( )
inlinevirtualinherited
std::valarray< double > AntiochTesting::ReactionRateVectorTestBase< Antioch::ArrheniusRate< Antioch::value_type< std::valarray< double > >::type > , std::valarray< double > >::setup_T ( const std::valarray< double > &  example)
inlineprotectedinherited

Definition at line 123 of file reaction_rate_vector_test_base.h.

124  {
125  // Construct from example to avoid resizing issues
126  PairScalars T = example;
127  for (unsigned int tuple=0; tuple != ANTIOCH_N_TUPLES; ++tuple)
128  {
129  T[2*tuple] = 1500.1;
130  T[2*tuple+1] = 1600.1;
131  }
132  return T;
133  }
virtual void AntiochTesting::ArrheniusRateValarrayTest< double >::tearDown ( )
inlinevirtualinherited
void AntiochTesting::ReactionRateVectorTestBase< Antioch::ArrheniusRate< Antioch::value_type< std::valarray< double > >::type > , std::valarray< double > >::test_deriv ( const Antioch::ArrheniusRate< Antioch::value_type< std::valarray< double > >::type > &  reaction_rate,
const std::valarray< double > &  T,
typename Antioch::value_type< std::valarray< double > >::type  tol 
)
inlineinherited

Definition at line 64 of file reaction_rate_vector_test_base.h.

67  {
68  const PairScalars deriv = reaction_rate.derivative(T);
69  const PairScalars exact_deriv = this->exact_deriv(T);
70 
71  for (unsigned int tuple=0; tuple != ANTIOCH_N_TUPLES; ++tuple)
72  {
73  CPPUNIT_ASSERT_DOUBLES_EQUAL( deriv[2*tuple],
74  exact_deriv[0],
75  tol );
76 
77  CPPUNIT_ASSERT_DOUBLES_EQUAL( deriv[2*tuple+1],
78  exact_deriv[1],
79  tol );
80 
81  }
82  }
_Cf VectorStateType VectorStateType derivative(const KineticsConditions< StateType, VectorStateType > &T) const ANTIOCH_AUTOFUNC(StateType
void AntiochTesting::ReactionRateVectorTestBase< Antioch::ArrheniusRate< Antioch::value_type< std::valarray< double > >::type > , std::valarray< double > >::test_rate ( const Antioch::ArrheniusRate< Antioch::value_type< std::valarray< double > >::type > &  reaction_rate,
const std::valarray< double > &  T,
typename Antioch::value_type< std::valarray< double > >::type  tol 
)
inlineinherited

Definition at line 44 of file reaction_rate_vector_test_base.h.

47  {
48  const PairScalars rate = reaction_rate(T);
49  const PairScalars exact_rate = this->exact_rate(T);
50 
51  for (unsigned int tuple=0; tuple != ANTIOCH_N_TUPLES; ++tuple)
52  {
53  CPPUNIT_ASSERT_DOUBLES_EQUAL( rate[2*tuple],
54  exact_rate[0],
55  tol );
56 
57  CPPUNIT_ASSERT_DOUBLES_EQUAL( rate[2*tuple+1],
58  exact_rate[1],
59  tol );
60 
61  }
62  }
void AntiochTesting::ReactionRateVectorTestBase< Antioch::ArrheniusRate< Antioch::value_type< std::valarray< double > >::type > , std::valarray< double > >::test_rate_and_deriv ( const Antioch::ArrheniusRate< Antioch::value_type< std::valarray< double > >::type > &  reaction_rate,
const std::valarray< double > &  T,
typename Antioch::value_type< std::valarray< double > >::type  tol 
)
inlineinherited

Definition at line 84 of file reaction_rate_vector_test_base.h.

87  {
88  // Init using T as the "example"
89  PairScalars rate = T;
90  PairScalars deriv = T;
91 
92  reaction_rate.rate_and_derivative(T,rate,deriv);
93 
94  const PairScalars exact_rate = this->exact_rate(T);
95  const PairScalars exact_deriv = this->exact_deriv(T);
96 
97  for (unsigned int tuple=0; tuple != ANTIOCH_N_TUPLES; ++tuple)
98  {
99  CPPUNIT_ASSERT_DOUBLES_EQUAL( rate[2*tuple],
100  exact_rate[0],
101  tol );
102 
103  CPPUNIT_ASSERT_DOUBLES_EQUAL( rate[2*tuple+1],
104  exact_rate[1],
105  tol );
106 
107  CPPUNIT_ASSERT_DOUBLES_EQUAL( deriv[2*tuple],
108  exact_deriv[0],
109  tol );
110 
111  CPPUNIT_ASSERT_DOUBLES_EQUAL( deriv[2*tuple+1],
112  exact_deriv[1],
113  tol );
114  }
115  }
_Cf VectorStateType VectorStateType(*) VectorStateType voi rate_and_derivative)(const KineticsConditions< StateType, VectorStateType > &T, StateType &rate, StateType &drate_dT) const
void AntiochTesting::ArrheniusRateVectorTestBase< std::valarray< double > >::test_standard_deriv ( )
inlineinherited

Definition at line 78 of file arrhenius_rate_vector_test_base.h.

79  {
80  typedef typename Antioch::value_type<PairScalars>::type Scalar;
81 
82  const Scalar tol = std::numeric_limits<Scalar>::epsilon() * 100;
83  PairScalars T = this->setup_T(*(this->_example));
84  this->test_deriv( *_rate, T, tol );
85  }
void test_deriv(const Antioch::ArrheniusRate< Antioch::value_type< std::valarray< double > >::type > &reaction_rate, const std::valarray< double > &T, typename Antioch::value_type< std::valarray< double > >::typetol)
Antioch::ArrheniusRate< typename Antioch::value_type< std::valarray< double > >::type > * _rate
void AntiochTesting::ArrheniusRateVectorTestBase< std::valarray< double > >::test_standard_rate ( )
inlineinherited

Definition at line 69 of file arrhenius_rate_vector_test_base.h.

70  {
71  typedef typename Antioch::value_type<PairScalars>::type Scalar;
72 
73  const Scalar tol = std::numeric_limits<Scalar>::epsilon() * 100;
74  PairScalars T = this->setup_T(*(this->_example));
75  this->test_rate( *_rate, T, tol );
76  }
Antioch::ArrheniusRate< typename Antioch::value_type< std::valarray< double > >::type > * _rate
void test_rate(const Antioch::ArrheniusRate< Antioch::value_type< std::valarray< double > >::type > &reaction_rate, const std::valarray< double > &T, typename Antioch::value_type< std::valarray< double > >::typetol)
void AntiochTesting::ArrheniusRateVectorTestBase< std::valarray< double > >::test_standard_rate_and_deriv ( )
inlineinherited

Definition at line 87 of file arrhenius_rate_vector_test_base.h.

88  {
89  typedef typename Antioch::value_type<PairScalars>::type Scalar;
90 
91  const Scalar tol = std::numeric_limits<Scalar>::epsilon() * 100;
92  PairScalars T = this->setup_T(*(this->_example));
93  this->test_rate_and_deriv( *_rate, T, tol );
94  }
void test_rate_and_deriv(const Antioch::ArrheniusRate< Antioch::value_type< std::valarray< double > >::type > &reaction_rate, const std::valarray< double > &T, typename Antioch::value_type< std::valarray< double > >::typetol)
Antioch::ArrheniusRate< typename Antioch::value_type< std::valarray< double > >::type > * _rate
Antioch::value_type< std::valarray< double > >::type AntiochTesting::ArrheniusRateTestHelper< Antioch::value_type< std::valarray< double > >::type >::value ( Antioch::value_type< std::valarray< double > >::type  T)
inlineprotectedinherited

Definition at line 59 of file arrhenius_rate_test_helper.h.

60  {
61  using std::exp;
62  return _Cf*exp(-_Ea/(_R*T));
63  }

Member Data Documentation

Antioch::value_type< std::valarray< double > >::type AntiochTesting::ArrheniusRateTestHelper< Antioch::value_type< std::valarray< double > >::type >::_Cf
protectedinherited

Definition at line 44 of file arrhenius_rate_test_helper.h.

Antioch::value_type< std::valarray< double > >::type AntiochTesting::ArrheniusRateTestHelper< Antioch::value_type< std::valarray< double > >::type >::_Ea
protectedinherited

Definition at line 44 of file arrhenius_rate_test_helper.h.

std::valarray< double > * AntiochTesting::ReactionRateVectorTestBase< Antioch::ArrheniusRate< Antioch::value_type< std::valarray< double > >::type > , std::valarray< double > >::_example
protectedinherited

Definition at line 121 of file reaction_rate_vector_test_base.h.

Antioch::value_type< std::valarray< double > >::type AntiochTesting::ArrheniusRateTestHelper< Antioch::value_type< std::valarray< double > >::type >::_R
protectedinherited

Definition at line 44 of file arrhenius_rate_test_helper.h.

Antioch::ArrheniusRate<typename Antioch::value_type<std::valarray< double > >::type>* AntiochTesting::ArrheniusRateVectorTestBase< std::valarray< double > >::_rate
protectedinherited

Definition at line 98 of file arrhenius_rate_vector_test_base.h.


The documentation for this class was generated from the following file:

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