ryujin 2.1.1 revision 0348cbb53a3e4b1da2a4c037e81f88f2d21ce219
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 "mpi_ensemble.h"
13#include "sparse_matrix_simd.h"
14#include "state_vector.h"
15
16#include <deal.II/base/parameter_acceptor.h>
17#include <deal.II/base/partitioner.h>
18#include <deal.II/base/smartpointer.h>
19#include <deal.II/dofs/dof_handler.h>
20#include <deal.II/lac/affine_constraints.h>
21#include <deal.II/lac/la_parallel_vector.h>
22#include <deal.II/lac/sparse_matrix.h>
23
24#include <deal.II/numerics/data_out.h>
25
26namespace ryujin
27{
51 template <int dim, typename Number = double>
52 class OfflineData : public dealii::ParameterAcceptor
53 {
54 public:
59
64
71 std::tuple<unsigned int /*i*/,
72 dealii::Tensor<1, dim, Number> /*normal*/,
73 Number /*normal mass*/,
74 Number /*boundary mass*/,
75 dealii::types::boundary_id /*id*/,
76 dealii::Point<dim>> /*position*/;
77
82 using CouplingDescription = std::tuple<unsigned int /*i*/, //
83 unsigned int /*col_idx*/,
84 unsigned int /*j*/>;
85
89 OfflineData(const MPIEnsemble &mpi_ensemble,
91 const std::string &subsection = "/OfflineData");
92
101 void prepare(const unsigned int problem_dimension,
102 const unsigned int n_precomputed_values,
103 const unsigned int n_parabolic_state_vectors)
104 {
105 setup(problem_dimension, n_precomputed_values);
106 assemble();
107 create_multigrid_data();
108
109 n_parabolic_state_vectors_ = n_parabolic_state_vectors;
110 }
111
117
118
123
129
135
141
146
159
167
174
182
195
203
209
215
221
226
234
239
245
251
256
267
272
277
278 private:
283
288 void create_constraints_and_sparsity_pattern();
289
297 void setup(const unsigned int problem_dimension,
298 const unsigned int n_precomputed_values);
299
303 void assemble();
304
308 void create_multigrid_data();
309
311
315
316 const MPIEnsemble &mpi_ensemble_;
317
318 std::unique_ptr<dealii::DoFHandler<dim>> dof_handler_;
319
320 dealii::AffineConstraints<Number> affine_constraints_;
321
322 std::shared_ptr<const dealii::Utilities::MPI::Partitioner>
323 scalar_partitioner_;
324
325 std::shared_ptr<const dealii::Utilities::MPI::Partitioner>
326 hyperbolic_vector_partitioner_;
327
328 std::shared_ptr<const dealii::Utilities::MPI::Partitioner>
329 precomputed_vector_partitioner_;
330
331 unsigned int n_parabolic_state_vectors_;
332
333 unsigned int n_export_indices_;
334 unsigned int n_locally_internal_;
335 unsigned int n_locally_owned_;
336 unsigned int n_locally_relevant_;
337
338 using BoundaryMap = std::vector<BoundaryDescription>;
339 BoundaryMap boundary_map_;
340 std::vector<BoundaryMap> level_boundary_map_;
341
342 using CouplingBoundaryPairs = std::vector<CouplingDescription>;
343 CouplingBoundaryPairs coupling_boundary_pairs_;
344
345 dealii::DynamicSparsityPattern sparsity_pattern_;
346
347 SparsityPatternSIMD<dealii::VectorizedArray<Number>::size()>
348 sparsity_pattern_simd_;
349
350 SparseMatrixSIMD<Number> mass_matrix_;
351 SparseMatrixSIMD<Number> mass_matrix_inverse_;
352
353 ScalarVector lumped_mass_matrix_;
354 ScalarVector lumped_mass_matrix_inverse_;
355
356 std::vector<ScalarVectorFloat> level_lumped_mass_matrix_;
357
358 SparseMatrixSIMD<Number, dim> cij_matrix_;
359 SparseMatrixSIMD<Number> incidence_matrix_;
360
361 Number measure_of_omega_;
362
363 dealii::SmartPointer<const Discretization<dim>> discretization_;
364
368 template <typename ITERATOR1, typename ITERATOR2>
369 BoundaryMap construct_boundary_map(
370 const ITERATOR1 &begin,
371 const ITERATOR2 &end,
372 const dealii::Utilities::MPI::Partitioner &partitioner) const;
373
378 template <typename ITERATOR1, typename ITERATOR2>
379 CouplingBoundaryPairs collect_coupling_boundary_pairs(
380 const ITERATOR1 &begin,
381 const ITERATOR2 &end,
382 const dealii::Utilities::MPI::Partitioner &partitioner) const;
383
385
389
390 double incidence_relaxation_even_;
391 double incidence_relaxation_odd_;
392
394 };
395
396} /* namespace ryujin */
Vectors::ScalarVector< float > ScalarVectorFloat
Definition: offline_data.h:63
auto & cij_matrix() const
Definition: offline_data.h:255
auto & dof_handler() const
Definition: offline_data.h:116
auto & n_locally_owned() const
Definition: offline_data.h:173
auto & incidence_matrix() const
Definition: offline_data.h:266
const auto & scalar_partitioner() const
Definition: offline_data.h:128
void prepare(const unsigned int problem_dimension, const unsigned int n_precomputed_values, const unsigned int n_parabolic_state_vectors)
Definition: offline_data.h:101
auto & n_locally_internal() const
Definition: offline_data.h:166
auto & coupling_boundary_pairs() const
Definition: offline_data.h:202
auto & boundary_map() const
Definition: offline_data.h:194
auto & sparsity_pattern() const
Definition: offline_data.h:214
auto & level_lumped_mass_matrix() const
Definition: offline_data.h:250
auto & mass_matrix_inverse() const
Definition: offline_data.h:233
const auto & hyperbolic_vector_partitioner() const
Definition: offline_data.h:134
auto & discretization() const
Definition: offline_data.h:276
const auto & precomputed_vector_partitioner() const
Definition: offline_data.h:140
std::tuple< unsigned int, unsigned int, unsigned int > CouplingDescription
Definition: offline_data.h:84
auto & mass_matrix() const
Definition: offline_data.h:225
auto & sparsity_pattern_simd() const
Definition: offline_data.h:220
Vectors::ScalarVector< Number > ScalarVector
Definition: offline_data.h:58
auto & n_parabolic_state_vectors() const
Definition: offline_data.h:145
auto & lumped_mass_matrix() const
Definition: offline_data.h:238
std::tuple< unsigned int, dealii::Tensor< 1, dim, Number >, Number, Number, dealii::types::boundary_id, dealii::Point< dim > > BoundaryDescription
Definition: offline_data.h:76
auto & n_locally_relevant() const
Definition: offline_data.h:181
auto & level_boundary_map() const
Definition: offline_data.h:208
OfflineData(const MPIEnsemble &mpi_ensemble, const Discretization< dim > &discretization, const std::string &subsection="/OfflineData")
auto & measure_of_omega() const
Definition: offline_data.h:271
auto & lumped_mass_matrix_inverse() const
Definition: offline_data.h:244
auto & n_export_indices() const
Definition: offline_data.h:158
auto & affine_constraints() const
Definition: offline_data.h:122
#define ACCESSOR_READ_ONLY(member)
#define ACCESSOR_READ_ONLY_NO_DEREFERENCE(member)
dealii::LinearAlgebra::distributed::Vector< Number > ScalarVector
Definition: state_vector.h:31