ExaDG
Toggle main menu visibility
Loading...
Searching...
No Matches
include
exadg
structure
spatial_discretization
operators
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 EXADG_STRUCTURE_SPATIAL_DISCRETIZATION_OPERATORS_MASS_OPERATOR_H_
23
#define 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
31
namespace
ExaDG
32
{
33
namespace
Structure
34
{
35
template
<
int
dim,
typename
Number>
36
struct
MassOperatorData :
public
ExaDG::MassOperatorData
<dim, Number>
37
{
38
std::shared_ptr<BoundaryDescriptor<dim>
const
> bc;
39
};
40
41
template
<
int
dim,
typename
Number>
42
class
MassOperator :
public
ExaDG::MassOperator
<dim, dim, Number>
43
{
44
public
:
45
typedef
ExaDG::MassOperator<dim, dim, Number>
Base;
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, Number>
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_constrained_values(VectorType & dst)
const
final
61
{
62
// periodicity and hanging node constraints are enforced strongly for continuous spaces
63
if
(not this->is_dg)
64
{
65
unsigned
int
const
dof_index_inhomogeneous = this->get_dof_index_inhomogeneous();
66
dealii::AffineConstraints<Number>
const
& constraints =
67
this->matrix_free->get_affine_constraints(dof_index_inhomogeneous);
68
constraints.distribute(dst);
69
}
70
71
// standard Dirichlet boundary conditions
72
std::map<dealii::types::global_dof_index, double> boundary_values;
73
for
(
auto
dbc : operator_data.bc->dirichlet_bc_initial_acceleration)
74
{
75
dbc.second->set_time(this->get_time());
76
dealii::ComponentMask mask =
77
operator_data.bc->dirichlet_bc_component_mask.find(dbc.first)->second;
78
79
dealii::VectorTools::interpolate_boundary_values(
80
*this->matrix_free->get_mapping_info().mapping,
81
this->matrix_free->get_dof_handler(operator_data.dof_index),
82
dbc.first,
83
*dbc.second,
84
boundary_values,
85
mask);
86
}
87
88
// set Dirichlet values in solution vector
89
for
(
auto
m : boundary_values)
90
if
(dst.get_partitioner()->in_local_range(m.first))
91
dst[m.first] = m.second;
92
93
// zero out ghost values to return to default state
94
dst.zero_out_ghost_values();
95
}
96
97
private
:
98
MassOperatorData<dim, Number>
operator_data;
99
};
100
101
}
// namespace Structure
102
}
// namespace ExaDG
103
104
#endif
/* EXADG_STRUCTURE_SPATIAL_DISCRETIZATION_OPERATORS_MASS_OPERATOR_H_ */
ExaDG::MassOperator
Definition
mass_operator.h:53
ExaDG
Definition
driver.cpp:33
ExaDG::MassOperatorData
Definition
mass_operator.h:35
ExaDG::Structure::MassOperatorData
Definition
mass_operator.h:37
Generated by
1.17.0