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
14#include <meltpooldg/utilities/better_enum.hpp>
16
17#include <map>
18#include <memory>
19#include <set>
20
22{
26 BETTER_ENUM(BoundaryConditionType,
27 char,
28 combined_inflow_no_slip_wall,
29 inflow,
30 slip_wall,
31 no_slip_wall,
32 subsonic_outflow_fixed_energy,
33 subsonic_outflow_fixed_pressure);
34
44 template <int dim>
56
62 template <int dim>
64 {
65 enum
66 {
69 energy = dim + 1,
71 };
72 };
73
74
91 template <int dim, typename number>
93 {
94 public:
97 using BoundaryType = BoundaryConditionType;
98
99 using VectorizedArrayType = dealii::VectorizedArray<number>;
100
103 inline static const std::map<BoundaryType, std::string> boundary_type_to_string_map = {
104 {BoundaryType::inflow, "inflow"},
105 {BoundaryType::subsonic_outflow_fixed_pressure, "outflow_fixed_pressure"},
106 {BoundaryType::subsonic_outflow_fixed_energy, "outflow_fixed_energy"},
107 {BoundaryType::slip_wall, "slip_wall"},
108 {BoundaryType::no_slip_wall, "no_slip_wall"},
109 {BoundaryType::combined_inflow_no_slip_wall, "combined_inflow_no_slip_wall"},
110 };
111
120 void
121 update_boundary_conditions(number time);
122
132 void
133 set_boundary_conditions(const std::shared_ptr<SimulationCaseBase<dim, number>> &simulation_case,
134 const std::string &operation_name)
135 {
136 set_boundary_condition(BoundaryType::inflow,
137 simulation_case->get_boundary_condition("inflow", operation_name));
138
139 set_boundary_condition(BoundaryType::subsonic_outflow_fixed_pressure,
140 simulation_case->get_boundary_condition("outflow_fixed_pressure",
141 operation_name));
142
143 set_boundary_condition(BoundaryType::subsonic_outflow_fixed_energy,
144 simulation_case->get_boundary_condition("outflow_fixed_energy",
145 operation_name));
146
147 set_boundary_condition(BoundaryType::slip_wall,
148 simulation_case->get_boundary_condition("slip_wall", operation_name));
149
150 set_boundary_condition(BoundaryType::no_slip_wall,
151 simulation_case->get_boundary_condition("no_slip_wall",
152 operation_name));
153
154 set_boundary_condition(BoundaryType::combined_inflow_no_slip_wall,
155 simulation_case->get_boundary_condition("combined_inflow_no_slip_wall",
156 operation_name));
157 }
158
167 void
169 BoundaryType boundary_condition,
170 std::map<dealii::types::boundary_id, std::shared_ptr<dealii::Function<dim>>>
171 boundary_condition_function = {});
172
184 get_boundary_type(const dealii::types::boundary_id boundary_id) const
185 {
186 if (inflow_boundaries.contains(boundary_id))
187 return BoundaryType::inflow;
188 if (slip_wall_boundaries.contains(boundary_id))
189 return BoundaryType::slip_wall;
190 if (no_slip_adiabatic_wall_boundaries.contains(boundary_id))
191 return BoundaryType::no_slip_wall;
192 if (subsonic_outflow_fixed_energy.contains(boundary_id))
193 return BoundaryType::subsonic_outflow_fixed_energy;
194 if (subsonic_outflow_fixed_pressure.contains(boundary_id))
195 return BoundaryType::subsonic_outflow_fixed_pressure;
196 if (combined_inflow_no_slip_wall_boundaries.contains(boundary_id))
197 return BoundaryType::combined_inflow_no_slip_wall;
198 AssertThrow(false,
199 dealii::ExcMessage(
200 "There is no compressible flow boundary set at the boundary with boundary id " +
201 std::to_string(boundary_id) + "!"));
202 }
203
215 dealii::VectorizedArray<number>
216 get_boundary_value(dealii::types::boundary_id boundary_id,
217 BoundaryType boundary_condition,
218 const dealii::Point<dim, dealii::VectorizedArray<number>> &location,
219 unsigned component) const;
220
237 std::tuple<ConservedVariables, ConservedVariablesGradient>
239 const dealii::Point<dim, dealii::VectorizedArray<number>> &q_point,
240 const dealii::Tensor<1, dim, dealii::VectorizedArray<number>> &normal,
241 dealii::types::boundary_id boundary_id,
242 const ConservedVariables &w_m,
243 const ConservedVariablesGradient &grad_w_m,
244 const MaterialPhaseData<number> &material,
245 bool is_gas_phase = true) const;
246
256 template <typename DofReadView, typename DofWriteView>
257 void
259 const dealii::Point<dim, dealii::VectorizedArray<number>> &q_point,
260 const dealii::Tensor<1, dim, dealii::VectorizedArray<number>> &normal,
261 dealii::types::boundary_id boundary_id,
262 const DofReadView &w_m,
263 const DofWriteView &w_p) const;
264
274 template <int n_species, typename DofReadView, typename DofWriteView>
275 void
277 const dealii::Point<dim, dealii::VectorizedArray<number>> &q_point,
278 dealii::types::boundary_id boundary_id,
279 const DofReadView &w_m,
280 const DofWriteView &w_p) const;
281
303 std::tuple<ConservedVariables,
308 const dealii::Point<dim, dealii::VectorizedArray<number>> &q_point,
309 const dealii::Tensor<1, dim, dealii::VectorizedArray<number>> &normal,
310 dealii::types::boundary_id boundary_id,
311 const ConservedVariables &w_m,
312 const ConservedVariables &delta_w_m,
313 const ConservedVariablesGradient &grad_w_m,
314 const ConservedVariablesGradient &grad_delta_w_m,
315 number gamma) const;
316
317 private:
319 std::map<dealii::types::boundary_id, std::shared_ptr<dealii::Function<dim>>> inflow_boundaries;
320 std::map<dealii::types::boundary_id, std::shared_ptr<dealii::Function<dim>>>
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
328 std::set<dealii::types::boundary_id> slip_wall_boundaries;
329 std::set<dealii::types::boundary_id> no_slip_adiabatic_wall_boundaries;
330
339 template <typename DofReadView, typename DofWriteView>
340 void
342 DofReadView w_m,
343 DofWriteView w_p,
344 const dealii::Tensor<1, dim, dealii::VectorizedArray<number>> &normal) const;
345
353 template <typename DofReadView, typename DofWriteView>
354 void
355 apply_no_slip_wall_boundary(DofReadView w_m, DofWriteView w_p) const;
356
372 template <typename DofReadView,
373 typename DofWriteView,
374 typename DirichletValueInterpretation = InflowValueInterpretation<dim>>
375 void
376 apply_inflow_boundary(const dealii::types::boundary_id boundary_id,
377 const dealii::Point<dim, dealii::VectorizedArray<number>> &q_point,
378 DofReadView w_m,
379 DofWriteView w_p,
380 const BoundaryType bc_value_type = BoundaryType::inflow) const;
381
391 template <typename DofReadView, typename DofWriteView>
392 void
394 const dealii::types::boundary_id boundary_id,
395 const dealii::Point<dim, dealii::VectorizedArray<number>> &q_point,
396 DofReadView w_m,
397 DofWriteView w_p) const;
398
408 template <typename DofReadView, typename DofWriteView>
409 void
411 const dealii::types::boundary_id boundary_id,
412 const dealii::Point<dim, dealii::VectorizedArray<number>> &q_point,
413 DofReadView w_m,
414 DofWriteView w_p) const;
415
428 template <typename DofReadView, typename DofWriteView>
429 void
431 const dealii::types::boundary_id boundary_id,
432 const dealii::Point<dim, dealii::VectorizedArray<number>> &q_point,
433 DofReadView w_m,
434 DofWriteView w_p) const;
435 };
436} // namespace MeltPoolDG::CompressibleFlow
Helper class taking care of all boundary condition related computations for the compressible flow sol...
Definition boundary_conditions.hpp:93
std::map< dealii::types::boundary_id, std::shared_ptr< dealii::Function< dim > > > subsonic_outflow_fixed_energy
Definition boundary_conditions.hpp:323
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:133
ConservedVariablesType< dim, number > ConservedVariables
Definition boundary_conditions.hpp:95
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:255
dealii::VectorizedArray< number > VectorizedArrayType
Definition boundary_conditions.hpp:99
std::set< dealii::types::boundary_id > no_slip_adiabatic_wall_boundaries
Definition boundary_conditions.hpp:329
static const std::map< BoundaryType, std::string > boundary_type_to_string_map
Definition boundary_conditions.hpp:103
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:128
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:57
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:28
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:319
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:14
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:325
std::set< dealii::types::boundary_id > slip_wall_boundaries
Sets of boundary IDs.
Definition boundary_conditions.hpp:328
ConservedVariablesGradientType< dim, number > ConservedVariablesGradient
Definition boundary_conditions.hpp:96
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:184
std::map< dealii::types::boundary_id, std::shared_ptr< dealii::Function< dim > > > subsonic_outflow_fixed_pressure
Definition boundary_conditions.hpp:321
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 MaterialPhaseData< 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:83
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:194
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:153
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:208
BoundaryConditionType BoundaryType
Definition boundary_conditions.hpp:97
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:54
dealii::Tensor< 1, n_conserved_variables< dim, n_species >, VectorizedArrayType > ConservedVariablesType
Definition data_types.hpp:45
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:64
@ energy
Definition boundary_conditions.hpp:69
@ velocity
Definition boundary_conditions.hpp:68
@ density
Definition boundary_conditions.hpp:67
@ mass_fractions
Definition boundary_conditions.hpp:70
Collection of material parameters for a specific fluid phase.
Definition material.hpp:140