ExaDG
Loading...
Searching...
No Matches
driver.h
1/* ______________________________________________________________________
2 *
3 * ExaDG - High-Order Discontinuous Galerkin for the Exa-Scale
4 *
5 * Copyright (C) 2021 by the ExaDG authors
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 * ______________________________________________________________________
20 */
21
22#ifndef INCLUDE_EXADG_CONVECTION_DIFFUSION_DRIVER_H_
23#define INCLUDE_EXADG_CONVECTION_DIFFUSION_DRIVER_H_
24
25// deal.II
26#include <deal.II/base/revision.h>
27#include <deal.II/distributed/fully_distributed_tria.h>
28#include <deal.II/distributed/tria.h>
29#include <deal.II/grid/grid_generator.h>
30#include <deal.II/grid/grid_tools.h>
31#include <deal.II/grid/manifold_lib.h>
32
33// ExaDG
34#include <exadg/convection_diffusion/postprocessor/postprocessor_base.h>
35#include <exadg/convection_diffusion/spatial_discretization/interface.h>
36#include <exadg/convection_diffusion/spatial_discretization/operator.h>
37#include <exadg/convection_diffusion/time_integration/driver_steady_problems.h>
38#include <exadg/convection_diffusion/time_integration/time_int_bdf.h>
39#include <exadg/convection_diffusion/time_integration/time_int_explicit_runge_kutta.h>
40#include <exadg/convection_diffusion/user_interface/analytical_solution.h>
41#include <exadg/convection_diffusion/user_interface/application_base.h>
42#include <exadg/convection_diffusion/user_interface/boundary_descriptor.h>
43#include <exadg/convection_diffusion/user_interface/field_functions.h>
44#include <exadg/convection_diffusion/user_interface/parameters.h>
45#include <exadg/functions_and_boundary_conditions/verify_boundary_conditions.h>
46#include <exadg/grid/mapping_deformation_function.h>
47#include <exadg/matrix_free/matrix_free_data.h>
48#include <exadg/operators/adaptive_mesh_refinement.h>
49#include <exadg/utilities/print_functions.h>
50#include <exadg/utilities/print_general_infos.h>
51
52namespace ExaDG
53{
54namespace ConvDiff
55{
56enum class OperatorType
57{
58 MassOperator,
59 ConvectiveOperator,
60 DiffusiveOperator,
61 MassConvectionDiffusionOperator
62};
63
64template<int dim, typename Number = double>
65class Driver
66{
67public:
68 using VectorType = dealii::LinearAlgebra::distributed::Vector<Number>;
69
70 Driver(MPI_Comm const & mpi_comm,
71 std::shared_ptr<ApplicationBase<dim, Number>> application,
72 bool const is_test,
73 bool const is_throughput_study);
74
75 void
76 setup();
77
78 void
79 solve();
80
81 void
82 print_performance_results(double const total_time) const;
83
84 /*
85 * Throughput study
86 */
87 std::tuple<unsigned int, dealii::types::global_dof_index, double>
88 apply_operator(OperatorType const & operator_type,
89 unsigned int const n_repetitions_inner,
90 unsigned int const n_repetitions_outer) const;
91
92private:
93 void
94 ale_update() const;
95
96 void
97 mark_cells_coarsening_and_refinement(dealii::Triangulation<dim> & tria,
98 VectorType const & solution) const;
99
100 void
101 setup_after_coarsening_and_refinement();
102
103 void
104 do_adaptive_refinement();
105
106 // MPI communicator
107 MPI_Comm const mpi_comm;
108
109 // output to std::cout
110 dealii::ConditionalOStream pcout;
111
112 // do not print wall times if is_test
113 bool const is_test;
114
115 // do not set up certain data structures (solver, postprocessor) in case of throughput study
116 bool const is_throughput_study;
117
118 // application
119 std::shared_ptr<ApplicationBase<dim, Number>> application;
120
121 // Grid and mapping
122 std::shared_ptr<Grid<dim>> grid;
123
124 std::shared_ptr<dealii::Mapping<dim>> mapping;
125
126 std::shared_ptr<MultigridMappings<dim, Number>> multigrid_mappings;
127
128 // ALE mapping
129 std::shared_ptr<DeformedMappingFunction<dim, Number>> ale_mapping;
130
131 std::shared_ptr<MultigridMappings<dim, Number>> ale_multigrid_mappings;
132
133 // ALE helper functions required by time integrator
134 std::shared_ptr<HelpersALE<dim, Number>> helpers_ale;
135
136 std::shared_ptr<Operator<dim, Number>> pde_operator;
137
138 std::shared_ptr<PostProcessorBase<dim, Number>> postprocessor;
139
140 std::shared_ptr<TimeIntBase> time_integrator;
141
142 std::shared_ptr<DriverSteadyProblems<Number>> driver_steady;
143
144 // Computation time (wall clock time)
145 mutable TimerTree timer_tree;
146};
147
148} // namespace ConvDiff
149} // namespace ExaDG
150
151#endif /* INCLUDE_EXADG_CONVECTION_DIFFUSION_DRIVER_H_ */
Definition application_base.h:44
Definition driver.h:66
Definition timer_tree.h:36
Definition driver.cpp:33