ryujin 2.1.1 revision 6759a3f00bf045f3527c5e7e7dfd18c7d96a6edb
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 "offline_data.h"
13#include "simd.h"
14#include "sparse_matrix_simd.h"
15
16#include <deal.II/base/parameter_acceptor.h>
17#include <deal.II/base/timer.h>
18#include <deal.II/lac/sparse_matrix.templates.h>
19#include <deal.II/lac/vector.h>
20
21#include <functional>
22
23namespace ryujin
24{
44 warn,
45
52 };
53
54
61 class Restart final
62 {
63 };
64
65
74 template <typename Description, int dim, typename Number = double>
75 class HyperbolicModule final : public dealii::ParameterAcceptor
76 {
77 public:
82
86 using View =
87 typename Description::template HyperbolicSystemView<dim, Number>;
88
92 static constexpr unsigned int problem_dimension = View::problem_dimension;
93
97 using state_type = typename View::state_type;
98
103
107 using vector_type = typename View::vector_type;
108
112 static constexpr unsigned int n_precomputed_values =
113 View::n_precomputed_values;
114
118 static constexpr unsigned int n_precomputation_cycles =
119 View::n_precomputation_cycles;
120
124 using precomputed_vector_type = typename View::precomputed_vector_type;
125
129 static constexpr unsigned int n_precomputed_initial_values =
130 View::n_precomputed_initial_values;
131
136 typename View::precomputed_initial_vector_type;
137
138
143 const MPI_Comm &mpi_communicator,
144 std::map<std::string, dealii::Timer> &computing_timer,
147 const InitialValues<Description, dim, Number> &initial_values,
148 const std::string &subsection = "/HyperbolicModule");
149
155 void prepare();
156
161
220 template <int stages>
221 Number
222 step(const vector_type &old_U,
223 std::array<std::reference_wrapper<const vector_type>, stages> stage_U,
224 std::array<std::reference_wrapper<const precomputed_vector_type>,
225 stages> stage_precomputed,
226 const std::array<Number, stages> stage_weights,
227 vector_type &new_U,
228 precomputed_vector_type &new_precomputed,
229 Number tau = Number(0.)) const;
230
244 void apply_boundary_conditions(vector_type &U, Number t) const;
245
253 void cfl(Number new_cfl) const
254 {
255 Assert(cfl_ > Number(0.), dealii::ExcInternalError());
256 cfl_ = new_cfl;
257 }
258
264
265
269
274
279
287
292
298
299 // FIXME: refactor to function
300 mutable bool precompute_only_;
301
302 // FIXME: refactor to function
304
305 private:
307
311 typename Description::template Indicator<dim, Number>::Parameters
312 indicator_parameters_;
313
314 typename Description::template Limiter<dim, Number>::Parameters
315 limiter_parameters_;
316
317 typename Description::template RiemannSolver<dim, Number>::Parameters
318 riemann_solver_parameters_;
319
320 bool cfl_with_boundary_dofs_;
321
323
325
329
330 const MPI_Comm &mpi_communicator_;
331 std::map<std::string, dealii::Timer> &computing_timer_;
332
333 dealii::SmartPointer<const OfflineData<dim, Number>> offline_data_;
334 dealii::SmartPointer<const HyperbolicSystem> hyperbolic_system_;
335 dealii::SmartPointer<const InitialValues<Description, dim, Number>>
336 initial_values_;
337
338 mutable Number cfl_;
339
340 mutable unsigned int n_restarts_;
341
342 mutable unsigned int n_warnings_;
343
344 precomputed_initial_vector_type precomputed_initial_;
345
346 mutable scalar_type alpha_;
347
348 static constexpr auto n_bounds =
349 Description::template Limiter<dim, Number>::n_bounds;
350 mutable MultiComponentVector<Number, n_bounds> bounds_;
351
352 mutable vector_type r_;
353
354 mutable SparseMatrixSIMD<Number> dij_matrix_;
355 mutable SparseMatrixSIMD<Number> lij_matrix_;
356 mutable SparseMatrixSIMD<Number> lij_matrix_next_;
357 mutable SparseMatrixSIMD<Number, problem_dimension> pij_matrix_;
358
360 };
361
362} /* namespace ryujin */
auto & hyperbolic_system() const
static constexpr unsigned int problem_dimension
static constexpr unsigned int n_precomputation_cycles
typename Description::HyperbolicSystem HyperbolicSystem
HyperbolicModule(const MPI_Comm &mpi_communicator, 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")
typename View::state_type state_type
typename View::precomputed_initial_vector_type precomputed_initial_vector_type
void apply_boundary_conditions(vector_type &U, Number t) const
auto & precomputed_initial() const
typename Description::template HyperbolicSystemView< dim, Number > View
static constexpr unsigned int n_precomputed_values
typename OfflineData< dim, Number >::scalar_type scalar_type
typename View::vector_type vector_type
typename View::precomputed_vector_type precomputed_vector_type
void cfl(Number new_cfl) const
IDViolationStrategy id_violation_strategy_
Number step(const vector_type &old_U, std::array< std::reference_wrapper< const vector_type >, stages > stage_U, std::array< std::reference_wrapper< const precomputed_vector_type >, stages > stage_precomputed, const std::array< Number, stages > stage_weights, vector_type &new_U, precomputed_vector_type &new_precomputed, Number tau=Number(0.)) const
static constexpr unsigned int n_precomputed_initial_values
#define ACCESSOR_READ_ONLY(member)
Euler::HyperbolicSystem HyperbolicSystem
Definition: description.h:32