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