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