ryujin 2.1.1 revision 9391072059490dd712e0ea92785f21acd6605f00
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
96 private:
97 const HyperbolicSystem &hyperbolic_system_;
98
99
100 public:
105
110
114 static constexpr unsigned int problem_dimension = 1;
115
119 using state_type = dealii::Tensor<1, problem_dimension, Number>;
120
124 using flux_type =
125 dealii::Tensor<1, problem_dimension, dealii::Tensor<1, dim, Number>>;
126
131
136 static inline const auto component_names =
137 []() -> std::array<std::string, problem_dimension> {
138 if constexpr (dim == 1)
139 return {"u"};
140 else if constexpr (dim == 2)
141 return {"u"};
142 else if constexpr (dim == 3)
143 return {"u"};
144 __builtin_trap();
145 }();
146
151 static inline const auto primitive_component_names =
152 []() -> std::array<std::string, problem_dimension> {
153 if constexpr (dim == 1)
154 return {"u"};
155 else if constexpr (dim == 2)
156 return {"u"};
157 else if constexpr (dim == 3)
158 return {"u"};
159 __builtin_trap();
160 }();
161
165 static constexpr unsigned int n_precomputed_values = 0;
166
170 using precomputed_type = std::array<Number, n_precomputed_values>;
171
175 static inline const auto precomputed_names =
176 std::array<std::string, n_precomputed_values>{};
177
181 static constexpr unsigned int n_initial_precomputed_values = 0;
182
187 std::array<Number, n_initial_precomputed_values>;
188
192 static inline const auto initial_precomputed_names =
193 std::array<std::string, n_initial_precomputed_values>{};
194
198 using StateVector = Vectors::
199 StateVector<ScalarNumber, problem_dimension, n_precomputed_values>;
200
206
212
220
222
226
230 static constexpr unsigned int n_precomputation_cycles = 0;
231
236 template <typename DISPATCH, typename SPARSITY>
237 void precomputation_loop(unsigned int /*cycle*/,
238 const DISPATCH &dispatch_check,
239 const SPARSITY & /*sparsity_simd*/,
240 StateVector & /*state_vector*/,
241 unsigned int /*left*/,
242 unsigned int /*right*/) const = delete;
243
245
249
255 bool is_admissible(const state_type & /*U*/) const
256 {
257 return true;
258 }
259
261
265
269 template <typename Lambda>
271 const dealii::types::boundary_id /*id*/,
272 const state_type &U,
273 const dealii::Tensor<1, dim, Number> & /*normal*/,
274 const Lambda & /*get_dirichlet_data*/) const
275 {
276 return U;
277 }
278
280
284
306 const InitialPrecomputedVector & /*piv*/,
307 const unsigned int /*i*/,
308 const state_type & /*U_i*/) const
309 {
310 return flux_contribution_type{};
311 }
312
315 const InitialPrecomputedVector & /*piv*/,
316 const unsigned int * /*js*/,
317 const state_type & /*U_j*/) const
318 {
319 return flux_contribution_type{};
320 }
321
328 const flux_contribution_type & /*flux_j*/,
329 const dealii::Tensor<1, dim, Number> & /*c_ij*/) const
330 {
331 return state_type{};
332 }
333
337 static constexpr bool have_high_order_flux = false;
338
342 const dealii::Tensor<1, dim, Number> &) const = delete;
343
345
349
351 static constexpr bool have_source_terms = false;
352
354 const unsigned int /*i*/,
355 const state_type & /*U_i*/,
356 const ScalarNumber /*tau*/) const = delete;
357
359 const unsigned int * /*js*/,
360 const state_type & /*U_j*/,
361 const ScalarNumber /*tau*/) const = delete;
362
364
368
379 template <typename ST>
380 state_type expand_state(const ST &state) const
381 {
382 return state;
383 }
384
389 state_type from_primitive_state(const state_type &primitive_state) const
390 {
391 return primitive_state;
392 }
393
399 {
400 return state;
401 }
402
408 template <typename Lambda>
410 const Lambda & /*lambda*/) const
411 {
412 return state;
413 }
414
415 }; /* HyperbolicSystemView */
416 } // namespace Skeleton
417} // 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")