7 #ifndef NIHU_TELLES_1987_HPP_INCLUDED
8 #define NIHU_TELLES_1987_HPP_INCLUDED
43 template <
class QuadDerived>
55 typedef typename traits_t::domain_t domain_t;
56 int const n_dims = domain_t::dimension;
57 typedef typename domain_t::xi_t xi_t;
58 typedef typename domain_t::scalar_t scalar_t;
60 QuadDerived result = q.derived();
67 r_bar = 0.85 + 0.24 * std::log(d);
69 r_bar = 0.893 + 0.0832 * std::log(d);
74 for (
int i_dim = 0; i_dim < n_dims; ++i_dim)
76 scalar_t
const& e = eta_bar(i_dim);
77 scalar_t f = (1 + 2*r_bar);
79 scalar_t q = 1/(2*f)*((e*(3-2*r_bar) - 2*e*e*e/f)*1/f - e);
80 scalar_t p = 1/(3*f*f)*(4*r_bar*(1-r_bar) + 3*(1 - e*e));
81 scalar_t s = std::sqrt(q*q + p*p*p);
84 scalar_t gamma_bar = std::cbrt(-q+s) + std::cbrt(-q-s) + e/f;
86 scalar_t Q = 1 + 3*gamma_bar*gamma_bar;
88 scalar_t a = (1 - r_bar) / Q;
89 scalar_t b = -3*(1 - r_bar) * gamma_bar / Q;
90 scalar_t c = (3*gamma_bar*gamma_bar + r_bar) / Q;
94 for (
auto it = result.begin(); it != result.end(); ++it)
96 xi_t &xi = it->get_xi();
97 scalar_t x = xi(i_dim);
99 xi(i_dim) = a*x*x*x + b*x*x + c*x + d;
101 scalar_t jac = 3*a*x*x + 2*b*x + c;
103 it->set_w(it->get_w() * jac);