ExaDG
Loading...
Searching...
No Matches
mass_operator.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_STRUCTURE_SPATIAL_DISCRETIZATION_OPERATORS_MASS_OPERATOR_H_
23#define INCLUDE_EXADG_STRUCTURE_SPATIAL_DISCRETIZATION_OPERATORS_MASS_OPERATOR_H_
24
25// deal.II
26#include <deal.II/numerics/vector_tools.h>
27
28// ExaDG
29#include <exadg/operators/mass_operator.h>
30
31namespace ExaDG
32{
33namespace Structure
34{
35template<int dim>
37{
38 std::shared_ptr<BoundaryDescriptor<dim> const> bc;
39};
40
41template<int dim, typename Number>
42class MassOperator : public ExaDG::MassOperator<dim, dim, Number>
43{
44public:
46
47 typedef typename Base::VectorType VectorType;
48
49 void
50 initialize(dealii::MatrixFree<dim, Number> const & matrix_free,
51 dealii::AffineConstraints<Number> const & affine_constraints,
52 MassOperatorData<dim> const & data)
53 {
54 operator_data = data;
55
56 ExaDG::MassOperator<dim, dim, Number>::initialize(matrix_free, affine_constraints, data);
57 }
58
59 void
60 set_inhomogeneous_boundary_values(VectorType & dst) const final
61 {
62 std::map<dealii::types::global_dof_index, double> boundary_values;
63 for(auto dbc : operator_data.bc->dirichlet_bc_initial_acceleration)
64 {
65 dbc.second->set_time(this->get_time());
66 dealii::ComponentMask mask =
67 operator_data.bc->dirichlet_bc_component_mask.find(dbc.first)->second;
68
69 dealii::VectorTools::interpolate_boundary_values(
70 *this->matrix_free->get_mapping_info().mapping,
71 this->matrix_free->get_dof_handler(operator_data.dof_index),
72 dbc.first,
73 *dbc.second,
74 boundary_values,
75 mask);
76 }
77
78 // set Dirichlet values in solution vector
79 for(auto m : boundary_values)
80 if(dst.get_partitioner()->in_local_range(m.first))
81 dst[m.first] = m.second;
82
83 dst.update_ghost_values();
84 }
85
86private:
87 MassOperatorData<dim> operator_data;
88};
89
90} // namespace Structure
91} // namespace ExaDG
92
93
94
95#endif /* INCLUDE_EXADG_STRUCTURE_SPATIAL_DISCRETIZATION_OPERATORS_MASS_OPERATOR_H_ */
Definition mass_operator.h:41
Definition mass_operator.h:43
Definition driver.cpp:33
Definition mass_operator.h:33
Definition mass_operator.h:37