ExaDG
Loading...
Searching...
No Matches
driver.h
1/* ______________________________________________________________________
2 *
3 * ExaDG - High-Order Discontinuous Galerkin for the Exa-Scale
4 *
5 * Copyright (C) 2022 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_FLUID_STRUCTURE_INTERACTION_PRECICE_DRIVER_H_
23#define EXADG_FLUID_STRUCTURE_INTERACTION_PRECICE_DRIVER_H_
24
25// deal.II
26#include <deal.II/lac/la_parallel_vector.h>
27
28// ExaDG
29#include <exadg/fluid_structure_interaction/precice/precice_adapter.h>
30#include <exadg/fluid_structure_interaction/precice/precice_parameters.h>
31#include <exadg/fluid_structure_interaction/single_field_solvers/fluid.h>
32#include <exadg/fluid_structure_interaction/single_field_solvers/structure.h>
33#include <exadg/fluid_structure_interaction/user_interface/application_base.h>
34#include <exadg/utilities/print_general_infos.h>
35
36namespace ExaDG
37{
38namespace FSI
39{
40namespace preCICE
41{
42template<int dim, typename Number>
43class Driver
44{
45private:
46 using VectorType = dealii::LinearAlgebra::distributed::Vector<Number>;
47
48public:
49 Driver(std::string const & input_file,
50 MPI_Comm const & comm,
51 std::shared_ptr<ApplicationBase<dim, Number>> app,
52 bool const is_test)
53 : mpi_comm(comm),
54 pcout(std::cout, dealii::Utilities::MPI::this_mpi_process(comm) == 0),
55 application(app),
56 precice_parameters(ExaDG::preCICE::ConfigurationParameters(input_file)),
57 is_test(is_test)
58 {
59 print_general_info<Number>(pcout, mpi_comm, is_test);
60 }
61
62 virtual void
63 setup() = 0;
64
65 virtual void
66 solve() const = 0;
67
68 virtual void
69 print_performance_results(double const total_time) const = 0;
70
71 virtual ~Driver() = default;
72
73protected:
74 // MPI communicator
75 MPI_Comm const mpi_comm;
76
77 // output to std::cout
78 dealii::ConditionalOStream pcout;
79
80 // application
81 std::shared_ptr<ApplicationBase<dim, Number>> application;
82 std::shared_ptr<ExaDG::preCICE::Adapter<dim, dim, VectorType>> precice;
84
85 // do not print wall times if is_test
86 bool const is_test;
87
88 /*
89 * Computation time (wall clock time).
90 */
91 mutable TimerTree timer_tree;
92};
93
94} // namespace preCICE
95} // namespace FSI
96} // namespace ExaDG
97
98#endif /* EXADG_FLUID_STRUCTURE_INTERACTION_PRECICE_DRIVER_H_ */
Definition application_base.h:466
Definition timer_tree.h:36
Definition driver.cpp:33
Definition precice_parameters.h:42