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_MOLECULAR_BINARY_DIFFUSION_H
32 #define ANTIOCH_MOLECULAR_BINARY_DIFFUSION_H
69 template <
typename CoeffType,
typename Interpolator = GSLSpliner>
70 class MolecularBinaryDiffusion :
public BinaryDiffusionBase<MolecularBinaryDiffusion<CoeffType,Interpolator>,CoeffType>
75 MolecularBinaryDiffusion(
const TransportSpecies<CoeffType> & si,
const TransportSpecies<CoeffType> & sj);
76 MolecularBinaryDiffusion(
const std::vector<TransportSpecies<CoeffType> >& species);
77 ~MolecularBinaryDiffusion();
107 void reset_coeffs(
const std::vector<TransportSpecies<CoeffType> > & spec);
109 template <
typename StateType>
112 Stockmayer(const StateType & T)
116 template <typename StateType>
119 binary_diffusion(const StateType & T, const StateType & molar_density) const
120 ANTIOCH_AUTOFUNC(StateType,_coefficient * _interp.interpolated_value(T) / molar_density )
123 const CoeffType & reduced_dipole_moment() const;
126 const CoeffType & reduced_mass() const;
129 const CoeffType & reduced_LJ_diameter() const;
132 const CoeffType & reduced_LJ_depth() const;
135 const CoeffType & xi() const;
137 void print(
std::ostream & out =
std::cout) const;
139 friend
std::ostream & operator<< (
std::ostream & out, const MolecularBinaryDiffusion<CoeffType,Interpolator> & bimol_diff)
141 bimol_diff.print(out);
146 friend class BinaryDiffusionBase<MolecularBinaryDiffusion<CoeffType,Interpolator>,CoeffType>;
150 void reset_coeffs_impl(
const TransportSpecies<CoeffType> & si,
const TransportSpecies<CoeffType> & sj);
159 template <
typename StateType>
160 void extrapolate_max_temp_impl(
const StateType & T);
163 template <
typename StateType>
166 op_impl(const StateType & T, const StateType & molar_density) const
171 MolecularBinaryDiffusion();
174 void set_coeffs(const
std::vector<TransportSpecies<CoeffType> > & spec);
176 template <typename SpeciesType>
177 const CoeffType composed_xi(const TransportSpecies<SpeciesType> & si, const TransportSpecies<SpeciesType> & sj);
179 void build_interpolation();
181 void build_spline(const StockmayerPotential<CoeffType> & surface);
184 Interpolator _interp;
188 CoeffType _reduced_mass;
190 CoeffType _reduced_LJ_diameter;
191 CoeffType _reduced_LJ_depth;
192 CoeffType _reduced_dipole_moment;
194 CoeffType _coefficient;
198 template <typename CoeffType, typename Interpolator>
200 MolecularBinaryDiffusion<CoeffType,Interpolator>::~MolecularBinaryDiffusion()
205 template <
typename CoeffType,
typename Interpolator>
207 MolecularBinaryDiffusion<CoeffType,Interpolator>::MolecularBinaryDiffusion(
const TransportSpecies<CoeffType> & si,
const TransportSpecies<CoeffType> & sj)
208 : BinaryDiffusionBase<MolecularBinaryDiffusion<CoeffType,Interpolator>,CoeffType>(),
211 _reduced_mass((si.species() == sj.species())?CoeffType(0.5) * si.M():(si.M() * sj.M()) / (si.M() + sj.M())),
212 _xi((si.polar() == sj.polar())?1:this->composed_xi(si,sj)),
213 _reduced_LJ_diameter(CoeffType(0.5) * (si.LJ_diameter() + sj.LJ_diameter()) * Units<CoeffType>(
"ang").get_SI_factor() * ant_pow(_xi,-CoeffType(1)/CoeffType(6))),
214 _reduced_LJ_depth(ant_sqrt(si.LJ_depth() * sj.LJ_depth()) * _xi * _xi),
215 _reduced_dipole_moment((CoeffType(1e-7L) * ant_pow(Constants::
light_celerity<CoeffType>(),2)) *
216 (si.dipole_moment() * sj.dipole_moment() * ant_pow(Units<CoeffType>(
"D").get_SI_factor(),2 )) /
217 (2 * _reduced_LJ_depth * Constants::
Boltzmann_constant<CoeffType>() * ant_pow(_reduced_LJ_diameter,3) )),
224 _coefficient(CoeffType(0.1875e-25L) * ant_sqrt(2 * Constants::
Boltzmann_constant<CoeffType>() * CoeffType(1e25) /
225 (_reduced_mass * Constants::
Avogadro<CoeffType>() * CoeffType(1e-25L) * Constants::
pi<CoeffType>())
227 / ( _reduced_LJ_diameter * _reduced_LJ_diameter )
231 this->build_interpolation();
236 template <
typename CoeffType,
typename Interpolator>
238 MolecularBinaryDiffusion<CoeffType,Interpolator>::MolecularBinaryDiffusion(
const std::vector<TransportSpecies<CoeffType> >& species)
239 : BinaryDiffusionBase<MolecularBinaryDiffusion<CoeffType,Interpolator>,CoeffType>(),
244 _reduced_dipole_moment(-1),
246 _reduced_LJ_diameter(-1),
247 _reduced_LJ_depth(-1),
250 _i(species[0].species()),
251 _j(species[1].species()),
252 _reduced_mass((species[0].species() == species[1].species())?CoeffType(0.5) * species[0].M():(species[0].M() * species[1].M()) / (species[0].M() + species[1].M())),
253 _xi((species[0].polar() == species[1].polar())?1:this->composed_xi(species[0],species[1])),
254 _reduced_LJ_diameter(CoeffType(0.5) * (species[0].LJ_diameter() + species[1].LJ_diameter()) * Units<CoeffType>(
"ang").get_SI_factor() * ant_pow(_xi,-CoeffType(1)/CoeffType(6))),
255 _reduced_LJ_depth(ant_sqrt(species[0].LJ_depth() * species[1].LJ_depth()) *_xi * _xi),
256 _reduced_dipole_moment((CoeffType(1e-7L) * ant_pow(Constants::
light_celerity<CoeffType>(),2)) *
257 (species[0].dipole_moment() * species[1].dipole_moment() * ant_pow(Units<CoeffType>(
"D").get_SI_factor(),2 )) /
258 (2 * _reduced_LJ_depth * Constants::
Boltzmann_constant<CoeffType>() * ant_pow(_reduced_LJ_diameter,3) )),
259 _coefficient(CoeffType(0.1875e-25L) * ant_sqrt(2 * Constants::
Boltzmann_constant<CoeffType>() * CoeffType(1e25) /
260 (_reduced_mass * Constants::
Avogadro<CoeffType>() * CoeffType(1e-25L) * Constants::
pi<CoeffType>())
262 / ( _reduced_LJ_diameter * _reduced_LJ_diameter )
269 this->set_coeffs(species);
272 this->build_interpolation();
275 template <
typename CoeffType,
typename Interpolator>
277 void MolecularBinaryDiffusion<CoeffType,Interpolator>::reset_coeffs(
const std::vector<TransportSpecies<CoeffType> >& species)
281 this->reset_coeffs(species[0],species[1]);
284 template <
typename CoeffType,
typename Interpolator>
286 void MolecularBinaryDiffusion<CoeffType,Interpolator>::reset_coeffs_impl(
const TransportSpecies<CoeffType>& si,
287 const TransportSpecies<CoeffType>& sj)
291 _reduced_mass = (si.species() == sj.species())?CoeffType(0.5) * si.M():(si.M() * sj.M()) / (si.M() + sj.M());
292 _xi = (si.polar() == sj.polar())?1:this->composed_xi(si,sj);
293 _reduced_LJ_diameter = CoeffType(0.5) * (si.LJ_diameter() + sj.LJ_diameter()) * Units<CoeffType>(
"ang").get_SI_factor() * ant_pow(_xi,-CoeffType(1)/CoeffType(6));
294 _reduced_LJ_depth = ant_sqrt(si.LJ_depth() * sj.LJ_depth()) *_xi * _xi;
295 _reduced_dipole_moment = CoeffType(1e-7L) * ant_pow(Constants::light_celerity<CoeffType>(),2) *
296 (si.dipole_moment() * sj.dipole_moment()) * ant_pow(Units<CoeffType>(
"D").get_SI_factor(),2)
297 / ((2 * _reduced_LJ_depth * Constants::Boltzmann_constant<CoeffType>() * ant_pow(_reduced_LJ_diameter,3)));
304 _coefficient = CoeffType(0.1875e-25L) * ant_sqrt(2 * Constants::Boltzmann_constant<CoeffType>() * CoeffType(1e25) /
305 (_reduced_mass * Constants::Avogadro<CoeffType>() * CoeffType(1e-25) * Constants::pi<CoeffType>())
307 / ( _reduced_LJ_diameter * _reduced_LJ_diameter );
310 template <
typename CoeffType,
typename Interpolator>
312 void MolecularBinaryDiffusion<CoeffType,Interpolator>::set_coeffs(
const std::vector<TransportSpecies<CoeffType> >& species)
316 this->reset_coeffs(species[0],species[1]);
319 template <
typename CoeffType,
typename Interpolator>
320 template <
typename SpeciesType>
322 const CoeffType MolecularBinaryDiffusion<CoeffType,Interpolator>::composed_xi(
const TransportSpecies<SpeciesType> & si,
const TransportSpecies<SpeciesType> & sj)
324 const TransportSpecies<SpeciesType> &n = (si.polar())?sj:si;
325 const TransportSpecies<SpeciesType> &p = (si.polar())?si:sj;
327 CoeffType pol = n.polarizability() / ant_pow(n.LJ_diameter(),3);
328 CoeffType dipole = p.dipole_moment() * Units<CoeffType>(
"D").get_SI_factor()
329 / ant_sqrt(4 * Constants::pi<CoeffType>() * Constants::vacuum_permittivity<CoeffType>()
330 * p.LJ_depth() * ant_pow(p.LJ_diameter(),3) );
332 return 1 + CoeffType(0.25L) * pol * dipole * ant_sqrt(p.LJ_depth()/n.LJ_depth());
335 template <
typename CoeffType,
typename Interpolator>
337 void MolecularBinaryDiffusion<CoeffType,Interpolator>::build_spline(
const StockmayerPotential<CoeffType> & surface)
339 std::vector<CoeffType> interp_surf(surface.log_temperature().size(),0);
340 std::vector<CoeffType> rescaled_temp(surface.log_temperature().size(),0);
341 for(
unsigned int iT = 0; iT < surface.temperature().size(); iT++)
343 Interpolator spline(surface.delta(),surface.omega_1_1()[iT]);
344 interp_surf[iT] = ant_sqrt(surface.temperature()[iT] * _reduced_LJ_depth) /
345 spline.interpolated_value(_reduced_dipole_moment);
346 rescaled_temp[iT] = surface.temperature()[iT] * _reduced_LJ_depth;
349 _interp.spline_delete();
350 _interp.spline_init(rescaled_temp,interp_surf);
353 template <
typename CoeffType,
typename Interpolator>
354 template <
typename StateType>
356 void MolecularBinaryDiffusion<CoeffType,Interpolator>::extrapolate_max_temp_impl(
const StateType& Tmax)
358 StockmayerPotential<CoeffType> surface;
360 surface.extrapolate_to(Tmax/_reduced_LJ_depth);
361 build_spline(surface);
364 template <
typename CoeffType,
typename Interpolator>
366 void MolecularBinaryDiffusion<CoeffType,Interpolator>::build_interpolation()
368 build_spline(StockmayerPotential<CoeffType>());
371 template <
typename CoeffType,
typename Interpolator>
373 void MolecularBinaryDiffusion<CoeffType,Interpolator>::print(std::ostream & out)
const
375 out <<
"Molecular binary diffusion of couple " << _i <<
"," << _j <<
":\n"
376 <<
" reduced mass = " << _reduced_mass <<
"\n"
377 <<
" reduced dipole moment = " << _reduced_dipole_moment <<
"\n"
378 <<
" xi = " << _xi <<
"\n"
379 <<
" reduced LJ diameter = " << _reduced_LJ_diameter <<
"\n"
380 <<
" reduced LJ depth = " << _reduced_LJ_depth <<
"\n"
381 <<
" [coefficient = " << _coefficient <<
"]"
385 template <
typename CoeffType,
typename Interpolator>
387 const CoeffType & MolecularBinaryDiffusion<CoeffType,Interpolator>::reduced_dipole_moment()
const
389 return _reduced_dipole_moment;
392 template <
typename CoeffType,
typename Interpolator>
394 const CoeffType & MolecularBinaryDiffusion<CoeffType,Interpolator>::reduced_mass()
const
396 return _reduced_mass;
399 template <
typename CoeffType,
typename Interpolator>
401 const CoeffType & MolecularBinaryDiffusion<CoeffType,Interpolator>::reduced_LJ_diameter()
const
403 return _reduced_LJ_diameter;
406 template <
typename CoeffType,
typename Interpolator>
408 const CoeffType & MolecularBinaryDiffusion<CoeffType,Interpolator>::reduced_LJ_depth()
const
410 return _reduced_LJ_depth;
413 template <
typename CoeffType,
typename Interpolator>
415 const CoeffType & MolecularBinaryDiffusion<CoeffType,Interpolator>::xi()
const
423 #endif // ANTIOCH_BIMOL_DIFF
425 #endif // ifdef ANTIOCH_HAVE_GSL
#define antioch_assert_equal_to(expr1, expr2)
CoeffType Avogadro()
Avogadro's number, particles per mole.
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
The parameters are reduced parameters.