antioch-0.4.0
List of all members | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions
Antioch::MixtureAveragedTransportEvaluator< Diffusion, Viscosity, ThermalConductivity, CoeffType > Class Template Reference

Compute transport properties using ``mixture averaged" model. More...

#include <mixture_averaged_transport_evaluator.h>

Public Types

enum  DiffusivityType { MOLE_FLUX_MOLE_FRACTION, MASS_FLUX_MASS_FRACTION, MASS_FLUX_MOLE_FRACTION }
 For the mixture averaged diffusion models, there are three typical ways of computing an average diffusivity, depending on the "units" of the flux and which variable with which the gradient is taken:

  1. molar flux with gradients of mole fraction (MOLE_FLUX_MOLE_FRACTION)
  2. mass flux with gradients of mass fraction (MASS_FLUX_MASS_FRACTION)
  3. mass flux with gradients of mole fraction (MASS_FLUX_MOLE_FRACTION) See, for example: Kee, Coltrin, Glarborg, ``Chemically Reacting Flow", Wiley, 2003, Chapter 12.7.
More...
 

Public Member Functions

 MixtureAveragedTransportEvaluator (const MixtureAveragedTransportMixture< CoeffType > &mixture, const MixtureDiffusion< Diffusion, CoeffType > &diffusion, const MixtureViscosity< Viscosity, CoeffType > &viscosity, const MixtureConductivity< ThermalConductivity, CoeffType > &conductivity)
 
 ~MixtureAveragedTransportEvaluator ()
 
template<typename StateType , typename VectorStateType >
void D (const StateType &rho, const StateType &T, const VectorStateType &mass_fractions, VectorStateType &D_vec, DiffusivityType diff_type=DiffusivityType::MASS_FLUX_MOLE_FRACTION) const
 Mixture diffusivities for each species, in [m^2/s]. More...
 
template<typename StateType , typename VectorStateType >
value_type< VectorStateType >::type mu (const StateType &T, const VectorStateType &mass_fractions) const
 Mixture viscosity, in [Pa-s]. More...
 
template<typename StateType , typename VectorStateType >
value_type< VectorStateType >::type k (const StateType &T, const VectorStateType &mass_fractions) const
 Mixture conducivity, in [W/m-K]. More...
 
template<typename StateType , typename VectorStateType >
void mu_and_k (const StateType &T, const VectorStateType &mass_fractions, StateType &mu, StateType &k) const
 Mixture viscosity and thermal conductivity, in [Pa-s], [W/m-K] respectively. More...
 
template<typename StateType , typename VectorStateType >
void mu_and_k_and_D (const StateType &T, const StateType &rho, const StateType &cp, const VectorStateType &mass_fractions, StateType &mu, StateType &k, VectorStateType &D_vec, DiffusivityType diff_type=DiffusivityType::MASS_FLUX_MOLE_FRACTION) const
 Mixture viscosity, thermal conductivity, and diffusivities in [Pa-s], [W/m-K], [m^2/s] respectively. More...
 
template<typename StateType , typename VectorStateType >
void compute_mu_chi (const StateType &T, const VectorStateType &mass_fractions, VectorStateType &mu, VectorStateType &chi) const
 Helper function to reduce code duplication. More...
 
template<typename VectorStateType >
value_type< VectorStateType >::type compute_phi (typename rebind< VectorStateType, VectorStateType >::type &mu_mu_sqrt, const VectorStateType &chi, const unsigned int s) const
 Helper function to reduce code duplication. More...
 
template<typename VectorStateType >
void compute_mu_mu_sqrt (const VectorStateType &mu, typename rebind< VectorStateType, VectorStateType >::type &mu_mu_sqrt) const
 Helper function to reduce code duplication. More...
 
template<typename StateType , typename VectorStateType >
value_type< VectorStateType >::type mu (const StateType &T, const VectorStateType &mass_fractions) const
 
template<typename StateType , typename VectorStateType >
value_type< VectorStateType >::type k (const StateType &T, const VectorStateType &mass_fractions) const
 
template<typename VectorStateType >
value_type< VectorStateType >::type compute_phi (typename Antioch::rebind< VectorStateType, VectorStateType >::type &mu_mu_sqrt, const VectorStateType &chi, const unsigned int s) const
 

Protected Member Functions

template<typename VectorStateType , typename MatrixStateType >
void diffusion_mixing_rule (const ChemicalMixture< CoeffType > &mixture, const VectorStateType &mass_fractions, const MatrixStateType &D_mat, DiffusivityType diff_type, VectorStateType &D_vec) const
 Compute species diffusion coefficients. More...
 

Protected Attributes

const
MixtureAveragedTransportMixture
< CoeffType > & 
_mixture
 
const MixtureDiffusion
< Diffusion, CoeffType > & 
_diffusion
 
