ryujin 2.1.1 revision 4c829a125920046d39a74afd45eabb6cc28a8170
offline_data.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 "discretization.h"
12#include "sparse_matrix_simd.h"
13#include "state_vector.h"
14
15#include <deal.II/base/parameter_acceptor.h>
16#include <deal.II/base/partitioner.h>
17#include <deal.II/dofs/dof_handler.h>
18#include <deal.II/lac/affine_constraints.h>
19#include <deal.II/lac/la_parallel_vector.h>
20#include <deal.II/lac/sparse_matrix.h>
21
22#include <deal.II/numerics/data_out.h>
23
24namespace ryujin
25{
46 template <int dim, typename Number = double>
47 class OfflineData : public dealii::ParameterAcceptor
48 {
49 public:
54
59
66 std::tuple<dealii::Tensor<1, dim, Number> /*normal*/,
67 Number /*normal mass*/,
68 Number /*boundary mass*/,
69 dealii::types::boundary_id /*id*/,
70 dealii::Point<dim>> /*position*/;
71
75 OfflineData(const MPI_Comm &mpi_communicator,
77 const std::string &subsection = "/OfflineData");
78
87 void prepare(const unsigned int problem_dimension,
88 const unsigned int n_precomputed_values)
89 {
90 setup(problem_dimension, n_precomputed_values);
91 assemble();
92 create_multigrid_data();
93 }
94
100
101
106
112
118
124
137
145
152
160
173
181
187
193
199
204
212
217
223
229
234
245
250
255
256 private:
261
266 void create_constraints_and_sparsity_pattern();
267
275 void setup(const unsigned int problem_dimension,
276 const unsigned int n_precomputed_values);
277
281 void assemble();
282
286 void create_multigrid_data();
287
288 std::unique_ptr<dealii::DoFHandler<dim>> dof_handler_;
289
290 dealii::AffineConstraints<Number> affine_constraints_;
291
292 std::shared_ptr<const dealii::Utilities::MPI::Partitioner>
293 scalar_partitioner_;
294
295 std::shared_ptr<const dealii::Utilities::MPI::Partitioner>
296 state_vector_partitioner_;
297
298 std::shared_ptr<const dealii::Utilities::MPI::Partitioner>
299 precomputed_vector_partitioner_;
300
301 unsigned int n_export_indices_;
302 unsigned int n_locally_internal_;
303 unsigned int n_locally_owned_;
304 unsigned int n_locally_relevant_;
305
306 using BoundaryMap =
307 std::multimap<dealii::types::global_dof_index, boundary_description>;
308 using CouplingBoundaryPairs =
309 std::vector<std::tuple<dealii::types::global_dof_index,
310 unsigned int,
311 dealii::types::global_dof_index>>;
312 BoundaryMap boundary_map_;
313 CouplingBoundaryPairs coupling_boundary_pairs_;
314
315 std::vector<BoundaryMap> level_boundary_map_;
316
317 dealii::DynamicSparsityPattern sparsity_pattern_;
318
319 SparsityPatternSIMD<dealii::VectorizedArray<Number>::size()>
320 sparsity_pattern_simd_;
321
322 SparseMatrixSIMD<Number> mass_matrix_;
323 SparseMatrixSIMD<Number> mass_matrix_inverse_;
324
325 ScalarVector lumped_mass_matrix_;
326 ScalarVector lumped_mass_matrix_inverse_;
327
328 std::vector<ScalarVectorFloat> level_lumped_mass_matrix_;
329
330 SparseMatrixSIMD<Number, dim> cij_matrix_;
331 SparseMatrixSIMD<Number> incidence_matrix_;
332
333 Number measure_of_omega_;
334
335 dealii::SmartPointer<const Discretization<dim>> discretization_;
336
337 const MPI_Comm &mpi_communicator_;
338
342 template <typename ITERATOR1, typename ITERATOR2>
343 BoundaryMap construct_boundary_map(
344 const ITERATOR1 &begin,
345 const ITERATOR2 &end,
346 const dealii::Utilities::MPI::Partitioner &partitioner) const;
347
352 template <typename ITERATOR1, typename ITERATOR2>
353 CouplingBoundaryPairs collect_coupling_boundary_pairs(
354 const ITERATOR1 &begin,
355 const ITERATOR2 &end,
356 const dealii::Utilities::MPI::Partitioner &partitioner) const;
357
359
363
364 double incidence_relaxation_even_;
365 double incidence_relaxation_odd_;
366
368 };
369
370} /* namespace ryujin */
Vectors::ScalarVector< float > ScalarVectorFloat
Definition: offline_data.h:58
auto & cij_matrix() const
Definition: offline_data.h:233
auto & dof_handler() const
Definition: offline_data.h:99
auto & n_locally_owned() const
Definition: offline_data.h:151
void prepare(const unsigned int problem_dimension, const unsigned int n_precomputed_values)
Definition: offline_data.h:87
auto & incidence_matrix() const
Definition: offline_data.h:244
const auto & scalar_partitioner() const
Definition: offline_data.h:111
auto & n_locally_internal() const
Definition: offline_data.h:144
auto & coupling_boundary_pairs() const
Definition: offline_data.h:180
auto & boundary_map() const
Definition: offline_data.h:172
auto & sparsity_pattern() const
Definition: offline_data.h:192
std::tuple< dealii::Tensor< 1, dim, Number >, Number, Number, dealii::types::boundary_id, dealii::Point< dim > > boundary_description
Definition: offline_data.h:70
auto & level_lumped_mass_matrix() const
Definition: offline_data.h:228
auto & mass_matrix_inverse() const
Definition: offline_data.h:211
auto & discretization() const
Definition: offline_data.h:254
const auto & precomputed_vector_partitioner() const
Definition: offline_data.h:123
const auto & state_vector_partitioner() const
Definition: offline_data.h:117
auto & mass_matrix() const
Definition: offline_data.h:203
auto & sparsity_pattern_simd() const
Definition: offline_data.h:198
Vectors::ScalarVector< Number > ScalarVector
Definition: offline_data.h:53
auto & lumped_mass_matrix() const
Definition: offline_data.h:216
auto & n_locally_relevant() const
Definition: offline_data.h:159
auto & level_boundary_map() const
Definition: offline_data.h:186
OfflineData(const MPI_Comm &mpi_communicator, const Discretization< dim > &discretization, const std::string &subsection="/OfflineData")
auto & measure_of_omega() const
Definition: offline_data.h:249
auto & lumped_mass_matrix_inverse() const
Definition: offline_data.h:222
auto & n_export_indices() const
Definition: offline_data.h:136
auto & affine_constraints() const
Definition: offline_data.h:105
#define ACCESSOR_READ_ONLY(member)
#define ACCESSOR_READ_ONLY_NO_DEREFERENCE(member)
dealii::LinearAlgebra::distributed::Vector< Number > ScalarVector
Definition: state_vector.h:25