ExaDG
Loading...
Searching...
No Matches
continuum_mechanics.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_CONTINUUM_MECHANICS_H_
23#define INCLUDE_EXADG_STRUCTURE_SPATIAL_DISCRETIZATION_OPERATORS_CONTINUUM_MECHANICS_H_
24
25// deal.II
26#include <deal.II/base/tensor.h>
27#include <deal.II/physics/transformations.h>
28
29namespace ExaDG
30{
31namespace Structure
32{
33template<int dim, typename Number = double>
34inline DEAL_II_ALWAYS_INLINE //
35 dealii::Tensor<2, dim, dealii::VectorizedArray<Number>>
36 add_identity(dealii::Tensor<2, dim, dealii::VectorizedArray<Number>> gradient)
37{
38 for(unsigned int i = 0; i < dim; i++)
39 gradient[i][i] = gradient[i][i] + 1.0;
40 return gradient;
41}
42
43template<int dim, typename Number = double>
44inline DEAL_II_ALWAYS_INLINE //
45 dealii::Tensor<2, dim, dealii::VectorizedArray<Number>>
46 subtract_identity(dealii::Tensor<2, dim, dealii::VectorizedArray<Number>> gradient)
47{
48 for(unsigned int i = 0; i < dim; i++)
49 gradient[i][i] = gradient[i][i] - 1.0;
50 return gradient;
51}
52
53template<int dim, typename Number>
54inline DEAL_II_ALWAYS_INLINE //
55 dealii::Tensor<2, dim, dealii::VectorizedArray<Number>>
56 get_F(const dealii::Tensor<2, dim, dealii::VectorizedArray<Number>> & H)
57{
58 return add_identity(H);
59}
60
61template<int dim, typename Number>
62inline DEAL_II_ALWAYS_INLINE //
63 dealii::Tensor<2, dim, dealii::VectorizedArray<Number>>
64 get_E(const dealii::Tensor<2, dim, dealii::VectorizedArray<Number>> & F)
65{
66 return 0.5 * subtract_identity(transpose(F) * F);
67}
68
69} // namespace Structure
70} // namespace ExaDG
71
72
73#endif /* INCLUDE_EXADG_STRUCTURE_SPATIAL_DISCRETIZATION_OPERATORS_CONTINUUM_MECHANICS_H_ */
Definition driver.cpp:33