const MixtureViscosity
< Viscosity, CoeffType > & 
_viscosity
 
const MixtureConductivity
< ThermalConductivity,
CoeffType > & 
_conductivity
 

Private Member Functions

 MixtureAveragedTransportEvaluator ()
 

Detailed Description

template<class Diffusion, class Viscosity, class ThermalConductivity, class CoeffType = double>
class Antioch::MixtureAveragedTransportEvaluator< Diffusion, Viscosity, ThermalConductivity, CoeffType >

Compute transport properties using ``mixture averaged" model.

Use the species transport models (template parameters) to evaluate species values, then use Wilke's mixing rule to compute the mixture viscosity and thermal conductivity and the appropriate DiffusivityType for the mixture diffusivity. This is the expected interface for the user. Underlying compile time decisions are made based on the species transport models that should be invisible to the user. The preferred, most efficient, and most general method is mu_and_k_and_D for evaluating the transport quantities. The other methods are less efficient and may only be available for a subset of species model; they are present for backwards compatibility and pedagogical reasons.

In a multi-threaded computing environment, this object should be created after threads have been forked. In other words, this object is meant to live only temporarily for computing quantities.

Definition at line 66 of file mixture_averaged_transport_evaluator.h.

Member Enumeration Documentation

template<class Diffusion , class Viscosity , class ThermalConductivity , class CoeffType = double>
enum Antioch::MixtureAveragedTransportEvaluator::DiffusivityType

For the mixture averaged diffusion models, there are three typical ways of computing an average diffusivity, depending on the "units" of the flux and which variable with which the gradient is taken:

  1. molar flux with gradients of mole fraction (MOLE_FLUX_MOLE_FRACTION)
  2. mass flux with gradients of mass fraction (MASS_FLUX_MASS_FRACTION)
  3. mass flux with gradients of mole fraction (MASS_FLUX_MOLE_FRACTION) See, for example: Kee, Coltrin, Glarborg, ``Chemically Reacting Flow", Wiley, 2003, Chapter 12.7.

Enumerator
MOLE_FLUX_MOLE_FRACTION 
MASS_FLUX_MASS_FRACTION 
MASS_FLUX_MOLE_FRACTION 

Definition at line 86 of file mixture_averaged_transport_evaluator.h.

Constructor & Destructor Documentation

template<class Diffusion , class Viscosity , class ThermalConductivity , class CoeffType = double>
Antioch::MixtureAveragedTransportEvaluator< Diffusion, Viscosity, ThermalConductivity, CoeffType >::MixtureAveragedTransportEvaluator ( const MixtureAveragedTransportMixture< CoeffType > &  mixture,
const MixtureDiffusion< Diffusion, CoeffType > &  diffusion,
const MixtureViscosity< Viscosity, CoeffType > &  viscosity,
const MixtureConductivity< ThermalConductivity, CoeffType > &  conductivity 
)
template<class Diffusion , class Viscosity , class ThermalConductivity , class CoeffType = double>
Antioch::MixtureAveragedTransportEvaluator< Diffusion, Viscosity, ThermalConductivity, CoeffType >::~MixtureAveragedTransportEvaluator ( )
inline

Definition at line 75 of file mixture_averaged_transport_evaluator.h.

75 {};
template<class Diffusion , class Viscosity , class ThermalConductivity , class CoeffType = double>
Antioch::MixtureAveragedTransportEvaluator< Diffusion, Viscosity, ThermalConductivity, CoeffType >::MixtureAveragedTransportEvaluator ( )
private

Member Function Documentation

template<class Diff , class Visc , class TherCond , class CoeffType >
template<typename StateType , typename VectorStateType >
void Antioch::MixtureAveragedTransportEvaluator< Diff, Visc, TherCond, CoeffType >::compute_mu_chi ( const StateType &  T,
const VectorStateType &  mass_fractions,
VectorStateType &  mu,
VectorStateType &  chi 
) const

Helper function to reduce code duplication.

Populates species viscosities and the intermediate variable needed for Wilke's mixing rule. This is not intended for the user; only public to facilitate testing.

Definition at line 425 of file mixture_averaged_transport_evaluator.h.

Referenced by Antioch::WilkeEvaluator< MixtureViscosity, ThermalConductivity, CoeffType >::compute_mu_chi().

429  {
430  const typename value_type<VectorStateType>::type M = _mixture.chem_mixture().M(mass_fractions);
431 
432  // Precompute needed quantities
433  // chi_s = w_s*M/M_s
434  for( unsigned int s = 0; s < _mixture.chem_mixture().n_species(); s++ )
435  {
436  mu[s] = _viscosity(s,T);
437  chi[s] = mass_fractions[s]*M/_mixture.chem_mixture().M(s);
438  }
439 
440  return;
441  }
value_type< VectorStateType >::type mu(const StateType &T, const VectorStateType &mass_fractions) const
Mixture viscosity, in [Pa-s].
const MixtureViscosity< Viscosity, CoeffType > & _viscosity
const MixtureAveragedTransportMixture< CoeffType > & _mixture
template<class Diff , class Visc , class TherCond , class CoeffType >
template<typename VectorStateType >
void Antioch::MixtureAveragedTransportEvaluator< Diff, Visc, TherCond, CoeffType >::compute_mu_mu_sqrt ( const VectorStateType &  mu,
typename rebind< VectorStateType, VectorStateType >::type &  mu_mu_sqrt 
) const
inline

