Sapphire++
 v1.3.0-121-g2682132
Loading...
Searching...
No Matches
pde-system.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2//
3// Copyright (C) 2023 by the Sapphire++ authors
4//
5// This file is part of Sapphire++.
6//
7// Sapphire++ is free software: you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License as published by the Free
9// Software Foundation, either version 3 of the License, or (at your option) any
10// later version.
11//
12// Sapphire++ is distributed in the hope that it will be useful, but WITHOUT ANY
13// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14// A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
15// details.
16//
17// You should have received a copy of the GNU Lesser General Public License
18// along with Sapphire++. If not, see <https://www.gnu.org/licenses/>.
19//
20// -----------------------------------------------------------------------------
21
28
29#ifndef VFP_PDESYSTEM_H
30#define VFP_PDESYSTEM_H
31
32#include <deal.II/base/table.h>
33
34#include <deal.II/dofs/dof_tools.h>
35
36#include <deal.II/lac/lapack_full_matrix.h>
37#include <deal.II/lac/vector.h>
38
39#include <array>
40#include <ostream>
41#include <string>
42#include <vector>
43
44#include "vfp-flags.h"
45
46namespace sapphirepp
47{
48 namespace VFP
49 {
58 {
59 public:
62 const unsigned int expansion_order;
63
70 const unsigned int system_size;
71
78 const std::vector<std::array<unsigned int, 3>> lms_indices;
80
81
82
84 PDESystem(const unsigned int expansion_order);
85
86
97 static std::vector<std::array<unsigned int, 3>>
98 create_lms_indices(const unsigned int system_size);
99
109 static std::vector<std::string>
110 create_component_name_list(const unsigned int system_size,
111 const std::string &prefix = "f_");
113
114
115
124 void
126 const unsigned int dim_cs,
127 const VFPFlags vfp_flags,
128 dealii::Table<2, dealii::DoFTools::Coupling> &cell_integrals_mask,
129 dealii::Table<2, dealii::DoFTools::Coupling> &face_integrals_mask)
130 const;
131
132
133
140 const std::vector<dealii::LAPACKFullMatrix<double>> &
142
148 const std::vector<dealii::LAPACKFullMatrix<double>> &
150
156 const dealii::Vector<double> &
157 get_collision_matrix() const;
158
164 const std::vector<dealii::LAPACKFullMatrix<double>> &
165 get_adv_mat_products() const;
166
172 const std::vector<dealii::LAPACKFullMatrix<double>> &
173 get_adv_cross_gen() const;
174
180 const std::vector<dealii::LAPACKFullMatrix<double>> &
181 get_t_matrices() const;
183
184
185
193 template <typename StreamType>
194 void
195 print_lms_indices(StreamType &os) const
196 {
197 os << "Ordering of the lms indices: " << std::endl;
198 unsigned int i = 0;
199 for (const std::array<unsigned int, 3> &lms : lms_indices)
200 {
201 os << i << ": " << lms[0] << lms[1] << lms[2] << "\n";
202 ++i;
203 }
204 os << std::endl;
205 }
206
212 void
213 print_advection_matrices(std::ostream &os) const;
214
220 void
221 print_generator_rotation_matrices(std::ostream &os) const;
222
228 void
229 print_collision_matrix(std::ostream &os) const;
230
236 void
237 print_adv_mat_products(std::ostream &os) const;
238
244 void
245 print_adv_cross_gen(std::ostream &os) const;
246
252 void
253 print_t_matrices(std::ostream &os) const;
254
260 void
261 print_pde_system(std::ostream &os) const;
263
264
265
266 private:
269 std::vector<dealii::LAPACKFullMatrix<double>> advection_matrices;
270
272 std::vector<dealii::LAPACKFullMatrix<double>> generator_rotation_matrices;
273
275 dealii::Vector<double> collision_matrix;
276
278 std::vector<dealii::LAPACKFullMatrix<double>> adv_mat_products;
279
281 std::vector<dealii::LAPACKFullMatrix<double>> adv_x_gen_matrices;
282
284 std::vector<dealii::LAPACKFullMatrix<double>> t_matrices;
286
287
288
289 void
290 create_advection_matrices();
291 void
292 create_generator_rotation_matrices();
293 void
294 create_collision_matrix();
295 void
296 compute_adv_mat_products();
297 void
298 compute_adv_cross_generators();
299 void
300 compute_t_matrices();
301 void
302 shrink_matrices();
303 };
304 } // namespace VFP
305} // namespace sapphirepp
306#endif
static std::vector< std::string > create_component_name_list(const unsigned int system_size, const std::string &prefix="f_")
Create a list of component names, f_lms.
Definition pde-system.cpp:81
const dealii::Vector< double > & get_collision_matrix() const
Get the collision matrix object.
Definition pde-system.cpp:210
const std::vector< dealii::LAPACKFullMatrix< double > > & get_generator_rotation_matrices() const
Get the generator rotation matrices object.
Definition pde-system.cpp:202
const std::vector< std::array< unsigned int, 3 > > lms_indices
Map between system index and spherical harmonic indices .
Definition pde-system.h:78
const std::vector< dealii::LAPACKFullMatrix< double > > & get_adv_mat_products() const
Get the adv mat products object.
Definition pde-system.cpp:218
void print_pde_system(std::ostream &os) const
Print the full PDE system.
Definition pde-system.cpp:334
const unsigned int system_size
Size of the system.
Definition pde-system.h:70
void print_adv_mat_products(std::ostream &os) const
Print the adv mat products.
Definition pde-system.cpp:280
PDESystem(const unsigned int expansion_order)
Definition pde-system.cpp:34
void print_generator_rotation_matrices(std::ostream &os) const
Print the generator rotation matrices.
Definition pde-system.cpp:256
const std::vector< dealii::LAPACKFullMatrix< double > > & get_adv_cross_gen() const
Get the adv cross gen object.
Definition pde-system.cpp:226
const unsigned int expansion_order
Definition pde-system.h:62
static std::vector< std::array< unsigned int, 3 > > create_lms_indices(const unsigned int system_size)
Create a mapping between the system index and the spherical harmonic indices .
Definition pde-system.cpp:56
void compute_coupling_tables(const unsigned int dim_cs, const VFPFlags vfp_flags, dealii::Table< 2, dealii::DoFTools::Coupling > &cell_integrals_mask, dealii::Table< 2, dealii::DoFTools::Coupling > &face_integrals_mask) const
Compute the coupling tables.
Definition pde-system.cpp:101
const std::vector< dealii::LAPACKFullMatrix< double > > & get_t_matrices() const
Get the t matrices object.
Definition pde-system.cpp:234
void print_t_matrices(std::ostream &os) const
Print the t matrices.
Definition pde-system.cpp:314
void print_collision_matrix(std::ostream &os) const
Print the collision matrix.
Definition pde-system.cpp:271
void print_lms_indices(StreamType &os) const
Print the lms indices ordering.
Definition pde-system.h:195
void print_adv_cross_gen(std::ostream &os) const
Print the adv cross gen.
Definition pde-system.cpp:300
void print_advection_matrices(std::ostream &os) const
Print the advection matrices.
Definition pde-system.cpp:242
const std::vector< dealii::LAPACKFullMatrix< double > > & get_advection_matrices() const
Get the advection matrices object.
Definition pde-system.cpp:194
Namespace for the Vlasov-Fokker-Planck module.
Definition config.h:123
VFPFlags
Flags to activate the different terms of the VFP equation.
Definition vfp-flags.h:75
constexpr VFPFlags vfp_flags
Definition config.h:135
Namespace for Sapphire+⁠+.
Definition config.h:51
Define sapphirepp::VFP::VFPFlags and other enums used by the sapphirepp::VFP module.