ryujin 2.1.1 revision ef0fcd4010d109b860652ece4a7b8963fb7d46b1
geometry_wall.h
Go to the documentation of this file.
1//
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3// Copyright (C) 2022 - 2023 by the ryujin authors
4//
5
6#pragma once
7
8#include <compile_time_options.h>
9
11
12namespace ryujin
13{
14 namespace GridGenerator
15 {
28 template <int dim, int spacedim, template <int, int> class Triangulation>
29 void wall(Triangulation<dim, spacedim> &,
30 const double /*length*/,
31 const double /*height*/,
32 const double /*wall_position*/)
33 {
34 AssertThrow(false, dealii::ExcNotImplemented());
35 __builtin_trap();
36 }
37
38
39#ifndef DOXYGEN
40 template <template <int, int> class Triangulation>
41 void wall(Triangulation<2, 2> &triangulation,
42 const double length,
43 const double height,
44 const double wall_position)
45 {
46 using namespace dealii;
47
48 dealii::Triangulation<2, 2> tria1, tria2, tria3;
49 tria3.set_mesh_smoothing(triangulation.get_mesh_smoothing());
50
51 GridGenerator::subdivided_hyper_rectangle(
52 tria1, {18, 6}, Point<2>(wall_position, 0), Point<2>(length, height));
53
54 GridGenerator::subdivided_hyper_rectangle(
55 tria2, {1, 6}, Point<2>(0., 0.), Point<2>(wall_position, height));
56
57 GridGenerator::merge_triangulations(tria1, tria2, tria3);
58
59 triangulation.copy_triangulation(tria3);
60
61 /*
62 * Set boundary ids:
63 */
64
65 for (auto cell : triangulation.active_cell_iterators()) {
66 for (auto f : cell->face_indices()) {
67 const auto face = cell->face(f);
68
69 if (!face->at_boundary())
70 continue;
71
72 /*
73 * We want slip boundary conditions (i.e. indicator 1) at the
74 * bottom starting at position wall_position. We do nothing on the
75 * right boundary and enforce inflow conditions elsewhere
76 */
77
78 const auto center = face->center();
79
80 if (center[0] > wall_position && center[1] < 1.e-6) {
81 face->set_boundary_id(Boundary::slip);
82
83 } else if (center[0] > length - 1.e-6) {
84
85 face->set_boundary_id(Boundary::do_nothing);
86
87 } else {
88
89 // the rest:
90 face->set_boundary_id(Boundary::dirichlet);
91 }
92 } /*f*/
93 } /*cell*/
94 }
95#endif
96 } /* namespace GridGenerator */
97
98
99 namespace Geometries
100 {
106 template <int dim>
107 class Wall : public Geometry<dim>
108 {
109 public:
110 Wall(const std::string subsection)
111 : Geometry<dim>("wall", subsection)
112 {
113 length_ = 3.2;
114 this->add_parameter(
115 "length", length_, "length of computational domain");
116
117 height_ = 1.0;
118 this->add_parameter(
119 "height", height_, "height of computational domain");
120
121 wall_position_ = 1. / 6.;
122 this->add_parameter(
123 "wall position", wall_position_, "x position of wall");
124 }
125
127 typename dealii::Triangulation<dim> &triangulation) final
128 {
129 GridGenerator::wall(triangulation, length_, height_, wall_position_);
130 }
131
132 private:
133 double length_;
134 double height_;
135 double wall_position_;
136 };
137 } /* namespace Geometries */
138} /* namespace ryujin */
void create_triangulation(typename dealii::Triangulation< dim > &triangulation) final
Wall(const std::string subsection)
void wall(Triangulation< dim, spacedim > &, const double, const double, const double)
Definition: geometry_wall.h:29