ExaDG
Loading...
Searching...
No Matches
boundary_descriptor.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_COMPRESSIBLE_NAVIER_STOKES_USER_INTERFACE_BOUNDARY_DESCRIPTOR_H_
23#define INCLUDE_EXADG_COMPRESSIBLE_NAVIER_STOKES_USER_INTERFACE_BOUNDARY_DESCRIPTOR_H_
24
25
26
27// deal.II
28#include <deal.II/base/function.h>
29#include <deal.II/base/types.h>
30
31// ExaDG
32#include <exadg/compressible_navier_stokes/user_interface/parameters.h>
33#include <exadg/functions_and_boundary_conditions/verify_boundary_conditions.h>
34
35namespace ExaDG
36{
37namespace CompNS
38{
39enum class BoundaryType
40{
41 Undefined,
42 Dirichlet,
43 Neumann
44};
45
46template<int dim>
48{
49 std::map<dealii::types::boundary_id, std::shared_ptr<dealii::Function<dim>>> dirichlet_bc;
50 std::map<dealii::types::boundary_id, std::shared_ptr<dealii::Function<dim>>> neumann_bc;
51
52 // return the boundary type
53 inline DEAL_II_ALWAYS_INLINE //
54 BoundaryType
55 get_boundary_type(dealii::types::boundary_id const & boundary_id) const
56 {
57 if(this->dirichlet_bc.find(boundary_id) != this->dirichlet_bc.end())
58 return BoundaryType::Dirichlet;
59 else if(this->neumann_bc.find(boundary_id) != this->neumann_bc.end())
60 return BoundaryType::Neumann;
61
62 AssertThrow(false, dealii::ExcMessage("Boundary type of face is invalid or not implemented."));
63
64 return BoundaryType::Undefined;
65 }
66
67 inline DEAL_II_ALWAYS_INLINE //
68 void
69 verify_boundary_conditions(
70 dealii::types::boundary_id const boundary_id,
71 std::set<dealii::types::boundary_id> const & periodic_boundary_ids) const
72 {
73 unsigned int counter = 0;
74 if(this->dirichlet_bc.find(boundary_id) != this->dirichlet_bc.end())
75 counter++;
76
77 if(this->neumann_bc.find(boundary_id) != this->neumann_bc.end())
78 counter++;
79
80 if(periodic_boundary_ids.find(boundary_id) != periodic_boundary_ids.end())
81 counter++;
82
83 AssertThrow(counter == 1,
84 dealii::ExcMessage("Boundary face with non-unique boundary type found."));
85 }
86};
87
88template<int dim>
90{
91 std::map<dealii::types::boundary_id, EnergyBoundaryVariable> boundary_variable;
92
93 // return the boundary variable
94 inline DEAL_II_ALWAYS_INLINE //
95 EnergyBoundaryVariable
96 get_boundary_variable(dealii::types::boundary_id const & boundary_id) const
97 {
98 EnergyBoundaryVariable boundary_variable = this->boundary_variable.find(boundary_id)->second;
99
100 AssertThrow(boundary_variable != EnergyBoundaryVariable::Undefined,
101 dealii::ExcMessage("Energy boundary variable is undefined!"));
102
103 return boundary_variable;
104 }
105};
106
107template<int dim>
115
116template<int dim>
117inline void
118verify_boundary_conditions(BoundaryDescriptor<dim> const & boundary_descriptor,
119 Grid<dim> const & grid)
120{
121 ExaDG::verify_boundary_conditions(boundary_descriptor.density, grid);
122 ExaDG::verify_boundary_conditions(boundary_descriptor.velocity, grid);
123 ExaDG::verify_boundary_conditions(boundary_descriptor.pressure, grid);
124 ExaDG::verify_boundary_conditions(boundary_descriptor.energy, grid);
125}
126
127} // namespace CompNS
128} // namespace ExaDG
129
130#endif /* INCLUDE_EXADG_COMPRESSIBLE_NAVIER_STOKES_USER_INTERFACE_BOUNDARY_DESCRIPTOR_H_ */
Definition grid.h:40
Definition driver.cpp:33
Definition boundary_descriptor.h:90
Definition boundary_descriptor.h:48
Definition boundary_descriptor.h:109