Helper function to reduce code duplication.

Computes the intermediate , matrix needed for Wilke's mixing rule. Not intended for the user; only public to facilitate testing.

first the diagonal

then the square roots and the inversion (first row, first column)

now the remaining n-2 matrix, using the fact that mu[i]/mu[j] = mu[i]/mu[0] * mu[0]/mu[j]

Definition at line 474 of file mixture_averaged_transport_evaluator.h.

References antioch_assert_equal_to, antioch_assert_greater, and Antioch::constant_clone().

Referenced by tester().

477  {
478  antioch_assert_equal_to(mu.size(),mu_mu_sqrt.size()); // indeed square matrix
479  antioch_assert_greater(mu.size(),0); // not empty
480 #ifndef NDEBUG
481  for(unsigned int i = 0; i < mu.size(); i++)
482  {
483  antioch_assert_equal_to(mu.size(),mu_mu_sqrt[i].size());
484  }
485 #endif
486 
488  for(unsigned int s = 0; s < mu.size(); s++)
489  {
490  mu_mu_sqrt[s][s] = Antioch::constant_clone(mu[s],1);
491  }
493  for(unsigned int s = 1; s < mu.size(); s++)
494  {
495  mu_mu_sqrt[0][s] = ant_sqrt(mu[0]/mu[s]);
496  mu_mu_sqrt[s][0] = Antioch::constant_clone(mu[0],1)/mu_mu_sqrt[0][s];
497  }
499  for(unsigned int s = 1; s < mu.size(); s++)
500  {
501  for(unsigned int l = 1; l < mu.size(); l++)
502  {
503  if(l == s)continue;
504  mu_mu_sqrt[s][l] = mu_mu_sqrt[s][0] * mu_mu_sqrt[0][l];
505  }
506  }
507  }
#define antioch_assert_equal_to(expr1, expr2)
#define antioch_assert_greater(expr1, expr2)
_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > constant_clone(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &ex, const Scalar &value)
Definition: eigen_utils.h:181
value_type< VectorStateType >::type mu(const StateType &T, const VectorStateType &mass_fractions) const
Mixture viscosity, in [Pa-s].
template<class Diffusion , class Viscosity , class ThermalConductivity , class CoeffType = double>
template<typename VectorStateType >
value_type<VectorStateType>::type Antioch::MixtureAveragedTransportEvaluator< Diffusion, Viscosity, ThermalConductivity, CoeffType >::compute_phi ( typename rebind< VectorStateType, VectorStateType >::type &  mu_mu_sqrt,
const VectorStateType &  chi,
const unsigned int  s 
) const

Helper function to reduce code duplication.

Computes the intermediate variable needed for Wilke's mixing rule. Not intended for the user; only public to facilitate testing.

Referenced by tester().

template<class Diffusion , class Viscosity , class ThermalConductivity , class CoeffType = double>
template<typename VectorStateType >
value_type<VectorStateType>::type Antioch::MixtureAveragedTransportEvaluator< Diffusion, Viscosity, ThermalConductivity, CoeffType >::compute_phi ( typename Antioch::rebind< VectorStateType, VectorStateType >::type &  mu_mu_sqrt,
const VectorStateType &  chi,
const unsigned int  s 
) const

Definition at line 447 of file mixture_averaged_transport_evaluator.h.

450  {
451  using std::sqrt;
452 
453  typedef typename value_type<VectorStateType>::type StateType;
454 
455  /* We initialize to the first iterate and loop starting from 1
456  since some StateTypes have a hard time initializing from
457  a constant. */
458  // phi_s = sum_r (chi_r*(1+sqrt(mu_s/mu_r)*(Mr/Ms)^(1/4))^2)/sqrt(8*(1+Ms/Mr))
459  const StateType dummy = 1 + mu_mu_sqrt[s][0]*_mixture.Mr_Ms_to_the_one_fourth(0,s);
460  StateType phi_s = chi[0]*dummy*dummy/_mixture.denominator(0,s);
461 
462  for(unsigned int r = 1; r < _mixture.chem_mixture().n_species(); r++ )
463  {
464  const StateType numerator = 1 + mu_mu_sqrt[s][r]*_mixture.Mr_Ms_to_the_one_fourth(r,s);
465  phi_s += chi[r]*numerator*numerator/_mixture.denominator(r,s);
466  }
467 
468  return phi_s;
469  }
const MixtureAveragedTransportMixture< CoeffType > & _mixture
template<class Diff , class Visc , class TherCond , class CoeffType >
template<typename StateType , typename VectorStateType >
void Antioch::MixtureAveragedTransportEvaluator< Diff, Visc, TherCond, CoeffType >::D ( const StateType &  rho,
const StateType &  T,
const VectorStateType &  mass_fractions,
VectorStateType &  D_vec,
DiffusivityType  diff_type = DiffusivityType::MASS_FLUX_MOLE_FRACTION 
) const

