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