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_STRUCTURE_DRIVER_H_
23#define INCLUDE_EXADG_STRUCTURE_DRIVER_H_
24
25// deal.II
26#include <deal.II/distributed/fully_distributed_tria.h>
27#include <deal.II/distributed/tria.h>
28
29// ExaDG
30#include <exadg/grid/mapping_dof_vector.h>
31#include <exadg/matrix_free/matrix_free_data.h>
32#include <exadg/structure/spatial_discretization/operator.h>
33#include <exadg/structure/time_integration/driver_quasi_static_problems.h>
34#include <exadg/structure/time_integration/driver_steady_problems.h>
35#include <exadg/structure/time_integration/time_int_gen_alpha.h>
36#include <exadg/structure/user_interface/application_base.h>
37#include <exadg/utilities/print_general_infos.h>
38#include <exadg/utilities/timer_tree.h>
39
40namespace ExaDG
41{
42namespace Structure
43{
44enum class OperatorType
45{
46 Evaluate, // includes inhomogeneous boundary conditions, where the nonlinear operator is evaluated
47 // in case of nonlinear problems
48 Apply // homogeneous action of operator, where the linearized operator is applied in case of
49 // nonlinear problems
50};
51
52template<int dim, typename Number>
53class Driver
54{
55public:
56 Driver(MPI_Comm const & comm,
57 std::shared_ptr<ApplicationBase<dim, Number>> application,
58 bool const is_test,
59 bool const is_throughput_study);
60
61 void
62 setup();
63
64 void
65 solve() const;
66
67 void
68 print_performance_results(double const total_time) const;
69
70 /*
71 * Throughput study
72 */
73 std::tuple<unsigned int, dealii::types::global_dof_index, double>
74 apply_operator(OperatorType const & operator_type,
75 unsigned int const n_repetitions_inner,
76 unsigned int const n_repetitions_outer) const;
77
78private:
79 // MPI communicator
80 MPI_Comm mpi_comm;
81
82 // output to std::cout
83 dealii::ConditionalOStream pcout;
84
85 // do not print wall times if is_test
86 bool const is_test;
87
88 // do not set up certain data structures (solver, postprocessor) in case of throughput study
89 bool const is_throughput_study;
90
91 // application
92 std::shared_ptr<ApplicationBase<dim, Number>> application;
93
94 std::shared_ptr<Grid<dim>> grid;
95
96 std::shared_ptr<dealii::Mapping<dim>> mapping;
97
98 std::shared_ptr<MultigridMappings<dim, Number>> multigrid_mappings;
99
100 // user parameters
101 Parameters param;
102
103 // operator
104 std::shared_ptr<Operator<dim, Number>> pde_operator;
105
106 // postprocessor
107 std::shared_ptr<PostProcessor<dim, Number>> postprocessor;
108
109 // driver steady-state
110 std::shared_ptr<DriverSteady<dim, Number>> driver_steady;
111
112 // driver quasi-static
113 std::shared_ptr<DriverQuasiStatic<dim, Number>> driver_quasi_static;
114
115 // time integration scheme
116 std::shared_ptr<TimeIntGenAlpha<dim, Number>> time_integrator;
117
118 // computation time
119 mutable TimerTree timer_tree;
120};
121
122} // namespace Structure
123} // namespace ExaDG
124
125#endif /* INCLUDE_EXADG_STRUCTURE_DRIVER_H_ */
Definition application_base.h:46
Definition driver.h:54
Definition parameters.h:40
Definition timer_tree.h:36
Definition driver.cpp:33