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