8#include <ryujin/base/compile_time_options.h>
15#include <deal.II/base/point.h>
16#include <deal.II/base/tensor.h>
23 typename Number = double,
24 typename MemorySpace = dealii::MemorySpace::Host>
25 class WaveSpeedEstimatorView;
36 template <
typename ScalarNumber =
double>
49 const std::string &subsection =
"/WaveSpeedEstimator")
51 , hyperbolic_system_(&hyperbolic_system)
55 const auto update_parameters = [
this] {
57 hyperbolic_system_->template view<1, ScalarNumber>();
59 view.eos_interpolation_pinfty(),
60 view.compute_strict_bounds());
63 this->parse_parameters_call_back.connect(update_parameters);
76 typename MemorySpace = dealii::MemorySpace::Host>
80 hyperbolic_system_->template view<dim, Number, MemorySpace>(),
91 dealii::ObserverPointer<const HyperbolicSystem> hyperbolic_system_;
93 template <
int,
typename,
typename>
108 template <
int dim,
typename Number,
typename MemorySpace>
113 std::is_same_v<MemorySpace, dealii::MemorySpace::Host> ||
114 std::is_same_v<MemorySpace, dealii::MemorySpace::Default>,
115 "Unexpected memory space");
169 , riemann_solver_view_(
171 .template view<Number, MemorySpace>())
180 DEAL_II_HOST_DEVICE Number
189 DEAL_II_HOST_DEVICE Number
191 const unsigned int i,
192 const unsigned int *js,
197 const dealii::Tensor<1, dim, Number> &n_ij)
const;
217 const dealii::Tensor<1, dim, Number> &n_ij)
const;
240 template <
int dim,
typename Number,
typename MemorySpace>
241 DEAL_II_HOST_DEVICE_ALWAYS_INLINE Number
246 return riemann_solver_view_.compute(riemann_data_i, riemann_data_j);
250 template <
int dim,
typename Number,
typename MemorySpace>
251 DEAL_II_HOST_DEVICE_ALWAYS_INLINE Number
254 const unsigned int i,
255 const unsigned int *js,
260 const dealii::Tensor<1, dim, Number> &n_ij)
const
262 const auto &[p_i, unused_i, s_i, eta_i] =
263 pv.template read_tensor<Number, precomputed_type>(i);
265 const auto &[p_j, unused_j, s_j, eta_j] =
266 pv.template read_tensor<Number, precomputed_type>(js);
268 const auto riemann_data_i = riemann_data_from_state(U_i, p_i, n_ij);
269 const auto riemann_data_j = riemann_data_from_state(U_j, p_j, n_ij);
271 return compute(riemann_data_i, riemann_data_j);
275 template <
int dim,
typename Number,
typename MemorySpace>
276 DEAL_II_HOST_DEVICE_ALWAYS_INLINE
auto
280 const dealii::Tensor<1, dim, Number> &n_ij)
const ->
primitive_type
282 const auto rho = view_.density(U);
285 const auto m = view_.momentum(U);
286 const auto proj_m = n_ij * m;
288 const auto gamma = view_.surrogate_gamma(U, p);
290 const auto covolume_b = view_.eos_covolume_constant();
291 const auto pinf = view_.eos_interpolation_pinfty();
292 const auto x = Number(1.) - covolume_b * rho;
293 const auto a = std::sqrt(gamma * (p + pinf) / (rho * x));
295#ifdef DEBUG_EXPENSIVE_BOUNDS_CHECK
299 dealii::ExcMessage(
"Internal error: p + pinf < 0."));
304 dealii::ExcMessage(
"Internal error: 1. - b * rho <= 0."));
309 dealii::ExcMessage(
"Internal error: gamma < 1."));
312 return {{rho, proj_m * rho_inverse, p, gamma, a}};
dealii::Tensor< 1, problem_dimension, Number > state_type
typename get_value_type< Number >::type ScalarNumber
VectorView< n_precomputed_values > PrecomputedVectorView
std::array< Number, n_precomputed_values > precomputed_type
flux_type flux_contribution_type
static constexpr unsigned int riemann_data_size
std::array< Number, riemann_data_size > primitive_type
void set_equation_of_state(const double covolume_b, const double pinf, const bool compute_expensive_bounds)
typename View::flux_contribution_type flux_contribution_type
typename View::ScalarNumber ScalarNumber
NASGRiemannSolverView< Number, NASGRiemannSolverOptions{}, MemorySpace > RiemannSolverView
typename View::state_type state_type
typename View::precomputed_type precomputed_type
typename View::PrecomputedVectorView PrecomputedVectorView
HyperbolicSystemView< dim, Number, MemorySpace > View
DEAL_II_HOST_DEVICE Number compute(const primitive_type &riemann_data_i, const primitive_type &riemann_data_j) const
WaveSpeedEstimatorView(const View &view, const WaveSpeedEstimator< ScalarNumber > &wse)
DEAL_II_HOST_DEVICE primitive_type riemann_data_from_state(const state_type &U, const Number &p, const dealii::Tensor< 1, dim, Number > &n_ij) const
typename RiemannSolverView::primitive_type primitive_type
static constexpr unsigned int riemann_data_size
WaveSpeedEstimator(const HyperbolicSystem &hyperbolic_system, const std::string &subsection="/WaveSpeedEstimator")
#define AssertThrowSIMD(variable, condition, exception)