Mixture diffusivities for each species, in [m^2/s].

Only valid for BinaryDiffusionBase species diffusion models. Compile time error if otherwise.

Definition at line 198 of file mixture_averaged_transport_evaluator.h.

References antioch_static_assert_runtime_fallback, and Antioch::init_constant().

Referenced by tester().

203  {
204  antioch_static_assert_runtime_fallback( DiffusionTraits<Diff>::is_binary_diffusion,
205  "ERROR: This function requires a binary diffusion model to compute D!");
206 
207  typename rebind<VectorStateType,VectorStateType>::type D_mat(D_vec.size());
208  init_constant(D_mat,D_vec);
209 
210  const StateType molar_density = rho / _mixture.chem_mixture().M(mass_fractions); // total molar density
211 
212  _diffusion.compute_binary_diffusion_matrix( T, molar_density, D_mat );
213 
214  this->diffusion_mixing_rule( _mixture.chem_mixture(),
215  mass_fractions,
216  D_mat,
217  diff_type,
218  D_vec );
219  }
void diffusion_mixing_rule(const ChemicalMixture< CoeffType > &mixture, const VectorStateType &mass_fractions, const MatrixStateType &D_mat, DiffusivityType diff_type, VectorStateType &D_vec) const
Compute species diffusion coefficients.
#define antioch_static_assert_runtime_fallback(cond, errmsg)
const MixtureAveragedTransportMixture< CoeffType > & _mixture
const MixtureDiffusion< Diffusion, CoeffType > & _diffusion
void init_constant(Vector &output, const Scalar &example)
template<class Diff , class Visc , class TherCond , class CoeffType >
template<typename VectorStateType , typename MatrixStateType >
void Antioch::MixtureAveragedTransportEvaluator< Diff, Visc, TherCond, CoeffType >::diffusion_mixing_rule ( const ChemicalMixture< CoeffType > &  mixture,
const VectorStateType &  mass_fractions,
const MatrixStateType &  D_mat,
DiffusivityType  diff_type,
VectorStateType &  D_vec 
) const
protected

Compute species diffusion coefficients.

Uses Wilke mixing rule to compute species diffusion coefficients, D_vec, based on the given binary diffusion matrix, D_mat.

Definition at line 511 of file mixture_averaged_transport_evaluator.h.

References antioch_assert_equal_to, antioch_error_msg, Antioch::constant_clone(), Antioch::ChemicalMixture< CoeffType >::M(), Antioch::ChemicalMixture< CoeffType >::n_species(), and Antioch::zero_clone().

