ExaDG
Toggle main menu visibility
Loading...
Searching...
No Matches
include
exadg
grid
mapping_deformation_function.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_GRID_MAPPING_DEFORMATION_FUNCTION_H_
23
#define EXADG_GRID_MAPPING_DEFORMATION_FUNCTION_H_
24
25
// ExaDG
26
#include <exadg/grid/grid_data.h>
27
#include <exadg/grid/mapping_deformation_base.h>
28
29
namespace
ExaDG
30
{
37
template
<
int
dim,
typename
Number>
38
class
DeformedMappingFunction
:
public
DeformedMappingBase
<dim, Number>
39
{
40
public
:
41
typedef
dealii::LinearAlgebra::distributed::Vector<Number> VectorType;
42
46
DeformedMappingFunction
(std::shared_ptr<dealii::Mapping<dim>
const
>
mapping_undeformed
,
47
unsigned
int
const
mapping_degree_q_cache,
48
dealii::Triangulation<dim>
const
& triangulation,
49
std::shared_ptr<dealii::Function<dim>>
const
mesh_deformation_function,
50
double
const
start_time)
51
:
DeformedMappingBase
<dim, Number>(
mapping_undeformed
, mapping_degree_q_cache, triangulation),
52
mesh_deformation_function(mesh_deformation_function),
53
triangulation(triangulation)
54
{
55
update
(start_time,
false
, dealii::numbers::invalid_unsigned_int);
56
}
57
61
void
62
update
(
double
const
time,
63
bool
const
print_solver_info,
64
types::time_step time_step_number)
override
65
{
66
(void)print_solver_info;
67
(void)time_step_number;
68
69
mesh_deformation_function->set_time(time);
70
71
this->do_initialize(triangulation, mesh_deformation_function);
72
}
73
74
private
:
80
void
81
do_initialize(dealii::Triangulation<dim>
const
& triangulation,
82
std::shared_ptr<dealii::Function<dim>> displacement_function)
83
{
84
AssertThrow(dealii::MultithreadInfo::n_threads() == 1, dealii::ExcNotImplemented());
85
86
AssertThrow(
get_element_type
(triangulation) == ElementType::Hypercube,
87
dealii::ExcMessage(
"Only implemented for hypercube elements."
));
88
89
// dummy FE for compatibility with interface of dealii::FEValues
90
dealii::FE_Nothing<dim> dummy_fe;
91
dealii::FEValues<dim> fe_values(*this->
mapping_undeformed
,
92
dummy_fe,
93
dealii::QGaussLobatto<dim>(this->mapping_q_cache->get_degree() +
94
1),
95
dealii::update_quadrature_points);
96
97
this->mapping_q_cache->initialize(
98
triangulation,
99
[&](
typename
dealii::Triangulation<dim>::cell_iterator
const
& cell)
100
-> std::vector<dealii::Point<dim>> {
101
fe_values.reinit(cell);
102
103
// compute displacement and add to original position
104
std::vector<dealii::Point<dim>> points_moved(fe_values.n_quadrature_points);
105
for
(
unsigned
int
i = 0; i < fe_values.n_quadrature_points; ++i)
106
{
107
// need to adjust for hierarchic numbering of dealii::MappingQCache
108
dealii::Point<dim>
const
point =
109
fe_values.quadrature_point(this->hierarchic_to_lexicographic_numbering[i]);
110
dealii::Point<dim> displacement;
111
for
(
unsigned
int
d = 0; d < dim; ++d)
112
displacement[d] = displacement_function->value(point, d);
113
114
points_moved[i] = point + displacement;
115
}
116
117
return
points_moved;
118
});
119
}
120
121
std::shared_ptr<dealii::Function<dim>> mesh_deformation_function;
122
123
dealii::Triangulation<dim>
const
& triangulation;
124
};
125
126
}
// namespace ExaDG
127
128
#endif
/* EXADG_GRID_MAPPING_DEFORMATION_FUNCTION_H_ */
ExaDG::DeformedMappingBase::mapping_undeformed
std::shared_ptr< dealii::Mapping< dim > const > mapping_undeformed
Definition
mapping_deformation_base.h:106
ExaDG::DeformedMappingBase::DeformedMappingBase
DeformedMappingBase(std::shared_ptr< dealii::Mapping< dim > const > mapping_undeformed, unsigned int const mapping_degree_deformed, dealii::Triangulation< dim > const &triangulation)
Definition
mapping_deformation_base.h:60
ExaDG::DeformedMappingFunction::update
void update(double const time, bool const print_solver_info, types::time_step time_step_number) override
Definition
mapping_deformation_function.h:62
ExaDG::DeformedMappingFunction::DeformedMappingFunction
DeformedMappingFunction(std::shared_ptr< dealii::Mapping< dim > const > mapping_undeformed, unsigned int const mapping_degree_q_cache, dealii::Triangulation< dim > const &triangulation, std::shared_ptr< dealii::Function< dim > > const mesh_deformation_function, double const start_time)
Definition
mapping_deformation_function.h:46
ExaDG
Definition
driver.cpp:33
ExaDG::get_element_type
ElementType get_element_type(dealii::Triangulation< dim > const &tria)
Definition
grid_data.h:70
Generated by
1.17.0