ryujin 2.1.1 revision 955e869188d49b3c97ca7b1cf4fd9ceb0e6f46ef
hyperbolic_module.h
Go to the documentation of this file.
1//
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3// Copyright (C) 2020 - 2024 by the ryujin authors
4//
5
6#pragma once
7
8#include <compile_time_options.h>
9
10#include "convenience_macros.h"
11#include "initial_values.h"
12#include "mpi_ensemble.h"
13#include "offline_data.h"
14#include "sparse_matrix_simd.h"
15#include "state_vector.h"
16
17#include <deal.II/base/parameter_acceptor.h>
18#include <deal.II/base/smartpointer.h>
19#include <deal.II/base/timer.h>
20#include <deal.II/lac/sparse_matrix.templates.h>
21#include <deal.II/lac/vector.h>
22
23#include <functional>
24
25namespace ryujin
26{
43 enum class IDViolationStrategy : std::uint8_t {
48 warn,
49
56 };
57
58
65 class Restart final
66 {
67 };
68
69
78 template <typename Description, int dim, typename Number = double>
79 class HyperbolicModule final : public dealii::ParameterAcceptor
80 {
81 public:
86
88
89 using View =
90 typename Description::template HyperbolicSystemView<dim, Number>;
91
92 static constexpr auto problem_dimension = View::problem_dimension;
93
94 using state_type = typename View::state_type;
95
96 using precomputed_type = typename View::precomputed_type;
97
98 using initial_precomputed_type = typename View::initial_precomputed_type;
99
101
102 using InitialPrecomputedVector = typename View::InitialPrecomputedVector;
103
104 static constexpr auto n_precomputation_cycles =
105 View::n_precomputation_cycles;
106
108
112
117 const MPIEnsemble &mpi_ensemble,
118 std::map<std::string, dealii::Timer> &computing_timer,
121 const InitialValues<Description, dim, Number> &initial_values,
122 const std::string &subsection = "/HyperbolicModule");
123
129 void prepare();
130
132
136
157 void prepare_state_vector(StateVector &state_vector, Number t) const;
158
221 template <int stages>
222 Number step(
223 const StateVector &old_state_vector,
224 std::array<std::reference_wrapper<const StateVector>, stages>
225 stage_state_vectors,
226 const std::array<Number, stages> stage_weights,
227 StateVector &new_state_vector,
228 Number tau = Number(0.),
229 std::atomic<Number> tau_max = std::numeric_limits<Number>::max()) const;
230
238 void cfl(Number new_cfl) const
239 {
240 Assert(cfl_ > Number(0.), dealii::ExcInternalError());
241 cfl_ = new_cfl;
242 }
243
249
250
254
259
264
271
276
282
283 // FIXME: refactor to function
285
286 private:
288
292 typename Description::template Indicator<dim, Number>::Parameters
293 indicator_parameters_;
294
295 typename Description::template Limiter<dim, Number>::Parameters
296 limiter_parameters_;
297
298 typename Description::template RiemannSolver<dim, Number>::Parameters
299 riemann_solver_parameters_;
300
302
304
308
309 const MPIEnsemble &mpi_ensemble_;
310 std::map<std::string, dealii::Timer> &computing_timer_;
311
312 dealii::SmartPointer<const OfflineData<dim, Number>> offline_data_;
313 dealii::SmartPointer<const HyperbolicSystem> hyperbolic_system_;
314 dealii::SmartPointer<const InitialValues<Description, dim, Number>>
315 initial_values_;
316
317 mutable Number cfl_;
318
319 mutable unsigned int n_restarts_;
320
321 mutable unsigned int n_warnings_;
322
323 InitialPrecomputedVector initial_precomputed_;
324
325 using ScalarVector = typename Vectors::ScalarVector<Number>;
326 mutable ScalarVector alpha_;
327
328 static constexpr auto n_bounds =
329 Description::template Limiter<dim, Number>::n_bounds;
330 mutable Vectors::MultiComponentVector<Number, n_bounds> bounds_;
331
332 using HyperbolicVector =
333 Vectors::MultiComponentVector<Number, problem_dimension>;
334 mutable HyperbolicVector r_;
335
336 mutable SparseMatrixSIMD<Number> dij_matrix_;
337 mutable SparseMatrixSIMD<Number> lij_matrix_;
338 mutable SparseMatrixSIMD<Number> lij_matrix_next_;
339 mutable SparseMatrixSIMD<Number, problem_dimension> pij_matrix_;
340
342 };
343
344} /* namespace ryujin */
const auto & n_warnings() const
HyperbolicModule(const MPIEnsemble &mpi_ensemble, std::map< std::string, dealii::Timer > &computing_timer, const OfflineData< dim, Number > &offline_data, const HyperbolicSystem &hyperbolic_system, const InitialValues< Description, dim, Number > &initial_values, const std::string &subsection="/HyperbolicModule")
static constexpr auto problem_dimension
typename View::initial_precomputed_type initial_precomputed_type
static constexpr auto n_precomputation_cycles
typename Description::HyperbolicSystem HyperbolicSystem
typename View::StateVector StateVector
typename View::precomputed_type precomputed_type
typename View::state_type state_type
const auto & cfl() const
const auto & alpha() const
typename Description::template HyperbolicSystemView< dim, Number > View
typename View::InitialPrecomputedVector InitialPrecomputedVector
Number step(const StateVector &old_state_vector, std::array< std::reference_wrapper< const StateVector >, stages > stage_state_vectors, const std::array< Number, stages > stage_weights, StateVector &new_state_vector, Number tau=Number(0.), std::atomic< Number > tau_max=std::numeric_limits< Number >::max()) const
const auto & hyperbolic_system() const
void cfl(Number new_cfl) const
IDViolationStrategy id_violation_strategy_
const auto & offline_data() const
void prepare_state_vector(StateVector &state_vector, Number t) const
const auto & n_restarts() const
const auto & initial_precomputed() const
#define ACCESSOR_READ_ONLY(member)
std::tuple< MultiComponentVector< Number, problem_dim >, MultiComponentVector< Number, prec_dim >, BlockVector< Number > > StateVector
Definition: state_vector.h:51
Euler::HyperbolicSystem HyperbolicSystem
Definition: description.h:32