ryujin 2.1.1 revision 863a4d36dcc743d4e1a9b41cfabd03d0aea57863
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/base/smartpointer.h>
18#include <deal.II/dofs/dof_handler.h>
19#include <deal.II/lac/affine_constraints.h>
20#include <deal.II/lac/la_parallel_vector.h>
21#include <deal.II/lac/sparse_matrix.h>
22
23#include <deal.II/numerics/data_out.h>
24
25namespace ryujin
26{
47 template <int dim, typename Number = double>
48 class OfflineData : public dealii::ParameterAcceptor
49 {
50 public:
55
60
67 std::tuple<unsigned int /*i*/,
68 dealii::Tensor<1, dim, Number> /*normal*/,
69 Number /*normal mass*/,
70 Number /*boundary mass*/,
71 dealii::types::boundary_id /*id*/,
72 dealii::Point<dim>> /*position*/;
73
78 using CouplingDescription = std::tuple<unsigned int /*i*/, //
79 unsigned int /*col_idx*/,
80 unsigned int /*j*/>;
81
85 OfflineData(const MPI_Comm &mpi_communicator,
87 const std::string &subsection = "/OfflineData");
88
97 void prepare(const unsigned int problem_dimension,
98 const unsigned int n_precomputed_values)
99 {
100 setup(problem_dimension, n_precomputed_values);
101 assemble();
102 create_multigrid_data();
103 }
104
110
111
116
122
128
134
147
155
162
170
183
191
197
203
209
214
222
227
233
239
244
255
260
265
266 private:
271
276 void create_constraints_and_sparsity_pattern();
277
285 void setup(const unsigned int problem_dimension,
286 const unsigned int n_precomputed_values);
287
291 void assemble();
292
296 void create_multigrid_data();
297
298 std::unique_ptr<dealii::DoFHandler<dim>> dof_handler_;
299
300 dealii::AffineConstraints<Number> affine_constraints_;
301
302 std::shared_ptr<const dealii::Utilities::MPI::Partitioner>
303 scalar_partitioner_;
304
305 std::shared_ptr<const dealii::Utilities::MPI::Partitioner>
306 hyperbolic_vector_partitioner_;
307
308 std::shared_ptr<const dealii::Utilities::MPI::Partitioner>
309 precomputed_vector_partitioner_;
310
311 unsigned int n_export_indices_;
312 unsigned int n_locally_internal_;
313 unsigned int n_locally_owned_;
314 unsigned int n_locally_relevant_;
315
316 using BoundaryMap = std::vector<BoundaryDescription>;
317 BoundaryMap boundary_map_;
318 std::vector<BoundaryMap> level_boundary_map_;
319
320 using CouplingBoundaryPairs = std::vector<CouplingDescription>;
321 CouplingBoundaryPairs coupling_boundary_pairs_;
322
323 dealii::DynamicSparsityPattern sparsity_pattern_;
324
325 SparsityPatternSIMD<dealii::VectorizedArray<Number>::size()>
326 sparsity_pattern_simd_;
327
328 SparseMatrixSIMD<Number> mass_matrix_;
329 SparseMatrixSIMD<Number> mass_matrix_inverse_;
330
331 ScalarVector lumped_mass_matrix_;
332 ScalarVector lumped_mass_matrix_inverse_;
333
334 std::vector<ScalarVectorFloat> level_lumped_mass_matrix_;
335
336 SparseMatrixSIMD<Number, dim> cij_matrix_;
337 SparseMatrixSIMD<Number> incidence_matrix_;
338
339 Number measure_of_omega_;
340
341 dealii::SmartPointer<const Discretization<dim>> discretization_;
342
343 const MPI_Comm &mpi_communicator_;
344
348 template <typename ITERATOR1, typename ITERATOR2>
349 BoundaryMap construct_boundary_map(
350 const ITERATOR1 &begin,
351 const ITERATOR2 &end,
352 const dealii::Utilities::MPI::Partitioner &partitioner) const;
353
358 template <typename ITERATOR1, typename ITERATOR2>
359 CouplingBoundaryPairs collect_coupling_boundary_pairs(
360 const ITERATOR1 &begin,
361 const ITERATOR2 &end,
362 const dealii::Utilities::MPI::Partitioner &partitioner) const;
363
365
369
370 double incidence_relaxation_even_;
371 double incidence_relaxation_odd_;
372
374 };
375
376} /* namespace ryujin */
Vectors::ScalarVector< float > ScalarVectorFloat
Definition: offline_data.h:59
auto & cij_matrix() const
Definition: offline_data.h:243
auto & dof_handler() const
Definition: offline_data.h:109
auto & n_locally_owned() const
Definition: offline_data.h:161
void prepare(const unsigned int problem_dimension, const unsigned int n_precomputed_values)
Definition: offline_data.h:97
auto & incidence_matrix() const
Definition: offline_data.h:254
const auto & scalar_partitioner() const
Definition: offline_data.h:121
auto & n_locally_internal() const
Definition: offline_data.h:154
auto & coupling_boundary_pairs() const
Definition: offline_data.h:190
auto & boundary_map() const
Definition: offline_data.h:182
auto & sparsity_pattern() const
Definition: offline_data.h:202
auto & level_lumped_mass_matrix() const
Definition: offline_data.h:238
auto & mass_matrix_inverse() const
Definition: offline_data.h:221
const auto & hyperbolic_vector_partitioner() const
Definition: offline_data.h:127
auto & discretization() const
Definition: offline_data.h:264
const auto & precomputed_vector_partitioner() const
Definition: offline_data.h:133
std::tuple< unsigned int, unsigned int, unsigned int > CouplingDescription
Definition: offline_data.h:80
auto & mass_matrix() const
Definition: offline_data.h:213
auto & sparsity_pattern_simd() const
Definition: offline_data.h:208
Vectors::ScalarVector< Number > ScalarVector
Definition: offline_data.h:54
auto & lumped_mass_matrix() const
Definition: offline_data.h:226
std::tuple< unsigned int, dealii::Tensor< 1, dim, Number >, Number, Number, dealii::types::boundary_id, dealii::Point< dim > > BoundaryDescription
Definition: offline_data.h:72
auto & n_locally_relevant() const
Definition: offline_data.h:169
auto & level_boundary_map() const
Definition: offline_data.h:196
OfflineData(const MPI_Comm &mpi_communicator, const Discretization< dim > &discretization, const std::string &subsection="/OfflineData")
auto & measure_of_omega() const
Definition: offline_data.h:259
auto & lumped_mass_matrix_inverse() const
Definition: offline_data.h:232
auto & n_export_indices() const
Definition: offline_data.h:146
auto & affine_constraints() const
Definition: offline_data.h:115
#define ACCESSOR_READ_ONLY(member)
#define ACCESSOR_READ_ONLY_NO_DEREFERENCE(member)
dealii::LinearAlgebra::distributed::Vector< Number > ScalarVector
Definition: state_vector.h:31