ExaDG
Loading...
Searching...
No Matches
boundary_conditions.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#ifndef EXADG_STRUCTURE_SPATIAL_DISCRETIZATION_OPERATORS_BOUNDARY_CONDITIONS_H_
22#define EXADG_STRUCTURE_SPATIAL_DISCRETIZATION_OPERATORS_BOUNDARY_CONDITIONS_H_
23
24// ExaDG
25#include <exadg/functions_and_boundary_conditions/evaluate_functions.h>
26#include <exadg/matrix_free/integrators.h>
27#include <exadg/structure/user_interface/boundary_descriptor.h>
28
29namespace ExaDG
30{
31namespace Structure
32{
33/*
34 * This function calculates the Neumann boundary value.
35 */
36template<int dim, typename Number>
37inline DEAL_II_ALWAYS_INLINE //
38 dealii::Tensor<1, dim, dealii::VectorizedArray<Number>>
39 calculate_neumann_value(unsigned int const q,
40 FaceIntegrator<dim, dim, Number> const & integrator,
41 BoundaryType const & boundary_type,
42 dealii::types::boundary_id const boundary_id,
43 std::shared_ptr<BoundaryDescriptor<dim> const> boundary_descriptor,
44 double const & time)
45{
46 dealii::Tensor<1, dim, dealii::VectorizedArray<Number>> traction;
47
48 if(boundary_type == BoundaryType::Neumann)
49 {
50 auto bc = boundary_descriptor->neumann_bc.find(boundary_id)->second;
51 auto q_points = integrator.quadrature_point(q);
52
53 traction = FunctionEvaluator<1, dim, Number>::value(*bc, q_points, time);
54 }
55 else if(boundary_type == BoundaryType::NeumannCached)
56 {
57 auto bc = boundary_descriptor->get_neumann_cached_data();
58
59 traction = FunctionEvaluator<1, dim, Number>::value(*bc,
60 integrator.get_current_cell_index(),
61 q,
62 integrator.get_quadrature_index());
63 }
64 else
65 {
66 // do nothing
67
68 AssertThrow(boundary_type == BoundaryType::Dirichlet or
69 boundary_type == BoundaryType::DirichletCached,
70 dealii::ExcMessage("Boundary type of face is invalid or not implemented."));
71 }
72
73 return traction;
74}
75
76} // namespace Structure
77} // namespace ExaDG
78
79#endif /* EXADG_STRUCTURE_SPATIAL_DISCRETIZATION_OPERATORS_BOUNDARY_CONDITIONS_H_ */
Definition driver.cpp:33
Definition boundary_descriptor.h:48