516  {
517  antioch_assert_equal_to(D_vec.size(),mixture.n_species());
518  antioch_assert_equal_to(D_vec.size(),mass_fractions.size());
519  antioch_assert_equal_to(D_vec.size(),D_mat.size());
520 
521 #ifndef NDEBUG
522  // D_Mat should be square
523  for(unsigned int s = 0; s < D_vec.size(); s++)
524  antioch_assert_equal_to(D_vec.size(),D_mat[s].size());
525 #endif
526 
527  switch(diff_type)
528  {
530  {
531  VectorStateType molar_fractions = zero_clone(mass_fractions);
532 
533  mixture.X(mixture.M(mass_fractions),mass_fractions,molar_fractions);
534 
535  // D_s = (1 - Y_s) / (sum_{j \neq s} x_j/D_{s,j})
536  for(unsigned int s = 0; s < D_vec.size(); s++)
537  {
538  D_vec[s] = constant_clone(mass_fractions[s],1) - mass_fractions[s];
539 
540  typename value_type<VectorStateType>::type denom = zero_clone(mass_fractions[0]);
541 
542  for(unsigned int j = 0; j < D_vec.size(); j++)
543  {
544  if(j == s)
545  continue;
546 
547  denom += molar_fractions[j] / D_mat[s][j];
548  }
549 
550  D_vec[s] /= denom;
551  }
552  break;
553  }
555  {
556  VectorStateType molar_fractions = zero_clone(mass_fractions);
557 
558  mixture.X(mixture.M(mass_fractions),mass_fractions,molar_fractions);
559 
560  // D_s = (1 - X_s) / (sum_{j \neq s} X_j/D_{s,j})
561  for(unsigned int s = 0; s < D_vec.size(); s++)
562  {
563  // 1 - X_s
564  D_vec[s] = constant_clone(mass_fractions[s],1) - molar_fractions[s];
565 
566  typename value_type<VectorStateType>::type denom = zero_clone(mass_fractions[0]);
567 
568  for(unsigned int j = 0; j < D_vec.size(); j++)
569  {
570  if(j == s)
571  continue;
572 
573  denom += molar_fractions[j] / D_mat[s][j];
574  }
575 
576  D_vec[s] /= denom;
577  }
578  break;
579  }
581  {
582  VectorStateType molar_fractions = zero_clone(mass_fractions);
583 
584  mixture.X(mixture.M(mass_fractions),mass_fractions,molar_fractions);
585 
586  typename value_type<VectorStateType>::type one = constant_clone(mass_fractions[0],1);
587 
588  // term1 term2
589  // 1/D_s = (sum_{j\ne s} X_j/D_{s,j}) + X_s/(1-Y_s)\sum_{j\ne s} Y_j/D_{s,j}
590  for(unsigned int s = 0; s < D_vec.size(); s++)
591  {
592  typename value_type<VectorStateType>::type term1 = zero_clone(mass_fractions[0]);
593  typename value_type<VectorStateType>::type term2 = zero_clone(mass_fractions[0]);
594 
595  for(unsigned int j = 0; j < D_vec.size(); j++)
596  {
597  if(j == s)
598  continue;
599 
600  term1 += molar_fractions[j]/D_mat[s][j];
601 
602  term2 += mass_fractions[j]/D_mat[s][j];
603  }
604 
605  term2 *= molar_fractions[s]/(one - mass_fractions[s]);
606 
607  D_vec[s] = one/(term1+term2);
608  }
609  break;
610  }
611  default:
612  {
613  antioch_error_msg("ERROR: Invalid DiffusivityType in MixtureAveragedTransportEvaluator::diffusion_mixing_rule");
614  }
615  } // switch(diff_type)
616  }
#define antioch_assert_equal_to(expr1, expr2)
_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > constant_clone(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &ex, const Scalar &value)
Definition: eigen_utils.h:181
#define antioch_error_msg(errmsg)
_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > zero_clone(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &ex)
Definition: eigen_utils.h:145
template<class Diffusion , class Viscosity , class ThermalConductivity , class CoeffType = double>
template<typename StateType , typename VectorStateType >
value_type<VectorStateType>::type Antioch::MixtureAveragedTransportEvaluator< Diffusion, Viscosity, ThermalConductivity, CoeffType >::k ( const StateType &  T,
const VectorStateType &  mass_fractions 
) const

Mixture conducivity, in [W/m-K].

Only valid for "no diffusion" conductivity models. Compile time error if otherwise.

Referenced by Antioch::WilkeEvaluator< MixtureViscosity, ThermalConductivity, CoeffType >::k(), and tester().

template<class Diffusion , class Viscosity , class ThermalConductivity , class CoeffType = double>
template<typename StateType , typename VectorStateType >
value_type<VectorStateType>::type Antioch::MixtureAveragedTransportEvaluator< Diffusion, Viscosity, ThermalConductivity, CoeffType >::k ( const StateType &  T,
const VectorStateType &  mass_fractions 
) const

Definition at line 254 of file mixture_averaged_transport_evaluator.h.

References antioch_assert_equal_to, antioch_static_assert_runtime_fallback, Antioch::init_constant(), and Antioch::zero_clone().

