32 #ifndef ANTIOCH_WILKE_TRANSPORT_EVALUATOR_H
33 #define ANTIOCH_WILKE_TRANSPORT_EVALUATOR_H
65 template<
class Diffusion,
class Viscosity,
class ThermalConductivity,
class CoeffType=
double>
94 template <
typename StateType,
typename VectorStateType>
95 void D(
const StateType & rho,
97 const VectorStateType& mass_fractions,
98 VectorStateType & D_vec,
99 DiffusivityType diff_type = DiffusivityType::MASS_FLUX_MOLE_FRACTION )
const;
102 template <
typename StateType,
typename VectorStateType>
104 mu(
const StateType& T,
const VectorStateType& mass_fractions )
const;
109 template <
typename StateType,
typename VectorStateType>
111 k(
const StateType & T,
const VectorStateType& mass_fractions )
const;
116 template <
typename StateType,
typename VectorStateType>
117 void mu_and_k(
const StateType& T,
const VectorStateType& mass_fractions,
118 StateType&
mu, StateType&
k )
const;
122 template <
typename StateType,
typename VectorStateType>
123 void mu_and_k_and_D(
const StateType& T,
const StateType& rho,
const StateType&
cp,
124 const VectorStateType& mass_fractions,
125 StateType&
mu, StateType&
k, VectorStateType& D_vec,
126 DiffusivityType diff_type = DiffusivityType::MASS_FLUX_MOLE_FRACTION )
const;
133 template <
typename StateType,
typename VectorStateType>
135 const VectorStateType& mass_fractions,
137 VectorStateType& chi )
const;
143 template <
typename VectorStateType>
146 const VectorStateType& chi,
147 const unsigned int s )
const;
153 template <
typename VectorStateType>
162 template <
typename VectorStateType,
typename MatrixStateType>
164 const VectorStateType & mass_fractions,
165 const MatrixStateType & D_mat,
167 VectorStateType & D_vec )
const;
183 template<
class Diff,
class Visc,
class TherCond,
class CoeffType>
189 _diffusion(diffusion),
190 _viscosity(viscosity),
191 _conductivity(conductivity)
196 template<
class Diff,
class Visc,
class TherCond,
class CoeffType>
197 template <
typename StateType,
typename VectorStateType>
200 const VectorStateType& mass_fractions,
201 VectorStateType & D_vec,
205 "ERROR: This function requires a binary diffusion model to compute D!");
210 const StateType molar_density = rho / _mixture.chem_mixture().M(mass_fractions);
212 _diffusion.compute_binary_diffusion_matrix( T, molar_density, D_mat );
214 this->diffusion_mixing_rule( _mixture.chem_mixture(),
221 template<
class Diff,
class Visc,
class TherCond,
class CoeffType>
222 template <
typename StateType,
typename VectorStateType>
226 const VectorStateType& mass_fractions )
const
230 VectorStateType mu =
zero_clone(mass_fractions);
231 VectorStateType chi =
zero_clone(mass_fractions);
237 this->compute_mu_chi( T, mass_fractions, mu, chi );
239 this->compute_mu_mu_sqrt( mu, mu_mu_sqrt);
241 for(
unsigned int s = 0; s < _mixture.chem_mixture().n_species(); s++ )
245 mu_mix += mu[s]*chi[s]/phi_s;
251 template<
class Diff,
class Visc,
class TherCond,
class CoeffType>
252 template <
typename StateType,
typename VectorStateType>
255 const VectorStateType& mass_fractions )
const
258 "This function requires a conductivity model independent of diffusion!");
264 VectorStateType mu =
zero_clone(mass_fractions);
265 VectorStateType chi =
zero_clone(mass_fractions);
270 this->compute_mu_chi( T, mass_fractions, mu, chi );
272 this->compute_mu_mu_sqrt( mu, mu_mu_sqrt);
274 for(
unsigned int s = 0; s < _mixture.chem_mixture().n_species(); s++ )
280 k_s = _conductivity.conductivity_without_diffusion( s,
284 k_mix += k_s*chi[s]/phi_s;
290 template<
class Diff,
class Visc,
class TherCond,
class CoeffType>
291 template <
typename StateType,
typename VectorStateType>
293 const VectorStateType& mass_fractions,
295 StateType& k_mix )
const
298 "This function requires a conductivity model independent of diffusion!");
303 VectorStateType mu =
zero_clone(mass_fractions);
304 VectorStateType chi =
zero_clone(mass_fractions);
309 this->compute_mu_chi( T, mass_fractions, mu, chi );
311 this->compute_mu_mu_sqrt( mu, mu_mu_sqrt);
313 for(
unsigned int s = 0; s < _mixture.transport_mixture().n_species(); s++ )
315 StateType phi_s = this->compute_phi( mu_mu_sqrt, chi, s );
319 k_s = _conductivity.conductivity_without_diffusion( s, T, mu[s] );
321 mu_mix += mu[s]*chi[s]/phi_s;
322 k_mix += k_s*chi[s]/phi_s;
328 template<
class Diff,
class Visc,
class TherCond,
class CoeffType>
329 template <
typename StateType,
typename VectorStateType>
331 const StateType & rho,
333 const VectorStateType& mass_fractions,
336 VectorStateType & D_vec,
343 "Incompatible thermal conductivity and diffusion models!" );
349 VectorStateType mu =
zero_clone(mass_fractions);
350 VectorStateType k =
zero_clone(mass_fractions);
351 VectorStateType chi =
zero_clone(mass_fractions);
355 MatrixStateType mu_mu_sqrt(mu.size());
358 MatrixStateType D_mat(mass_fractions.size());
362 this->compute_mu_chi( T, mass_fractions, mu, chi );
364 this->compute_mu_mu_sqrt( mu, mu_mu_sqrt);
366 const StateType molar_density = rho / _mixture.chem_mixture().M(mass_fractions);
371 _diffusion.compute_binary_diffusion_matrix(T, molar_density, D_mat);
373 this->diffusion_mixing_rule<VectorStateType,MatrixStateType>( _mixture.chem_mixture(),
380 for(
unsigned int s = 0; s < _mixture.transport_mixture().n_species(); s++ )
382 StateType phi_s = this->compute_phi( mu_mu_sqrt, chi, s );
386 k[s] = _conductivity.conductivity_with_diffusion( s,
388 molar_density*_mixture.chem_mixture().M(s),
396 k[s] = _conductivity.conductivity_without_diffusion( s,
401 k_mix += k[s]*chi[s]/phi_s;
402 mu_mix += mu[s]*chi[s]/phi_s;
410 for(
unsigned int s = 0; s < _mixture.transport_mixture().n_species(); s++ )
412 _diffusion.compute_species_diffusivity(s,
423 template<
class Diff,
class Visc,
class TherCond,
class CoeffType>
424 template <
typename StateType,
typename VectorStateType>
426 const VectorStateType& mass_fractions,
428 VectorStateType& chi )
const
434 for(
unsigned int s = 0; s < _mixture.chem_mixture().n_species(); s++ )
436 mu[s] = _viscosity(s,T);
437 chi[s] = mass_fractions[s]*M/_mixture.chem_mixture().M(s);
443 template<
class Diff,
class Visc,
class TherCond,
class CoeffType>
444 template <
typename VectorStateType>
448 const VectorStateType& chi,
449 const unsigned int s )
const
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);
462 for(
unsigned int r = 1; r < _mixture.chem_mixture().n_species(); r++ )
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);
471 template<
class Diff,
class Visc,
class TherCond,
class CoeffType>
472 template <
typename VectorStateType>
481 for(
unsigned int i = 0; i < mu.size(); i++)
488 for(
unsigned int s = 0; s < mu.size(); s++)
493 for(
unsigned int s = 1; s < mu.size(); s++)
495 mu_mu_sqrt[0][s] = ant_sqrt(mu[0]/mu[s]);
499 for(
unsigned int s = 1; s < mu.size(); s++)
501 for(
unsigned int l = 1; l < mu.size(); l++)
504 mu_mu_sqrt[s][l] = mu_mu_sqrt[s][0] * mu_mu_sqrt[0][l];
509 template<
class Diff,
class Visc,
class TherCond,
class CoeffType>
510 template <
typename VectorStateType,
typename MatrixStateType>
512 const VectorStateType & mass_fractions,
513 const MatrixStateType & D_mat,
515 VectorStateType & D_vec )
const
523 for(
unsigned int s = 0; s < D_vec.size(); s++)
529 case(MASS_FLUX_MOLE_FRACTION):
531 VectorStateType molar_fractions =
zero_clone(mass_fractions);
533 mixture.X(mixture.
M(mass_fractions),mass_fractions,molar_fractions);
536 for(
unsigned int s = 0; s < D_vec.size(); s++)
538 D_vec[s] =
constant_clone(mass_fractions[s],1) - mass_fractions[s];
542 for(
unsigned int j = 0; j < D_vec.size(); j++)
547 denom += molar_fractions[j] / D_mat[s][j];
554 case(MOLE_FLUX_MOLE_FRACTION):
556 VectorStateType molar_fractions =
zero_clone(mass_fractions);
558 mixture.X(mixture.
M(mass_fractions),mass_fractions,molar_fractions);
561 for(
unsigned int s = 0; s < D_vec.size(); s++)
564 D_vec[s] =
constant_clone(mass_fractions[s],1) - molar_fractions[s];
568 for(
unsigned int j = 0; j < D_vec.size(); j++)
573 denom += molar_fractions[j] / D_mat[s][j];
580 case(MASS_FLUX_MASS_FRACTION):
582 VectorStateType molar_fractions =
zero_clone(mass_fractions);
584 mixture.X(mixture.
M(mass_fractions),mass_fractions,molar_fractions);
590 for(
unsigned int s = 0; s < D_vec.size(); s++)
595 for(
unsigned int j = 0; j < D_vec.size(); j++)
600 term1 += molar_fractions[j]/D_mat[s][j];
602 term2 += mass_fractions[j]/D_mat[s][j];
605 term2 *= molar_fractions[s]/(one - mass_fractions[s]);
607 D_vec[s] = one/(term1+term2);
613 antioch_error_msg(
"ERROR: Invalid DiffusivityType in MixtureAveragedTransportEvaluator::diffusion_mixing_rule");
620 #endif // ANTIOCH_WILKE_TRANSPORT_EVALUATOR_H
~MixtureAveragedTransportEvaluator()
void compute_mu_mu_sqrt(const VectorStateType &mu, typename rebind< VectorStateType, VectorStateType >::type &mu_mu_sqrt) const
Helper function to reduce code duplication.
Container class for species viscosities.
#define antioch_assert_equal_to(expr1, expr2)
value_type< VectorStateType >::type k(const StateType &T, const VectorStateType &mass_fractions) const
Mixture conducivity, in [W/m-K].
#define antioch_assert_greater(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.
Compute transport properties using ``mixture averaged" model.
CoeffType M(const unsigned int s) const
Molecular weight (molar mass) for species s in kg/mol.
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...
Container class for species binary diffusion models.
Scalar cp(Scalar T, Scalar a0, Scalar a1, Scalar a2, Scalar a3, Scalar a4, Scalar a5, Scalar a6)
DiffusivityType
For the mixture averaged diffusion models, there are three typical ways of computing an average diffu...
MixtureAveragedTransportEvaluator()
const MixtureConductivity< ThermalConductivity, CoeffType > & _conductivity
_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > constant_clone(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &ex, const Scalar &value)
value_type< VectorStateType >::type mu(const StateType &T, const VectorStateType &mass_fractions) const
Mixture viscosity, in [Pa-s].
#define antioch_error_msg(errmsg)
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.
const MixtureViscosity< Viscosity, CoeffType > & _viscosity
unsigned int n_species() const
Returns the number of species in this mixture.
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].
Characteristics of various diffusion models.
#define antioch_static_assert_runtime_fallback(cond, errmsg)
const MixtureAveragedTransportMixture< CoeffType > & _mixture
const MixtureDiffusion< Diffusion, CoeffType > & _diffusion
Class storing chemical mixture properties.
void init_constant(Vector &output, const Scalar &example)
The parameters are reduced parameters.
_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > zero_clone(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &ex)
Mixture object for MixtureAveragedTransport model.
void compute_mu_chi(const StateType &T, const VectorStateType &mass_fractions, VectorStateType &mu, VectorStateType &chi) const
Helper function to reduce code duplication.
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.