8#include <ryujin/base/compile_time_options.h>
15#include <deal.II/base/point.h>
16#include <deal.II/base/tensor.h>
24 typename Number = double,
25 typename MemorySpace = dealii::MemorySpace::Host>
26 class WaveSpeedEstimatorView;
33 inline constexpr EulerAEOS::NASGRiemannSolverOptions
36 .safe_division =
false,
37 .variable_gamma =
false};
42 template <
typename ScalarNumber>
59 template <
typename ScalarNumber =
double>
72 const std::string &subsection =
"/WaveSpeedEstimator")
74 , hyperbolic_system_(&hyperbolic_system)
78 const auto update_parameters = [
this] {
80 hyperbolic_system_->template view<1, ScalarNumber>();
84 this->parse_parameters_call_back.connect(update_parameters);
97 typename MemorySpace = dealii::MemorySpace::Host>
101 hyperbolic_system_->template view<dim, Number, MemorySpace>(),
112 dealii::ObserverPointer<const HyperbolicSystem> hyperbolic_system_;
114 template <
int,
typename,
typename>
129 template <
int dim,
typename Number,
typename MemorySpace>
134 std::is_same_v<MemorySpace, dealii::MemorySpace::Host> ||
135 std::is_same_v<MemorySpace, dealii::MemorySpace::Default>,
136 "Unexpected memory space");
188 , riemann_solver_view_(
190 .template view<Number, MemorySpace>())
199 DEAL_II_HOST_DEVICE Number
210 DEAL_II_HOST_DEVICE Number
212 const unsigned int i,
213 const unsigned int *js,
218 const dealii::Tensor<1, dim, Number> &n_ij)
const;
237 const dealii::Tensor<1, dim, Number> &n_ij)
const;
260 template <
int dim,
typename Number,
typename MemorySpace>
261 DEAL_II_HOST_DEVICE_ALWAYS_INLINE Number
266 return riemann_solver_view_.compute(riemann_data_i, riemann_data_j);
270 template <
int dim,
typename Number,
typename MemorySpace>
271 DEAL_II_HOST_DEVICE_ALWAYS_INLINE Number
275 const unsigned int * ,
280 const dealii::Tensor<1, dim, Number> &n_ij)
const
282 const auto riemann_data_i = riemann_data_from_state(U_i, n_ij);
283 const auto riemann_data_j = riemann_data_from_state(U_j, n_ij);
285 return compute(riemann_data_i, riemann_data_j);
289 template <
int dim,
typename Number,
typename MemorySpace>
290 DEAL_II_HOST_DEVICE_ALWAYS_INLINE
auto
292 const state_type &U,
const dealii::Tensor<1, dim, Number> &n_ij)
const
295 const auto rho = view_.density(U);
296 const auto rho_inverse = Number(1.0) / rho;
298 const auto m = view_.momentum(U);
299 const auto proj_m = n_ij * m;
300 const auto perp = m - proj_m * n_ij;
302 const auto E = view_.total_energy(U) -
303 Number(0.5) * perp.norm_square() * rho_inverse;
309 const auto gamma = view_.gamma();
310 const auto internal_energy =
311 E -
ScalarNumber(0.5) * (proj_m * proj_m) * rho_inverse;
312 const auto p = (gamma -
ScalarNumber(1.)) * internal_energy;
313 const auto a = std::sqrt(gamma * p * rho_inverse);
315 return {{rho, proj_m * rho_inverse, p, Number(gamma), a}};
static constexpr unsigned int riemann_data_size
std::array< Number, riemann_data_size > primitive_type
void set_gamma(const double gamma)
VectorView< n_precomputed_values > PrecomputedVectorView
dealii::Tensor< 1, problem_dimension, Number > state_type
flux_type flux_contribution_type
typename get_value_type< Number >::type ScalarNumber
typename View::flux_contribution_type flux_contribution_type
WaveSpeedEstimatorView(const View &view, const WaveSpeedEstimator< ScalarNumber > &wse)
HyperbolicSystemView< dim, Number, MemorySpace > View
typename View::PrecomputedVectorView PrecomputedVectorView
DEAL_II_HOST_DEVICE primitive_type riemann_data_from_state(const state_type &U, const dealii::Tensor< 1, dim, Number > &n_ij) const
DEAL_II_HOST_DEVICE Number compute(const primitive_type &riemann_data_i, const primitive_type &riemann_data_j) const
EulerAEOS::NASGRiemannSolverView< Number, polytropic_gas_riemann_solver_options, MemorySpace > RiemannSolverView
static constexpr unsigned int riemann_data_size
typename View::ScalarNumber ScalarNumber
typename RiemannSolverView::primitive_type primitive_type
typename View::state_type state_type
WaveSpeedEstimator(const HyperbolicSystem &hyperbolic_system, const std::string &subsection="/WaveSpeedEstimator")
constexpr EulerAEOS::NASGRiemannSolverOptions polytropic_gas_riemann_solver_options