include/meltpooldg/compressible_flow/boundary_conditions.hpp Source File

Developer Documentation: include/meltpooldg/compressible_flow/boundary_conditions.hpp Source File
Developer Documentation
boundary_conditions.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <deal.II/base/exceptions.h>
4#include <deal.II/base/function.h>
5#include <deal.II/base/point.h>
6#include <deal.II/base/tensor.h>
7#include <deal.II/base/vectorization.h>
8
15#include <meltpooldg/utilities/better_enum.hpp>
17
18#include <map>
19#include <memory>
20#include <set>
21
23{
27 BETTER_ENUM(BoundaryConditionType,
28 char,
29 combined_inflow_no_slip_wall,
30 inflow,
31 slip_wall,
32 no_slip_wall,
33 subsonic_outflow_fixed_energy,
34 subsonic_outflow_fixed_pressure);
35
45 template <int dim>
57
63 template <int dim>
65 {
66 enum
67 {
70 energy = dim + 1,
72 };
73 };
74
75
92 template <int dim, typename number>
94 {
95 public:
98 using BoundaryType = BoundaryConditionType;
99
100 using VectorizedArrayType = dealii::VectorizedArray<number>;
101
104 inline static const std::map<BoundaryType, std::string> boundary_type_to_string_map = {
105 {BoundaryType::inflow, "inflow"},
106 {BoundaryType::subsonic_outflow_fixed_pressure, "outflow_fixed_pressure"},
107 {BoundaryType::subsonic_outflow_fixed_energy, "outflow_fixed_energy"},
108 {BoundaryType::slip_wall, "slip_wall"},
109 {BoundaryType::no_slip_wall, "no_slip_wall"},
110 {BoundaryType::combined_inflow_no_slip_wall, "combined_inflow_no_slip_wall"},
111 };
112
121 void
122 update_boundary_conditions(number time);
123
133 void
134 set_boundary_conditions(const std::shared_ptr<SimulationCaseBase<dim, number>> &simulation_case,
135 const std::string &operation_name)
136 {
137 set_boundary_condition(BoundaryType::inflow,
138 simulation_case->get_boundary_condition("inflow", operation_name));
139
140 set_boundary_condition(BoundaryType::subsonic_outflow_fixed_pressure,
141 simulation_case->get_boundary_condition("outflow_fixed_pressure",
142 operation_name));
143
144 set_boundary_condition(BoundaryType::subsonic_outflow_fixed_energy,
145 simulation_case->get_boundary_condition("outflow_fixed_energy",
146 operation_name));
147
148 set_boundary_condition(BoundaryType::slip_wall,
149 simulation_case->get_boundary_condition("slip_wall", operation_name));
150
151 set_boundary_condition(BoundaryType::no_slip_wall,
152 simulation_case->get_boundary_condition("no_slip_wall",
153 operation_name));
154
155 set_boundary_condition(BoundaryType::combined_inflow_no_slip_wall,
156 simulation_case->get_boundary_condition("combined_inflow_no_slip_wall",
157 operation_name));
158 }
159
168 void
170 BoundaryType boundary_condition,
171 std::map<dealii::types::boundary_id, std::shared_ptr<dealii::Function<dim>>>
172 boundary_condition_function = {});
173
185 get_boundary_type(const dealii::types::boundary_id boundary_id) const
186 {
187 if (inflow_boundaries.contains(boundary_id))
188 return BoundaryType::inflow;
189 if (slip_wall_boundaries.contains(boundary_id))
190 return BoundaryType::slip_wall;
191 if (no_slip_adiabatic_wall_boundaries.contains(boundary_id))
192 return BoundaryType::no_slip_wall;
193 if (subsonic_outflow_fixed_energy.contains(boundary_id))
194 return BoundaryType::subsonic_outflow_fixed_energy;
195 if (subsonic_outflow_fixed_pressure.contains(boundary_id))
196 return BoundaryType::subsonic_outflow_fixed_pressure;
197 if (combined_inflow_no_slip_wall_boundaries.contains(boundary_id))
198 return BoundaryType::combined_inflow_no_slip_wall;
199 AssertThrow(false,
200 dealii::ExcMessage(
201 "There is no compressible flow boundary set at the boundary with boundary id " +
202 std::to_string(boundary_id) + "!"));
203 }
204
216 dealii::VectorizedArray<number>
217 get_boundary_value(dealii::types::boundary_id boundary_id,
218 BoundaryType boundary_condition,
219 const dealii::Point<dim, dealii::VectorizedArray<number>> &location,
220 unsigned component) const;
221
239 std::tuple<ConservedVariables, ConservedVariablesGradient>
241 const dealii::Point<dim, dealii::VectorizedArray<number>> &q_point,
242 const dealii::Tensor<1, dim, dealii::VectorizedArray<number>> &normal,
243 dealii::types::boundary_id boundary_id,
244 const ConservedVariables &w_m,
245 const ConservedVariablesGradient &grad_w_m,
246 const Material<dim, number> &material,
247 bool is_gas_phase = true) const;
248
258 template <typename DofReadView, typename DofWriteView>
259 void
261 const dealii::Point<dim, dealii::VectorizedArray<number>> &q_point,
262 const dealii::Tensor<1, dim, dealii::VectorizedArray<number>> &normal,
263 dealii::types::boundary_id boundary_id,
264 const DofReadView &w_m,
265 const DofWriteView &w_p) const;
266
276 template <int n_species, typename DofReadView, typename DofWriteView>
277 void
279 const dealii::Point<dim, dealii::VectorizedArray<number>> &q_point,
280 dealii::types::boundary_id boundary_id,
281 const DofReadView &w_m,
282 const DofWriteView &w_p) const;
283
305 std::tuple<ConservedVariables,
310 const dealii::Point<dim, dealii::VectorizedArray<number>> &q_point,
311 const dealii::Tensor<1, dim, dealii::VectorizedArray<number>> &normal,
312 dealii::types::boundary_id boundary_id,
313 const ConservedVariables &w_m,
314 const ConservedVariables &delta_w_m,
315 const ConservedVariablesGradient &grad_w_m,
316 const ConservedVariablesGradient &grad_delta_w_m,
317 number gamma) const;
318
319 private:
321 std::map<dealii::types::boundary_id, std::shared_ptr<dealii::Function<dim>>> inflow_boundaries;
322 std::map<dealii::types::boundary_id, std::shared_ptr<dealii::Function<dim>>>
324 std::map<dealii::types::boundary_id, std::shared_ptr<dealii::Function<dim>>>
326 std::map<dealii::types::boundary_id, std::shared_ptr<dealii::Function<dim>>>
328
330 std::set<dealii::types::boundary_id> slip_wall_boundaries;
331 std::set<dealii::types::boundary_id> no_slip_adiabatic_wall_boundaries;
332
341 template <typename DofReadView, typename DofWriteView>
342 void
344 DofReadView w_m,
345 DofWriteView w_p,
346 const dealii::Tensor<1, dim, dealii::VectorizedArray<number>> &normal) const;
347
355 template <typename DofReadView, typename DofWriteView>
356 void
357 apply_no_slip_wall_boundary(DofReadView w_m, DofWriteView w_p) const;
358
374 template <typename DofReadView,
375 typename DofWriteView,
376 typename DirichletValueInterpretation = InflowValueInterpretation<dim>>
377 void
378 apply_inflow_boundary(const dealii::types::boundary_id boundary_id,
379 const dealii::Point<dim, dealii::VectorizedArray<number>> &q_point,
380 DofReadView w_m,
381 DofWriteView w_p,
382 const BoundaryType bc_value_type = BoundaryType::inflow) const;
383
393 template <typename DofReadView, typename DofWriteView>
394 void
396 const dealii::types::boundary_id boundary_id,
397 const dealii::Point<dim, dealii::VectorizedArray<number>> &q_point,
398 DofReadView w_m,
399 DofWriteView w_p) const;
400
410 template <typename DofReadView, typename DofWriteView>
411 void
413 const dealii::types::boundary_id boundary_id,
414 const dealii::Point<dim, dealii::VectorizedArray<number>> &q_point,
415 DofReadView w_m,
416 DofWriteView w_p) const;
417
430 template <typename DofReadView, typename DofWriteView>
431 void
433 const dealii::types::boundary_id boundary_id,
434 const dealii::Point<dim, dealii::VectorizedArray<number>> &q_point,
435 DofReadView w_m,
436 DofWriteView w_p) const;
437 };
438} // namespace MeltPoolDG::CompressibleFlow
Helper class taking care of all boundary condition related computations for the compressible flow sol...
Definition boundary_conditions.hpp:94
std::map< dealii::types::boundary_id, std::shared_ptr< dealii::Function< dim > > > subsonic_outflow_fixed_energy
Definition boundary_conditions.hpp:325
std::tuple< ConservedVariables, ConservedVariablesGradient > get_boundary_face_value_and_gradient(const dealii::Point< dim, dealii::VectorizedArray< number > > &q_point, const dealii::Tensor< 1, dim, dealii::VectorizedArray< number > > &normal, dealii::types::boundary_id boundary_id, const ConservedVariables &w_m, const ConservedVariablesGradient &grad_w_m, const Material< dim, number > &material, bool is_gas_phase=true) const
This function sets the corresponding values on the fictional outer face if the face is located at a b...
Definition boundary_conditions.cpp:84
void set_boundary_conditions(const std::shared_ptr< SimulationCaseBase< dim, number > > &simulation_case, const std::string &operation_name)
Set the compressible flow boundary conditions.
Definition boundary_conditions.hpp:134
ConservedVariablesType< dim, number > ConservedVariables
Definition boundary_conditions.hpp:96
void set_partial_density_boundary_value_and_gradient(const dealii::Point< dim, dealii::VectorizedArray< number > > &q_point, dealii::types::boundary_id boundary_id, const DofReadView &w_m, const DofWriteView &w_p) const
Definition boundary_conditions.templates.hpp:249
dealii::VectorizedArray< number > VectorizedArrayType
Definition boundary_conditions.hpp:100
std::set< dealii::types::boundary_id > no_slip_adiabatic_wall_boundaries
Definition boundary_conditions.hpp:331
static const std::map< BoundaryType, std::string > boundary_type_to_string_map
Definition boundary_conditions.hpp:104
void apply_no_slip_wall_boundary(DofReadView w_m, DofWriteView w_p) const
Definition boundary_conditions.templates.hpp:39
void apply_subsonic_outflow_with_fixed_energy_boundary(const dealii::types::boundary_id boundary_id, const dealii::Point< dim, dealii::VectorizedArray< number > > &q_point, DofReadView w_m, DofWriteView w_p) const
Definition boundary_conditions.templates.hpp:122
void apply_inflow_boundary(const dealii::types::boundary_id boundary_id, const dealii::Point< dim, dealii::VectorizedArray< number > > &q_point, DofReadView w_m, DofWriteView w_p, const BoundaryType bc_value_type=BoundaryType::inflow) const
Definition boundary_conditions.templates.hpp:61
dealii::VectorizedArray< number > get_boundary_value(dealii::types::boundary_id boundary_id, BoundaryType boundary_condition, const dealii::Point< dim, dealii::VectorizedArray< number > > &location, unsigned component) const
Compute the prescribed boundary value at a specific location on the boundary.
Definition boundary_conditions.cpp:58
void set_boundary_condition(BoundaryType boundary_condition, std::map< dealii::types::boundary_id, std::shared_ptr< dealii::Function< dim > > > boundary_condition_function={})
Set a specific boundary condition and store it internally.
Definition boundary_conditions.cpp:29
std::map< dealii::types::boundary_id, std::shared_ptr< dealii::Function< dim > > > inflow_boundaries
Maps boundary IDs to the specific boundary functions.
Definition boundary_conditions.hpp:321
void apply_subsonic_outflow_with_fixed_pressure_boundary(const dealii::types::boundary_id boundary_id, const dealii::Point< dim, dealii::VectorizedArray< number > > &q_point, DofReadView w_m, DofWriteView w_p) const
Definition boundary_conditions.templates.hpp:92
void update_boundary_conditions(number time)
Update the boundary conditions.
Definition boundary_conditions.cpp:15
void apply_slip_wall_boundary(DofReadView w_m, DofWriteView w_p, const dealii::Tensor< 1, dim, dealii::VectorizedArray< number > > &normal) const
Definition boundary_conditions.templates.hpp:11
std::map< dealii::types::boundary_id, std::shared_ptr< dealii::Function< dim > > > combined_inflow_no_slip_wall_boundaries
Definition boundary_conditions.hpp:327
std::set< dealii::types::boundary_id > slip_wall_boundaries
Sets of boundary IDs.
Definition boundary_conditions.hpp:330
ConservedVariablesGradientType< dim, number > ConservedVariablesGradient
Definition boundary_conditions.hpp:97
BoundaryType get_boundary_type(const dealii::types::boundary_id boundary_id) const
Get the type of the boundary condition at a specific domain boundary.
Definition boundary_conditions.hpp:185
std::map< dealii::types::boundary_id, std::shared_ptr< dealii::Function< dim > > > subsonic_outflow_fixed_pressure
Definition boundary_conditions.hpp:323
std::tuple< ConservedVariables, ConservedVariablesGradient, ConservedVariables, ConservedVariablesGradient > get_jacobian_boundary_face_value_and_gradient(const dealii::Point< dim, dealii::VectorizedArray< number > > &q_point, const dealii::Tensor< 1, dim, dealii::VectorizedArray< number > > &normal, dealii::types::boundary_id boundary_id, const ConservedVariables &w_m, const ConservedVariables &delta_w_m, const ConservedVariablesGradient &grad_w_m, const ConservedVariablesGradient &grad_delta_w_m, number gamma) const
Compute boundary values and gradients, as well as their linearizations for the Jacobian.
Definition boundary_conditions.cpp:192
void apply_combined_inflow_no_slip_wall_boundary(const dealii::types::boundary_id boundary_id, const dealii::Point< dim, dealii::VectorizedArray< number > > &q_point, DofReadView w_m, DofWriteView w_p) const
Definition boundary_conditions.templates.hpp:147
void set_conserved_variables_boundary_value_and_gradient(const dealii::Point< dim, dealii::VectorizedArray< number > > &q_point, const dealii::Tensor< 1, dim, dealii::VectorizedArray< number > > &normal, dealii::types::boundary_id boundary_id, const DofReadView &w_m, const DofWriteView &w_p) const
Definition boundary_conditions.templates.hpp:202
BoundaryConditionType BoundaryType
Definition boundary_conditions.hpp:98
A class which provides all relevant material properties for a specific phase.
Definition material_data.hpp:18
Base class for managing a simulation case in a parallel computing environment.
Definition simulation_case_base.hpp:44
This file contains various functions that can be used to set and evaluate boundary conditions for the...
Definition boundary_condition_functions.hpp:17
dealii::Tensor< 1, n_conserved_variables< dim, n_species >, dealii::Tensor< 1, dim, VectorizedArrayType > > ConservedVariablesGradientType
Definition data_types.hpp:44
dealii::Tensor< 1, n_conserved_variables< dim, n_species >, VectorizedArrayType > ConservedVariablesType
Definition data_types.hpp:35
BETTER_ENUM(RampUpType, char, none, linear, exponential, cosine)
Enum for the type of ramp up function used for the velocity at an inflow boundary.
This file provides a collection of view types for the compressible Navier–Stokes solver....
Definition boundary_conditions.hpp:65
@ energy
Definition boundary_conditions.hpp:70
@ velocity
Definition boundary_conditions.hpp:69
@ density
Definition boundary_conditions.hpp:68
@ mass_fractions
Definition boundary_conditions.hpp:71