teqp 0.19.1
Loading...
Searching...
No Matches
mie.hpp
Go to the documentation of this file.
1#pragma once
2
4#include <Eigen/Dense>
5
6namespace teqp {
7namespace Mie{
8
14
15 private:
16 using EArray6 = Eigen::Array<double, 6, 1>;
17 using EArray4 = Eigen::Array<double, 4, 1>;
18
19 const EArray6 c1_pol = (EArray6() << -0.0192944,1.38,-2.2653,1.6291,-1.974,0.40412 ).finished();
20 const EArray6 c1_exp = (EArray6() << 0.1845,-0.3227,1.1351,2.232,-2.344,-0.4238 ).finished();
21 const EArray4 c1_gbs = (EArray4() << -4.367,0.0371,1.3895,2.835 ).finished();
22 const EArray6 c2_pol = (EArray6() << 0.26021,-5.525,8.329,-19.492,25.8,-3.8133 ).finished();
23 const EArray6 c2_exp = (EArray6() << -5.05,2.7842,-9.523,-30.383,17.902,2.2264 ).finished();
24 const EArray4 c2_gbs = (EArray4() << 48.445,-5.506,-11.643,-24.36 ).finished();
25 const EArray6 t_pol = (EArray6() << 1,0.236,0.872,0.313,0.407,0.703 ).finished();
26 const EArray6 t_exp = (EArray6() << 1.78,2.99,2.866,1.2,3.06,1.073 ).finished();
27 const EArray4 t_gbs = (EArray4() << 1.50,1.03,4.02,1.57 ).finished();
28 const EArray6 d_pol = (EArray6() << 4,1,1,2,2,3 ).finished();
29 const EArray6 d_exp = (EArray6() << 1,1,3,2,2,5 ).finished();
30 const EArray4 d_gbs = (EArray4() << 2,3,2,2 ).finished();
31 const EArray6 p = (EArray6() << 1,2,2,1,2,1 ).finished();
32 const EArray4 eta = (EArray4() << 0.362,0.313,1.17,0.957 ).finished();
33 const EArray4 beta = (EArray4() << 0.0761,0.143,0.63,1.32 ).finished();
34 const EArray4 gam = (EArray4() << 1.55,-0.0826,1.505,1.07 ).finished();
35 const EArray4 eps = (EArray4() << -1,-1,-0.195,-0.287 ).finished();
36
37 const double m_lambda_a;
38 const EArray6 n_pol, n_exp;
39 const EArray4 n_gbs;
40 const double Tc, rhoc; // In simulation units
41 public:
42
43 Mie6Pohl2023(double lambda_a) : m_lambda_a(lambda_a),
44 n_pol(c1_pol + c2_pol / m_lambda_a),
45 n_exp(c1_exp + c2_exp / m_lambda_a),
46 n_gbs(c1_gbs + c2_gbs / m_lambda_a),
47 Tc(0.668 + 6.84 / m_lambda_a + 145 / pow(m_lambda_a, 3)), // T^*
48 rhoc(0.2516 + 0.049 * log10(m_lambda_a)) // rho^*
49 {}
50
51 auto get_lambda_a() const { return m_lambda_a; }
52
53 // We are in "simulation units", so R is 1.0, and T and rho that
54 // go into alphar are actually T^* and rho^*
55 template<typename MoleFracType>
56 double R(const MoleFracType &) const { return 1.0; }
57
58 template<typename TTYPE, typename RHOTYPE, typename MoleFracType>
59 auto alphar(const TTYPE& Tstar, const RHOTYPE& rhostar, const MoleFracType& /*molefrac*/) const {
60 auto tau = Tc / Tstar; auto delta = rhostar / rhoc;
61 auto alphar_ = (
62 (n_pol * pow(tau, t_pol) * pow(delta, d_pol)).sum() +
63 (n_exp * pow(tau, t_exp) * pow(delta, d_exp) * exp(-pow(delta, p))).sum() +
64 (n_gbs * pow(tau, t_gbs) * pow(delta, d_gbs) * exp(-eta * pow(delta - eps, 2) - beta * pow(tau - gam, 2))).sum()
65 );
66 return forceeval(alphar_);
67 }
68
69 };
70
71};
72};
Mie6Pohl2023(double lambda_a)
Definition mie.hpp:43
auto get_lambda_a() const
Definition mie.hpp:51
auto alphar(const TTYPE &Tstar, const RHOTYPE &rhostar, const MoleFracType &) const
Definition mie.hpp:59
double R(const MoleFracType &) const
Definition mie.hpp:56
auto pow(const double &x, const double &e)
Definition types.hpp:189
auto forceeval(T &&expr)
Definition types.hpp:46