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_POISSON_OVERSET_GRIDS_DRIVER_H_
23#define INCLUDE_EXADG_POISSON_OVERSET_GRIDS_DRIVER_H_
24
25// ExaDG
26#include <exadg/functions_and_boundary_conditions/interface_coupling.h>
27#include <exadg/matrix_free/matrix_free_data.h>
28#include <exadg/poisson/overset_grids/user_interface/application_base.h>
29#include <exadg/poisson/spatial_discretization/operator.h>
30
31namespace ExaDG
32{
33namespace Poisson
34{
35namespace OversetGrids
36{
37template<int dim, int n_components, typename Number>
38class Solver
39{
40public:
41 void
42 setup(std::shared_ptr<Domain<dim, n_components, Number> const> const & domain,
43 std::shared_ptr<Grid<dim> const> const & grid,
44 std::shared_ptr<dealii::Mapping<dim> const> const & mapping,
45 std::shared_ptr<MultigridMappings<dim, Number>> const multigrid_mappings,
46 MPI_Comm const mpi_comm)
47 {
48 pde_operator =
49 std::make_shared<Operator<dim, n_components, Number>>(grid,
50 mapping,
51 multigrid_mappings,
52 domain->get_boundary_descriptor(),
53 domain->get_field_functions(),
54 domain->get_parameters(),
55 "Poisson",
56 mpi_comm);
57
58 pde_operator->setup();
59
60 postprocessor = domain->create_postprocessor();
61 postprocessor->setup(*pde_operator);
62 }
63
64 std::shared_ptr<Operator<dim, n_components, Number>> pde_operator;
65 std::shared_ptr<PostProcessorBase<dim, n_components, Number>> postprocessor;
66};
67
68template<int dim, int n_components, typename Number>
69class Driver
70{
71public:
72 Driver(MPI_Comm const & mpi_comm,
73 std::shared_ptr<ApplicationBase<dim, n_components, Number>> application);
74
75 void
76 setup();
77
78 void
79 solve();
80
81private:
82 static unsigned int const rank =
83 (n_components == 1) ? 0 : ((n_components == dim) ? 1 : dealii::numbers::invalid_unsigned_int);
84
85 // MPI communicator
86 MPI_Comm const mpi_comm;
87
88 // output to std::cout
89 dealii::ConditionalOStream pcout;
90
91 std::shared_ptr<ApplicationBase<dim, n_components, Number>> application;
92
93 std::shared_ptr<Grid<dim>> grid1, grid2;
94
95 std::shared_ptr<dealii::Mapping<dim>> mapping1, mapping2;
96
97 std::shared_ptr<MultigridMappings<dim, Number>> multigrid_mappings1, multigrid_mappings2;
98
99 // Poisson solvers
100 std::shared_ptr<Solver<dim, n_components, Number>> poisson1, poisson2;
101
102 // interface coupling
103 std::shared_ptr<InterfaceCoupling<rank, dim, Number>> first_to_second, second_to_first;
104};
105} // namespace OversetGrids
106} // namespace Poisson
107} // namespace ExaDG
108
109
110#endif /* INCLUDE_EXADG_POISSON_OVERSET_GRIDS_DRIVER_H_ */
Definition grid.h:40
Definition grid.h:84
Definition application_base.h:254
Definition application_base.h:117
Definition driver.cpp:33