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