28 #include "antioch_config.h"
29 #ifdef ANTIOCH_HAVE_GSL // if we do not have it, we don't even define the stuff
31 #ifndef ANTIOCH_KINETICS_THEORY_VISCOSITY_H
32 #define ANTIOCH_KINETICS_THEORY_VISCOSITY_H
91 template<
typename CoeffType =
double,
typename Interpolator = GSLSpliner>
92 class KineticsTheoryViscosity :
public SpeciesViscosityBase<KineticsTheoryViscosity<CoeffType,Interpolator>,CoeffType>
108 KineticsTheoryViscosity(
const CoeffType & LJ_depth,
109 const CoeffType & LJ_diameter,
110 const CoeffType & dipole_moment,
111 const CoeffType & mass);
114 KineticsTheoryViscosity(
const std::vector<CoeffType> & coeffs);
116 virtual ~KineticsTheoryViscosity(){};
119 void reset_coeffs(
const CoeffType & LJ_depth,
const CoeffType & LJ_dia,
const CoeffType & dipole_moment,
const CoeffType & mass );
132 template <
typename StateType>
134 viscosity(const StateType &T) const
136 * _interp.interpolated_value(T)
139 template <typename StateType>
141 derivative(const StateType &T) const
144 template <typename StateType>
145 StateType compute_viscosity_and_derivative( const StateType& T, StateType & viscosity, StateType & dviscosity_dT ) const;
147 template <typename StateType>
149 Stockmayer(const StateType & T) const
153 const CoeffType & delta_star() const;
156 friend class SpeciesViscosityBase<KineticsTheoryViscosity<CoeffType,Interpolator>,CoeffType>;
160 template <typename StateType>
162 op_impl(const StateType &T) const
165 void reset_coeffs_impl( const
std::vector<CoeffType>& coeffs );
167 void print_impl(
std::ostream& os) const;
169 void build_interpolation();
178 template <typename StateType>
179 void extrapolate_max_temp_impl(const StateType& Tmax);
182 void build_spline(const StockmayerPotential<CoeffType> & surface);
185 KineticsTheoryViscosity();
188 LennardJonesPotential<CoeffType> _LJ;
189 CoeffType _dipole_moment;
192 Interpolator _interp;
193 CoeffType _delta_star;
200 template <typename CoeffType, typename Interpolator>
202 KineticsTheoryViscosity<CoeffType,Interpolator>::KineticsTheoryViscosity(const CoeffType & LJ_depth, const CoeffType & LJ_diameter,
203 const CoeffType & dipole_moment, const CoeffType & mass)
204 : SpeciesViscosityBase<KineticsTheoryViscosity<CoeffType,Interpolator>,CoeffType>(),
205 _LJ(LJ_depth,LJ_diameter),
206 _dipole_moment(dipole_moment),
208 _delta_star(CoeffType(1e-7L) * ant_pow(Constants::
light_celerity<CoeffType>(),2) *
209 ant_pow(_dipole_moment * Units<CoeffType>("
D").get_SI_factor(),2) /
210 ( _LJ.depth() * Constants::
Boltzmann_constant<CoeffType>() * 2 * ant_pow(_LJ.diameter() * Units<CoeffType>("ang").get_SI_factor(),3) )),
211 _a(CoeffType(0.3125e-14L) * ant_sqrt(CoeffType(1e28) * Constants::
Boltzmann_constant<CoeffType>() * _mass / Constants::
pi<CoeffType>())
212 / (ant_pow(_LJ.diameter() * Units<CoeffType>("ang").get_SI_factor(),2))
216 this->build_interpolation();
220 template <
typename CoeffType,
typename Interpolator>
222 KineticsTheoryViscosity<CoeffType,Interpolator>::KineticsTheoryViscosity(
const std::vector<CoeffType> & coeffs):
224 SpeciesViscosityBase<KineticsTheoryViscosity<CoeffType,Interpolator>,CoeffType>(),
231 SpeciesViscosityBase<KineticsTheoryViscosity<CoeffType,Interpolator>,CoeffType>(),
232 _LJ(coeffs[0],coeffs[1]),
233 _dipole_moment(coeffs[2]),
235 _delta_star(CoeffType(1e-7L) * ant_pow(Constants::
light_celerity<CoeffType>(),2) *
236 ant_pow(_dipole_moment * Units<CoeffType>(
"D").get_SI_factor(),2) /
237 ( _LJ.depth() * Constants::
Boltzmann_constant<CoeffType>() * 2 * ant_pow(_LJ.diameter() * Units<CoeffType>(
"ang").get_SI_factor(),3) )),
238 _a(CoeffType(0.3125e-14L) * ant_sqrt(CoeffType(1e28) * Constants::
Boltzmann_constant<CoeffType>() * _mass / Constants::
pi<CoeffType>())
239 / (ant_pow(_LJ.diameter() * Units<CoeffType>(
"ang").get_SI_factor(),2))
247 this->
reset_coeffs(coeffs[0],coeffs[1],coeffs[2],coeffs[3]);
250 this->build_interpolation();
254 template <
typename CoeffType,
typename Interpolator>
255 template <
typename StateType>
257 void KineticsTheoryViscosity<CoeffType,Interpolator>::extrapolate_max_temp_impl(
const StateType & Tmax)
260 StockmayerPotential<CoeffType> surface;
262 surface.extrapolate_to(Tmax/_LJ.depth());
263 build_spline(surface);
266 template <
typename CoeffType,
typename Interpolator>
268 void KineticsTheoryViscosity<CoeffType,Interpolator>::build_interpolation()
270 build_spline(StockmayerPotential<CoeffType>());
274 template <
typename CoeffType,
typename Interpolator>
276 void KineticsTheoryViscosity<CoeffType,Interpolator>::build_spline(
const StockmayerPotential<CoeffType> & surface)
278 std::vector<CoeffType> interp_surf(surface.log_temperature().size(),0);
279 std::vector<CoeffType> rescaled_temp(surface.log_temperature().size(),0);
280 for(
unsigned int iT = 0; iT < surface.log_temperature().size(); iT++)
282 Interpolator spline(surface.delta(),surface.omega_2_2()[iT]);
283 interp_surf[iT] = ant_sqrt(surface.temperature()[iT] * _LJ.depth()) /
284 spline.interpolated_value(_delta_star);
285 rescaled_temp[iT] = surface.temperature()[iT] * _LJ.depth();
288 _interp.spline_delete();
289 _interp.spline_init(rescaled_temp,interp_surf);
292 template <
typename CoeffType,
typename Interpolator>
294 void KineticsTheoryViscosity<CoeffType,Interpolator>::reset_coeffs(
const CoeffType & LJ_depth,
const CoeffType & LJ_dia,
const CoeffType & dipole_moment,
const CoeffType & mass )
297 _LJ.reset_coeffs(LJ_depth,LJ_dia);
298 _dipole_moment = dipole_moment;
300 _delta_star = CoeffType(1e-7L) * ant_pow(Constants::light_celerity<CoeffType>(),2) *
301 ant_pow(_dipole_moment * Units<CoeffType>(
"D").get_SI_factor(),2) /
302 ( _LJ.depth() * Constants::Boltzmann_constant<CoeffType>() * 2 * ant_pow(_LJ.diameter() * Units<CoeffType>(
"ang").get_SI_factor(),3) );
305 _a = CoeffType(0.3125e-14L) * ant_sqrt(CoeffType(1e28) * Constants::Boltzmann_constant<CoeffType>() * _mass / Constants::pi<CoeffType>())
306 / (ant_pow(_LJ.diameter() * Units<CoeffType>(
"ang").get_SI_factor(),2));
310 this->build_interpolation();
313 template <
typename CoeffType,
typename Interpolator>
315 void KineticsTheoryViscosity<CoeffType,Interpolator>::reset_coeffs_impl(
const std::vector<CoeffType>& coeffs )
319 this->reset_coeffs(coeffs[0],coeffs[1],coeffs[2],coeffs[3]);
322 template <
typename CoeffType,
typename Interpolator>
323 template <
typename StateType>
325 StateType KineticsTheoryViscosity<CoeffType,Interpolator>::compute_viscosity_and_derivative(
const StateType& T, StateType & viscosity, StateType & dviscosity_dT )
const
329 viscosity = this->viscosity(T);
330 dviscosity_dT = _a * _interp.dinterp_dx(T);
334 template <
typename CoeffType,
typename Interpolator>
336 void KineticsTheoryViscosity<CoeffType,Interpolator>::print_impl(std::ostream& os)
const
338 os <<
"Pure species viscosity:\n"
339 <<
"5/16 * sqrt(pi * " << _mass <<
" * kb * T) / ( pi * " << _LJ.depth() <<
"^2 * <Omega(2,2)*> )\n"
340 <<
"T* = T / " << _LJ.depth() <<
"\n"
341 <<
"delta* = 1/2 * " << _dipole_moment <<
"^2 / ( " << _LJ.depth() <<
" * kb * " << _LJ.diameter() <<
"^3 )\n"
342 <<
"[factor a = " << _a <<
"]";
345 template <
typename CoeffType,
typename Interpolator>
347 const CoeffType & KineticsTheoryViscosity<CoeffType,Interpolator>::delta_star()
const
354 #endif //ANTIOCH_KINETICS_THEORY_VISCOSITY_H
356 #endif // ANTIOCH_HAVE_GSL
#define antioch_assert_equal_to(expr1, expr2)
CoeffType Boltzmann_constant()
Boltzmann constant 1.380 6488 x 10-23 J/K (http://physics.nist.gov/cgi-bin/cuu/Value?k)
CoeffType light_celerity()
light celerity, m/s
#define ANTIOCH_AUTOFUNC(Type, Expr)
const ANTIOCH_AUTO(StateType) KineticsTheoryThermalConductivity< ThermoEvaluator
void reset_coeffs(const CoeffType a, const CoeffType b, const CoeffType c)
The parameters are reduced parameters.