256  {
257  antioch_static_assert_runtime_fallback( !ConductivityTraits<TherCond>::requires_diffusion,
258  "This function requires a conductivity model independent of diffusion!");
259 
260  antioch_assert_equal_to(mass_fractions.size(), _mixture.chem_mixture().n_species());
261 
262  typename value_type<VectorStateType>::type k_mix = zero_clone(T);
263 
264  VectorStateType mu = zero_clone(mass_fractions);
265  VectorStateType chi = zero_clone(mass_fractions);
266 
267  typename Antioch::rebind<VectorStateType,VectorStateType>::type mu_mu_sqrt(mu.size());
268  Antioch::init_constant(mu_mu_sqrt,mu);
269 
270  this->compute_mu_chi( T, mass_fractions, mu, chi );
271 
272  this->compute_mu_mu_sqrt( mu, mu_mu_sqrt);
273 
274  for( unsigned int s = 0; s < _mixture.chem_mixture().n_species(); s++ )
275  {
276  typename value_type<VectorStateType>::type phi_s = this->compute_phi( mu_mu_sqrt, chi, s );
277 
278  typename value_type<VectorStateType>::type k_s = zero_clone(T);
279 
281  T,
282  mu[s] );
283 
284  k_mix += k_s*chi[s]/phi_s;
285  }
286 
287  return k_mix;
288  }
void compute_mu_mu_sqrt(const VectorStateType &mu, typename rebind< VectorStateType, VectorStateType >::type &mu_mu_sqrt) const
Helper function to reduce code duplication.
#define antioch_assert_equal_to(expr1, expr2)
value_type< VectorStateType >::type compute_phi(typename rebind< VectorStateType, VectorStateType >::type &mu_mu_sqrt, const VectorStateType &chi, const unsigned int s) const
Helper function to reduce code duplication.
StateType conductivity_without_diffusion(unsigned int s, const StateType &T, const StateType &mu_s) const
const MixtureConductivity< ThermalConductivity, CoeffType > & _conductivity
value_type< VectorStateType >::type mu(const StateType &T, const VectorStateType &mass_fractions) const
Mixture viscosity, in [Pa-s].
#define antioch_static_assert_runtime_fallback(cond, errmsg)
const MixtureAveragedTransportMixture< CoeffType > & _mixture
void init_constant(Vector &output, const Scalar &example)
_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > zero_clone(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &ex)
Definition: eigen_utils.h:145
void compute_mu_chi(const StateType &T, const VectorStateType &mass_fractions, VectorStateType &mu, VectorStateType &chi) const
Helper function to reduce code duplication.
template<class Diffusion , class Viscosity , class ThermalConductivity , class CoeffType = double>
template<typename StateType , typename VectorStateType >
value_type<VectorStateType>::type Antioch::MixtureAveragedTransportEvaluator< Diffusion, Viscosity, ThermalConductivity, CoeffType >::mu ( const StateType &  T,
const VectorStateType &  mass_fractions 
) const
template<class Diffusion , class Viscosity , class ThermalConductivity , class CoeffType = double>
template<typename StateType , typename VectorStateType >
value_type<VectorStateType>::type Antioch::MixtureAveragedTransportEvaluator< Diffusion, Viscosity, ThermalConductivity, CoeffType >::mu ( const StateType &  T,
const VectorStateType &  mass_fractions 
) const
inline

Definition at line 225 of file mixture_averaged_transport_evaluator.h.

References Antioch::init_constant(), and Antioch::zero_clone().

227  {
228  typename value_type<VectorStateType>::type mu_mix = zero_clone(T);
229 
230  VectorStateType mu = zero_clone(mass_fractions);
231  VectorStateType chi = zero_clone(mass_fractions);
232 
233 
234  typename Antioch::rebind<VectorStateType,VectorStateType>::type mu_mu_sqrt(mu.size());
235  Antioch::init_constant(mu_mu_sqrt,mu);
236 
237  this->compute_mu_chi( T, mass_fractions, mu, chi );
238 
239  this->compute_mu_mu_sqrt( mu, mu_mu_sqrt);
240 
241  for( unsigned int s = 0; s < _mixture.chem_mixture().n_species(); s++ )
242  {
243  typename value_type<VectorStateType>::type phi_s = this->compute_phi( mu_mu_sqrt, chi, s );
244 
245  mu_mix += mu[s]*chi[s]/phi_s;
246  }
247 
248  return mu_mix;
249  }
void compute_mu_mu_sqrt(const VectorStateType &mu, typename rebind< VectorStateType, VectorStateType >::type &mu_mu_sqrt) const
Helper function to reduce code duplication.
value_type< VectorStateType >::type compute_phi(typename rebind< VectorStateType, VectorStateType >::type &mu_mu_sqrt, const VectorStateType &chi, const unsigned int s) const
Helper function to reduce code duplication.
value_type< VectorStateType >::type mu(const StateType &T, const VectorStateType &mass_fractions) const
Mixture viscosity, in [Pa-s].
const MixtureAveragedTransportMixture< CoeffType > & _mixture
void init_constant(Vector &output, const Scalar &example)
_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > zero_clone(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &ex)
Definition: eigen_utils.h:145
void compute_mu_chi(const StateType &T, const VectorStateType &mass_fractions, VectorStateType &mu, VectorStateType &chi) const
Helper function to reduce code duplication.
template<class Diff , class Visc , class TherCond , class CoeffType >
template<typename StateType , typename VectorStateType >
void Antioch::MixtureAveragedTransportEvaluator< Diff, Visc, TherCond, CoeffType >::mu_and_k ( const StateType &  T,
const VectorStateType &  mass_fractions,
StateType &  mu,
StateType &  k 
) const

Mixture viscosity and thermal conductivity, in [Pa-s], [W/m-K] respectively.

Only valid for "no diffusion" conductivity models. Compile time error if otherwise.

Definition at line 292 of file mixture_averaged_transport_evaluator.h.

References antioch_static_assert_runtime_fallback, Antioch::init_constant(), and Antioch::zero_clone().

