antioch-0.4.0
blottner_viscosity.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // Antioch - A Gas Dynamics Thermochemistry Library
5 //
6 // Copyright (C) 2014-2016 Paul T. Bauman, Benjamin S. Kirk,
7 // Sylvain Plessis, Roy H. Stonger
8 //
9 // Copyright (C) 2013 The PECOS Development Team
10 //
11 // This library is free software; you can redistribute it and/or
12 // modify it under the terms of the Version 2.1 GNU Lesser General
13 // Public License as published by the Free Software Foundation.
14 //
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
23 // Boston, MA 02110-1301 USA
24 //
25 //-----------------------------------------------------------------------el-
26 //
27 // $Id$
28 //
29 //--------------------------------------------------------------------------
30 //--------------------------------------------------------------------------
31 
32 #ifndef ANTIOCH_BLOTTNER_VISCOSITY_H
33 #define ANTIOCH_BLOTTNER_VISCOSITY_H
34 
35 // Antioch
38 
39 // C++
40 #include <cmath>
41 #include <vector>
42 #include <iostream>
43 
44 namespace Antioch
45 {
46  template<typename CoeffType=double>
47  class BlottnerViscosity : public SpeciesViscosityBase<BlottnerViscosity<CoeffType>,CoeffType>
48  {
49  public:
50 
51  BlottnerViscosity( const CoeffType a, const CoeffType b, const CoeffType c );
52 
53  BlottnerViscosity( const std::vector<CoeffType>& coeffs );
54 
55  virtual ~BlottnerViscosity(){};
56 
57  void reset_coeffs( const CoeffType a, const CoeffType b, const CoeffType c );
58 
60  friend class SpeciesViscosityBase<BlottnerViscosity<CoeffType>,CoeffType>;
61 
62  protected:
63 
64  template <typename StateType>
65  StateType op_impl( const StateType& T ) const;
66 
67  void reset_coeffs_impl( const std::vector<CoeffType> coeffs );
68 
69  void print_impl(std::ostream& os) const;
70 
72 
76  template <typename StateType>
77  void extrapolate_max_temp_impl(const StateType& Tmax);
78 
79  CoeffType _a;
80  CoeffType _b;
81  CoeffType _c;
82 
83  private:
84 
86 
87  };
88 
89  template<typename CoeffType>
91  const CoeffType b,
92  const CoeffType c)
93  : SpeciesViscosityBase<BlottnerViscosity<CoeffType>,CoeffType>(),
94  _a(a), _b(b), _c(c)
95  {
96  return;
97  }
98 
99  template<typename CoeffType>
100  BlottnerViscosity<CoeffType>::BlottnerViscosity( const std::vector<CoeffType>& coeffs )
101  : SpeciesViscosityBase<BlottnerViscosity<CoeffType>,CoeffType>(),
102  _a(-1.0), _b(-1.0), _c(-1.0)
103  {
104  antioch_assert_equal_to( coeffs.size(), 3);
105  _a = coeffs[0];
106  _b = coeffs[1];
107  _c = coeffs[2];
108  return;
109  }
110 
111  template<typename CoeffType>
112  void BlottnerViscosity<CoeffType>::print_impl(std::ostream& os) const
113  {
114  os << 0.1 << "*exp(" << _a << "*(logT)^2 + " << _b << "*logT + " << _c << ")" << std::endl;
115 
116  return;
117  }
118 
119  /* ------------------------- Inline Functions -------------------------*/
120  template<typename CoeffType>
121  template<typename StateType>
122  inline
123  StateType BlottnerViscosity<CoeffType>::op_impl( const StateType& T ) const
124  {
125  using std::log;
126  using std::exp;
127  StateType logT = log(T);
128  const CoeffType zero_point_one = 0.1L;
129 
130  return zero_point_one*exp( (_a*logT + _b)*logT + _c );
131  }
132 
133  template<typename CoeffType>
134  inline
136  const CoeffType b,
137  const CoeffType c )
138  {
139  _a = a;
140  _b = b;
141  _c = c;
142  return;
143  }
144 
145  template<typename CoeffType>
146  inline
147  void BlottnerViscosity<CoeffType>::reset_coeffs_impl( const std::vector<CoeffType> coeffs )
148  {
149  antioch_assert_equal_to(coeffs.size(), 3);
150  this->reset_coeffs( coeffs[0], coeffs[1], coeffs[2] );
151  }
152 
153  template<typename CoeffType>
154  template <typename StateType>
155  inline
157  {
158  antioch_error_msg("Extrapolation not well defined for BlottnerViscosity!");
159  }
160 
161 } // end namespace Antioch
162 
163 #endif //ANTIOCH_BLOTTNER_VISCOSITY_H
Base class for species viscosity models.
#define antioch_assert_equal_to(expr1, expr2)
void reset_coeffs_impl(const std::vector< CoeffType > coeffs)
StateType op_impl(const StateType &T) const
#define antioch_error_msg(errmsg)
void reset_coeffs(const CoeffType a, const CoeffType b, const CoeffType c)
The parameters are reduced parameters.
void print_impl(std::ostream &os) const
void extrapolate_max_temp_impl(const StateType &Tmax)
No extrapolation needed.

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