ExaDG
Loading...
Searching...
No Matches
structure.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_FLUID_STRUCTURE_INTERACTION_SINGLE_FIELD_SOLVERS_STRUCTURE_H_
23#define INCLUDE_EXADG_FLUID_STRUCTURE_INTERACTION_SINGLE_FIELD_SOLVERS_STRUCTURE_H_
24
25// Structure
26#include <exadg/structure/spatial_discretization/operator.h>
27#include <exadg/structure/time_integration/time_int_gen_alpha.h>
28
29// application
30#include <exadg/fluid_structure_interaction/user_interface/application_base.h>
31
32namespace ExaDG
33{
34namespace FSI
35{
36template<int dim, typename Number>
38{
39public:
40 void
41 setup(std::shared_ptr<StructureFSI::ApplicationBase<dim, Number>> application,
42 MPI_Comm const mpi_comm,
43 bool const is_test);
44
45 // grid and mapping
46 std::shared_ptr<Grid<dim>> grid;
47 std::shared_ptr<dealii::Mapping<dim>> mapping;
48
49 std::shared_ptr<MultigridMappings<dim, Number>> multigrid_mappings;
50
51 // matrix-free
52 std::shared_ptr<MatrixFreeData<dim, Number>> matrix_free_data;
53 std::shared_ptr<dealii::MatrixFree<dim, Number>> matrix_free;
54
55 // spatial discretization
56 std::shared_ptr<Structure::Operator<dim, Number>> pde_operator;
57
58 // temporal discretization
59 std::shared_ptr<Structure::TimeIntGenAlpha<dim, Number>> time_integrator;
60
61 // postprocessor
62 std::shared_ptr<Structure::PostProcessor<dim, Number>> postprocessor;
63};
64
65template<int dim, typename Number>
66void
68 std::shared_ptr<StructureFSI::ApplicationBase<dim, Number>> application,
69 MPI_Comm const mpi_comm,
70 bool const is_test)
71{
72 // setup application
73 application->setup(grid, mapping, multigrid_mappings);
74
75 // setup spatial operator
76 pde_operator =
77 std::make_shared<Structure::Operator<dim, Number>>(grid,
78 mapping,
79 multigrid_mappings,
80 application->get_boundary_descriptor(),
81 application->get_field_functions(),
82 application->get_material_descriptor(),
83 application->get_parameters(),
84 "elasticity",
85 mpi_comm);
86
87 // initialize matrix_free
88 matrix_free_data = std::make_shared<MatrixFreeData<dim, Number>>();
89 matrix_free_data->append(pde_operator);
90
91 matrix_free = std::make_shared<dealii::MatrixFree<dim, Number>>();
92 matrix_free->reinit(*mapping,
93 matrix_free_data->get_dof_handler_vector(),
94 matrix_free_data->get_constraint_vector(),
95 matrix_free_data->get_quadrature_vector(),
96 matrix_free_data->data);
97
98 pde_operator->setup(matrix_free, matrix_free_data);
99
100 // initialize postprocessor
101 postprocessor = application->create_postprocessor();
102 postprocessor->setup(pde_operator->get_dof_handler(), *mapping);
103
104 // initialize time integrator
105 time_integrator = std::make_shared<Structure::TimeIntGenAlpha<dim, Number>>(
106 pde_operator, postprocessor, application->get_parameters(), mpi_comm, is_test);
107
108 time_integrator->setup(application->get_parameters().restarted_simulation);
109}
110
111} // namespace FSI
112} // namespace ExaDG
113
114#endif /* INCLUDE_EXADG_FLUID_STRUCTURE_INTERACTION_SINGLE_FIELD_SOLVERS_STRUCTURE_H_ */
Definition structure.h:38
Definition application_base.h:64
Definition driver.cpp:33