ExaDG
Loading...
Searching...
No Matches
driver.h
1/* ______________________________________________________________________
2 *
3 * ExaDG - High-Order Discontinuous Galerkin for the Exa-Scale
4 *
5 * Copyright (C) 2023 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 EXADG_ACOUSTIC_CONSERVATION_EQUATIONS_DRIVER_H_
23#define EXADG_ACOUSTIC_CONSERVATION_EQUATIONS_DRIVER_H_
24
25#include <exadg/acoustic_conservation_equations/postprocessor/postprocessor_base.h>
26#include <exadg/acoustic_conservation_equations/spatial_discretization/spatial_operator.h>
27#include <exadg/acoustic_conservation_equations/time_integration/time_int_abm.h>
28#include <exadg/acoustic_conservation_equations/user_interface/application_base.h>
29#include <exadg/functions_and_boundary_conditions/verify_boundary_conditions.h>
30#include <exadg/matrix_free/matrix_free_data.h>
31#include <exadg/operators/finite_element.h>
32#include <exadg/utilities/print_general_infos.h>
33
34namespace ExaDG
35{
36namespace Acoustics
37{
38enum class OperatorType
39{
40 AcousticOperator, // gradient operator for scalar pressure and divergence operator for
41 // vectorial velocity
42 ScaledInverseMassOperator // scaled inverse mass operator: vectorial quantity (velocity) and
43 // scalar quantity (pressure). The pressure is scaled by
44 // speed_of_sound^2 in the evaluation of the operator
45};
46
47inline unsigned int
48get_dofs_per_element(unsigned int const dim,
49 unsigned int const degree,
50 ExaDG::ElementType const element_type)
51{
52 unsigned int const pressure_dofs_per_element =
53 ExaDG::get_dofs_per_element(element_type, true /* is_dg */, 1 /* n_components */, degree, dim);
54
55 unsigned int const velocity_dofs_per_element = ExaDG::get_dofs_per_element(
56 element_type, true /* is_dg */, dim /* n_components */, degree, dim);
57
58 return velocity_dofs_per_element + pressure_dofs_per_element;
59}
60
61template<int dim, typename Number>
62class Driver
63{
64public:
65 Driver(MPI_Comm const & comm,
66 std::shared_ptr<ApplicationBase<dim, Number>> application,
67 bool const is_test,
68 bool const is_throughput_study);
69
70 void
71 setup();
72
73 void
74 solve() const;
75
76 void
77 print_performance_results(double const total_time) const;
78
79 /*
80 * Throughput study
81 */
82 std::tuple<unsigned int, dealii::types::global_dof_index, double>
83 apply_operator(OperatorType const & operator_type,
84 unsigned int const n_repetitions_inner,
85 unsigned int const n_repetitions_outer) const;
86
87private:
88 // MPI communicator
89 MPI_Comm const mpi_comm;
90
91 // output to std::cout
92 dealii::ConditionalOStream pcout;
93
94 // do not print wall times if is_test
95 bool const is_test;
96
97 // do not set up certain data structures (solver, postprocessor) in case of throughput study
98 bool const is_throughput_study;
99
100 // application
101 std::shared_ptr<ApplicationBase<dim, Number>> application;
102
103 std::shared_ptr<Grid<dim>> grid;
104
105 std::shared_ptr<dealii::Mapping<dim>> mapping;
106
107 /*
108 * Spatial discretization
109 */
110 std::shared_ptr<SpatialOperator<dim, Number>> pde_operator;
111
112 /*
113 * Postprocessor
114 */
115 std::shared_ptr<PostProcessorBase<dim, Number>> postprocessor;
116
117 /*
118 * Temporal discretization
119 */
120
121 // unsteady solver
122 std::shared_ptr<TimeIntAdamsBashforthMoulton<Number>> time_integrator;
123
124 /*
125 * Computation time (wall clock time).
126 */
127 mutable TimerTree timer_tree;
128};
129
130} // namespace Acoustics
131} // namespace ExaDG
132
133#endif /* EXADG_ACOUSTIC_CONSERVATION_EQUATIONS_DRIVER_H_ */
Definition application_base.h:48
Definition driver.h:63
Definition timer_tree.h:36
Definition driver.cpp:33