8#include <compile_time_options.h>
16#include <deal.II/base/parameter_acceptor.h>
17#include <deal.II/base/vectorization.h>
22 namespace ScalarConservation
24 template <
int dim,
typename Number =
double>
33 template <
typename ScalarNumber =
double>
46 template <
int dim,
typename Number =
double>
59 const std::string &subsection =
"/Indicator")
60 : ParameterAcceptor(subsection)
61 , hyperbolic_system_(&hyperbolic_system)
63 evc_factor_ = ScalarNumber(1.);
64 add_parameter(
"evc factor",
66 "Factor for scaling the entropy viscocity commuator");
82 template <
int dim,
typename Number>
86 hyperbolic_system_->template view<dim, Number>(), *
this};
96 ScalarNumber evc_factor_;
104 dealii::ObserverPointer<const HyperbolicSystem> hyperbolic_system_;
118 template <
int dim,
typename Number>
167 , indicator_(indicator)
176 const unsigned int i,
184 const unsigned int *js,
186 const dealii::Tensor<1, dim, Number> &c_ij);
191 Number
alpha(
const Number h_i)
const;
206 dealii::Tensor<1, dim, Number> f_i_;
220 template <
int dim,
typename Number>
221 DEAL_II_ALWAYS_INLINE
inline void
223 const unsigned int i,
228 const auto prec_i = pv.template read_tensor<Number, precomputed_type>(i);
230 u_i_ = view_.state(U_i);
231 u_abs_max_ = std::abs(u_i_);
232 f_i_ = view_.construct_flux_tensor(prec_i);
238 template <
int dim,
typename Number>
241 const unsigned int *js,
243 const dealii::Tensor<1, dim, Number> &c_ij)
247 const auto prec_j = pv.template read_tensor<Number, precomputed_type>(js);
249 const auto u_j = view_.state(U_j);
250 u_abs_max_ = std::max(u_abs_max_, std::abs(u_j));
251 const auto d_eta_j = view_.kruzkov_entropy_derivative(u_i_, u_j);
252 const auto f_j = view_.construct_flux_tensor(prec_j);
254 left_ += d_eta_j * (f_j * c_ij);
255 right_ += d_eta_j * (f_i_ * c_ij);
259 template <
int dim,
typename Number>
260 DEAL_II_ALWAYS_INLINE
inline Number
263 Number numerator = left_ - right_;
264 Number denominator = std::abs(left_) + std::abs(right_);
266 const auto regularization =
267 Number(100. * std::numeric_limits<ScalarNumber>::min());
269 const auto quotient =
270 std::abs(numerator) /
271 (denominator + std::max(hd_i * std::abs(u_abs_max_), regularization));
273 return std::min(Number(1.), indicator_.evc_factor() * quotient);
static constexpr unsigned int problem_dimension
dealii::Tensor< 1, problem_dimension, dealii::Tensor< 1, dim, Number > > flux_type
std::array< Number, n_precomputed_values > precomputed_type
Vectors::MultiComponentVectorView< ScalarNumber, n_precomputed_values, dealii::VectorizedArray< ScalarNumber >::size(), dealii::MemorySpace::Host, false > PrecomputedVectorView
typename get_value_type< Number >::type ScalarNumber
dealii::Tensor< 1, problem_dimension, Number > state_type
typename View::flux_type flux_type
static constexpr auto problem_dimension
typename View::ScalarNumber ScalarNumber
Number alpha(const Number h_i) const
typename View::PrecomputedVectorView PrecomputedVectorView
HyperbolicSystemView< dim, Number > View
void accumulate(const PrecomputedVectorView &pv, const unsigned int *js, const state_type &U_j, const dealii::Tensor< 1, dim, Number > &c_ij)
typename View::state_type state_type
IndicatorView(const View &view, const Indicator< ScalarNumber > &indicator)
void reset(const PrecomputedVectorView &pv, const unsigned int i, const state_type &U_i)
typename View::precomputed_type precomputed_type
Indicator(const HyperbolicSystem &hyperbolic_system, const std::string &subsection="/Indicator")
ACCESSOR_READ_ONLY(evc_factor)