Referenced by Antioch::WilkeEvaluator< MixtureViscosity, ThermalConductivity, CoeffType >::mu_and_k(), and tester().

296  {
297  antioch_static_assert_runtime_fallback( !ConductivityTraits<TherCond>::requires_diffusion,
298  "This function requires a conductivity model independent of diffusion!");
299 
300  mu_mix = zero_clone(T);
301  k_mix = zero_clone(T);
302 
303  VectorStateType mu = zero_clone(mass_fractions);
304  VectorStateType chi = zero_clone(mass_fractions);
305 
306  typename Antioch::rebind<VectorStateType,VectorStateType>::type mu_mu_sqrt(mu.size());
307  Antioch::init_constant(mu_mu_sqrt,mu);
308 
309  this->compute_mu_chi( T, mass_fractions, mu, chi );
310 
311  this->compute_mu_mu_sqrt( mu, mu_mu_sqrt);
312 
313  for( unsigned int s = 0; s < _mixture.transport_mixture().n_species(); s++ )
314  {
315  StateType phi_s = this->compute_phi( mu_mu_sqrt, chi, s );
316 
317  StateType k_s = zero_clone(T);
318 
319  k_s = _conductivity.conductivity_without_diffusion( s, T, mu[s] );
320 
321  mu_mix += mu[s]*chi[s]/phi_s;
322  k_mix += k_s*chi[s]/phi_s;
323  }
324 
325  return;
326  }
void compute_mu_mu_sqrt(const VectorStateType &mu, typename rebind< VectorStateType, VectorStateType >::type &mu_mu_sqrt) const
Helper function to reduce code duplication.
value_type< VectorStateType >::type compute_phi(typename rebind< VectorStateType, VectorStateType >::type &mu_mu_sqrt, const VectorStateType &chi, const unsigned int s) const
Helper function to reduce code duplication.
StateType conductivity_without_diffusion(unsigned int s, const StateType &T, const StateType &mu_s) const
const MixtureConductivity< ThermalConductivity, CoeffType > & _conductivity
value_type< VectorStateType >::type mu(const StateType &T, const VectorStateType &mass_fractions) const
Mixture viscosity, in [Pa-s].
#define antioch_static_assert_runtime_fallback(cond, errmsg)
const MixtureAveragedTransportMixture< CoeffType > & _mixture
void init_constant(Vector &output, const Scalar &example)
_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > zero_clone(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &ex)
Definition: eigen_utils.h:145
void compute_mu_chi(const StateType &T, const VectorStateType &mass_fractions, VectorStateType &mu, VectorStateType &chi) const
Helper function to reduce code duplication.
template<class Diff , class Visc , class TherCond , class CoeffType >
template<typename StateType , typename VectorStateType >
void Antioch::MixtureAveragedTransportEvaluator< Diff, Visc, TherCond, CoeffType >::mu_and_k_and_D ( const StateType &  T,
const StateType &  rho,
const StateType &  cp,
const VectorStateType &  mass_fractions,
StateType &  mu,
StateType &  k,
VectorStateType &  D_vec,
DiffusivityType  diff_type = DiffusivityType::MASS_FLUX_MOLE_FRACTION 
) const

Mixture viscosity, thermal conductivity, and diffusivities in [Pa-s], [W/m-K], [m^2/s] respectively.

This is the preferred, most efficient, and most general method.

Definition at line 330 of file mixture_averaged_transport_evaluator.h.

References antioch_static_assert_runtime_fallback, Antioch::init_constant(), and Antioch::zero_clone().

Referenced by tester().

