ryujin 2.1.1 revision 0348cbb53a3e4b1da2a4c037e81f88f2d21ce219
hyperbolic_system.h
Go to the documentation of this file.
1//
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3// Copyright (C) 2023 - 2024 by the ryujin authors
4//
5
6#pragma once
7
9#include <discretization.h>
11#include <patterns_conversion.h>
12#include <simd.h>
13#include <state_vector.h>
14
15#include <deal.II/base/parameter_acceptor.h>
16#include <deal.II/base/tensor.h>
17
18#include <array>
19#include <functional>
20
21namespace ryujin
22{
23 namespace Skeleton
24 {
25 template <int dim, typename Number>
26 class HyperbolicSystemView;
27
33 class HyperbolicSystem final : public dealii::ParameterAcceptor
34 {
35 public:
39 static inline const std::string problem_name =
40 "Skeleton Hyperbolic System";
41
45 HyperbolicSystem(const std::string &subsection = "/HyperbolicSystem")
46 : ParameterAcceptor(subsection)
47 {
48 }
49
56 template <int dim, typename Number>
57 auto view() const
58 {
60 }
61
62 private:
63 template <int dim, typename Number>
65 }; /* HyperbolicSystem */
66
67
73 template <int dim, typename Number>
75 {
76 public:
81 HyperbolicSystemView(const HyperbolicSystem &hyperbolic_system)
82 : hyperbolic_system_(hyperbolic_system)
83 {
84 }
85
89 template <int dim2, typename Number2>
90 auto view() const
91 {
92 return HyperbolicSystemView<dim2, Number2>{hyperbolic_system_};
93 }
94
95 private:
96 const HyperbolicSystem &hyperbolic_system_;
97
98
99 public:
104
109
113 static constexpr unsigned int problem_dimension = 1;
114
118 using state_type = dealii::Tensor<1, problem_dimension, Number>;
119
123 using flux_type =
124 dealii::Tensor<1, problem_dimension, dealii::Tensor<1, dim, Number>>;
125
130
135 static inline const auto component_names =
136 []() -> std::array<std::string, problem_dimension> {
137 if constexpr (dim == 1)
138 return {"u"};
139 else if constexpr (dim == 2)
140 return {"u"};
141 else if constexpr (dim == 3)
142 return {"u"};
143 __builtin_trap();
144 }();
145
150 static inline const auto primitive_component_names =
151 []() -> std::array<std::string, problem_dimension> {
152 if constexpr (dim == 1)
153 return {"u"};
154 else if constexpr (dim == 2)
155 return {"u"};
156 else if constexpr (dim == 3)
157 return {"u"};
158 __builtin_trap();
159 }();
160
164 static constexpr unsigned int n_precomputed_values = 0;
165
169 using precomputed_type = std::array<Number, n_precomputed_values>;
170
174 static inline const auto precomputed_names =
175 std::array<std::string, n_precomputed_values>{};
176
180 static constexpr unsigned int n_initial_precomputed_values = 0;
181
186 std::array<Number, n_initial_precomputed_values>;
187
191 static inline const auto initial_precomputed_names =
192 std::array<std::string, n_initial_precomputed_values>{};
193
197 using StateVector = Vectors::
198 StateVector<ScalarNumber, problem_dimension, n_precomputed_values>;
199
205
211
219
221
225
229 static constexpr unsigned int n_precomputation_cycles = 0;
230
235 template <typename DISPATCH, typename SPARSITY>
236 void precomputation_loop(unsigned int /*cycle*/,
237 const DISPATCH &dispatch_check,
238 const SPARSITY & /*sparsity_simd*/,
239 StateVector & /*state_vector*/,
240 unsigned int /*left*/,
241 unsigned int /*right*/) const = delete;
242
244
248
254 bool is_admissible(const state_type & /*U*/) const
255 {
256 return true;
257 }
258
260
264
268 template <typename Lambda>
270 const dealii::types::boundary_id /*id*/,
271 const state_type &U,
272 const dealii::Tensor<1, dim, Number> & /*normal*/,
273 const Lambda & /*get_dirichlet_data*/) const
274 {
275 return U;
276 }
277
279
283
305 const InitialPrecomputedVector & /*piv*/,
306 const unsigned int /*i*/,
307 const state_type & /*U_i*/) const
308 {
309 return flux_contribution_type{};
310 }
311
314 const InitialPrecomputedVector & /*piv*/,
315 const unsigned int * /*js*/,
316 const state_type & /*U_j*/) const
317 {
318 return flux_contribution_type{};
319 }
320
327 const flux_contribution_type & /*flux_j*/,
328 const dealii::Tensor<1, dim, Number> & /*c_ij*/) const
329 {
330 return state_type{};
331 }
332
336 static constexpr bool have_high_order_flux = false;
337
341 const dealii::Tensor<1, dim, Number> &) const = delete;
342
344
348
350 static constexpr bool have_source_terms = false;
351
353 const unsigned int /*i*/,
354 const state_type & /*U_i*/,
355 const ScalarNumber /*tau*/) const = delete;
356
358 const unsigned int * /*js*/,
359 const state_type & /*U_j*/,
360 const ScalarNumber /*tau*/) const = delete;
361
363
367
378 template <typename ST>
379 state_type expand_state(const ST &state) const
380 {
381 return state;
382 }
383
388 state_type from_primitive_state(const state_type &primitive_state) const
389 {
390 return primitive_state;
391 }
392
398 {
399 return state;
400 }
401
407 template <typename Lambda>
409 const Lambda & /*lambda*/) const
410 {
411 return state;
412 }
413
414 }; /* HyperbolicSystemView */
415 } // namespace Skeleton
416} // namespace ryujin
std::array< Number, n_precomputed_values > precomputed_type
state_type apply_galilei_transform(const state_type &state, const Lambda &) const
bool is_admissible(const state_type &) const
static constexpr unsigned int n_precomputed_values
state_type nodal_source(const PrecomputedVector &, const unsigned int *, const state_type &, const ScalarNumber) const =delete
state_type nodal_source(const PrecomputedVector &, const unsigned int, const state_type &, const ScalarNumber) const =delete
dealii::Tensor< 1, problem_dimension, Number > state_type
HyperbolicSystemView(const HyperbolicSystem &hyperbolic_system)
state_type expand_state(const ST &state) const
typename get_value_type< Number >::type ScalarNumber
dealii::Tensor< 1, problem_dimension, dealii::Tensor< 1, dim, Number > > flux_type
state_type apply_boundary_conditions(const dealii::types::boundary_id, const state_type &U, const dealii::Tensor< 1, dim, Number > &, const Lambda &) const
Vectors::StateVector< ScalarNumber, problem_dimension, n_precomputed_values > StateVector
void precomputation_loop(unsigned int, const DISPATCH &dispatch_check, const SPARSITY &, StateVector &, unsigned int, unsigned int) const =delete
state_type high_order_flux_divergence(const flux_contribution_type &, const flux_contribution_type &, const dealii::Tensor< 1, dim, Number > &) const =delete
flux_contribution_type flux_contribution(const PrecomputedVector &, const InitialPrecomputedVector &, const unsigned int *, const state_type &) const
state_type flux_divergence(const flux_contribution_type &, const flux_contribution_type &, const dealii::Tensor< 1, dim, Number > &) const
static constexpr unsigned int n_precomputation_cycles
flux_contribution_type flux_contribution(const PrecomputedVector &, const InitialPrecomputedVector &, const unsigned int, const state_type &) const
static constexpr unsigned int problem_dimension
static constexpr unsigned int n_initial_precomputed_values
state_type to_primitive_state(const state_type &state) const
state_type from_primitive_state(const state_type &primitive_state) const
std::array< Number, n_initial_precomputed_values > initial_precomputed_type
static const std::string problem_name
HyperbolicSystem(const std::string &subsection="/HyperbolicSystem")