338  {
339  antioch_static_assert_runtime_fallback( (ConductivityTraits<TherCond>::requires_diffusion &&
340  DiffusionTraits<Diff>::is_binary_diffusion) ||
341  (!ConductivityTraits<TherCond>::requires_diffusion &&
342  DiffusionTraits<Diff>::is_species_diffusion),
343  "Incompatible thermal conductivity and diffusion models!" );
344 
345  mu_mix = zero_clone(T);
346  k_mix = zero_clone(T);
347  D_vec = zero_clone(mass_fractions);
348 
349  VectorStateType mu = zero_clone(mass_fractions);
350  VectorStateType k = zero_clone(mass_fractions);
351  VectorStateType chi = zero_clone(mass_fractions);
352 
353  typedef typename Antioch::rebind<VectorStateType,VectorStateType>::type MatrixStateType;
354 
355  MatrixStateType mu_mu_sqrt(mu.size());
356  Antioch::init_constant(mu_mu_sqrt,mu);
357 
358  MatrixStateType D_mat(mass_fractions.size());
359  init_constant(D_mat,D_vec);
360 
361 
362  this->compute_mu_chi( T, mass_fractions, mu, chi );
363 
364  this->compute_mu_mu_sqrt( mu, mu_mu_sqrt);
365 
366  const StateType molar_density = rho / _mixture.chem_mixture().M(mass_fractions); // total molar density
367 
368  // If we're using a binary diffusion model, compute D_mat, D_vec now
369  if( DiffusionTraits<Diff>::is_binary_diffusion )
370  {
371  _diffusion.compute_binary_diffusion_matrix(T, molar_density, D_mat);
372 
373  this->diffusion_mixing_rule<VectorStateType,MatrixStateType>( _mixture.chem_mixture(),
374  mass_fractions,
375  D_mat,
376  diff_type,
377  D_vec );
378  }
379 
380  for( unsigned int s = 0; s < _mixture.transport_mixture().n_species(); s++ )
381  {
382  StateType phi_s = this->compute_phi( mu_mu_sqrt, chi, s );
383 
384  if( ConductivityTraits<TherCond>::requires_diffusion )
385  {
387  T,
388  molar_density*_mixture.chem_mixture().M(s),
389  //rho*mass_fractions[s], see #146
390  mu[s],
391  D_mat[s][s] );
392 
393  }
394  else
395  {
397  T,
398  mu[s] );
399  }
400 
401  k_mix += k[s]*chi[s]/phi_s;
402  mu_mix += mu[s]*chi[s]/phi_s;
403 
404  }
405 
406 
407 
408  if( DiffusionTraits<Diff>::is_species_diffusion )
409  {
410  for( unsigned int s = 0; s < _mixture.transport_mixture().n_species(); s++ )
411  {
412  _diffusion.compute_species_diffusivity(s,
413  rho,
414  cp,
415  k_mix,
416  D_vec[s]);
417  }
418  }
419 
420  return;
421  }
void compute_mu_mu_sqrt(const VectorStateType &mu, typename rebind< VectorStateType, VectorStateType >::type &mu_mu_sqrt) const
Helper function to reduce code duplication.
value_type< VectorStateType >::type k(const StateType &T, const VectorStateType &mass_fractions) const
Mixture conducivity, in [W/m-K].
value_type< VectorStateType >::type compute_phi(typename rebind< VectorStateType, VectorStateType >::type &mu_mu_sqrt, const VectorStateType &chi, const unsigned int s) const
Helper function to reduce code duplication.
StateType conductivity_without_diffusion(unsigned int s, const StateType &T, const StateType &mu_s) const
Scalar cp(Scalar T, Scalar a0, Scalar a1, Scalar a2, Scalar a3, Scalar a4, Scalar a5, Scalar a6)
const MixtureConductivity< ThermalConductivity, CoeffType > & _conductivity
value_type< VectorStateType >::type mu(const StateType &T, const VectorStateType &mass_fractions) const
Mixture viscosity, in [Pa-s].
StateType conductivity_with_diffusion(unsigned int s, const StateType &T, const StateType &rho, const StateType &mu_s, const StateType &D_ss) const
#define antioch_static_assert_runtime_fallback(cond, errmsg)
const MixtureAveragedTransportMixture< CoeffType > & _mixture
const MixtureDiffusion< Diffusion, CoeffType > & _diffusion
void init_constant(Vector &output, const Scalar &example)
_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > zero_clone(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &ex)
Definition: eigen_utils.h:145
void compute_mu_chi(const StateType &T, const VectorStateType &mass_fractions, VectorStateType &mu, VectorStateType &chi) const
Helper function to reduce code duplication.

Member Data Documentation

template<class Diffusion , class Viscosity , class ThermalConductivity , class CoeffType = double>
const MixtureConductivity<ThermalConductivity,CoeffType>& Antioch::MixtureAveragedTransportEvaluator< Diffusion, Viscosity, ThermalConductivity, CoeffType >::_conductivity
protected

Definition at line 175 of file mixture_averaged_transport_evaluator.h.

template<class Diffusion , class Viscosity , class ThermalConductivity , class CoeffType = double>
const MixtureDiffusion<Diffusion,CoeffType>& Antioch::MixtureAveragedTransportEvaluator< Diffusion, Viscosity, ThermalConductivity, CoeffType >::_diffusion
protected

Definition at line 171 of file mixture_averaged_transport_evaluator.h.

template<class Diffusion , class Viscosity , class ThermalConductivity , class CoeffType = double>
const MixtureAveragedTransportMixture<CoeffType>& Antioch::MixtureAveragedTransportEvaluator< Diffusion, Viscosity, ThermalConductivity, CoeffType >::_mixture
protected

Definition at line 169 of file mixture_averaged_transport_evaluator.h.

template<class Diffusion , class Viscosity , class ThermalConductivity , class CoeffType = double>
const MixtureViscosity<Viscosity,CoeffType>& Antioch::MixtureAveragedTransportEvaluator< Diffusion, Viscosity, ThermalConductivity, CoeffType >::_viscosity
protected

Definition at line 173 of file mixture_averaged_transport_evaluator.h.


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

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