8#include <ryujin/base/compile_time_options.h>
13 namespace GridGenerator
23 template <
int dim,
template <
int,
int>
class Triangulation>
24 void step(Triangulation<dim, dim> &,
30 AssertThrow(
false, dealii::ExcNotImplemented());
36 template <
template <
int,
int>
class Triangulation>
37 void step(Triangulation<2, 2> &triangulation,
40 const double step_position,
41 const double step_height)
43 using namespace dealii;
45 dealii::Triangulation<2, 2> tria1, tria2, tria3;
46 tria3.set_mesh_smoothing(triangulation.get_mesh_smoothing());
48 GridGenerator::subdivided_hyper_rectangle(
49 tria1, {15, 4}, Point<2>(0., step_height), Point<2>(length, height));
51 GridGenerator::subdivided_hyper_rectangle(
55 Point<2>(step_position, step_height));
57 GridGenerator::merge_triangulations(tria1, tria2, tria3);
58 triangulation.copy_triangulation(tria3);
64 for (
auto cell : triangulation.active_cell_iterators()) {
65 for (
auto f : cell->face_indices()) {
66 const auto face = cell->face(f);
68 if (!face->at_boundary())
78 const auto center = face->center();
80 if (center[0] > 0. + 1.e-6 && center[0] < length - 1.e-6)
83 if (center[0] < 0. + 1.e-06)
92 triangulation.refine_global(4);
94 Point<2> point(step_position + 0.0125, step_height - 0.0125);
95 triangulation.set_manifold(1, SphericalManifold<2>(point));
97 for (
auto cell : triangulation.active_cell_iterators())
98 for (unsigned int v : cell->vertex_indices()) {
100 (cell->vertex(v) - Point<2>(step_position, step_height)).norm();
101 if (distance < 1.e-6) {
102 for (
auto f : cell->face_indices()) {
103 const auto face = cell->face(f);
104 if (face->at_boundary())
105 face->set_manifold_id(1);
106 cell->set_manifold_id(1);
111 for (
auto cell : triangulation.active_cell_iterators()) {
112 if (cell->manifold_id() != 1)
115 cell->set_manifold_id(0);
117 for (
unsigned int v : cell->vertex_indices()) {
118 auto &vertex = cell->vertex(v);
120 if (std::abs(vertex[0] - step_position) < 1.e-6 &&
121 vertex[1] > step_height - 1.e-6)
122 vertex[0] = step_position + 0.0125 * (1 - std::sqrt(1. / 2.));
124 if (std::abs(vertex[1] - step_height) < 1.e-6 &&
125 vertex[0] < step_position + 0.005)
126 vertex[1] = step_height - 0.0125 * (1 - std::sqrt(1. / 2.));
145 Step(
const std::string &subsection)
150 "length", length_,
"length of computational domain");
154 "height", height_,
"height of computational domain");
156 step_position_ = 0.6;
158 "step position", step_position_,
"x position of step");
161 this->add_parameter(
"step height", step_height_,
"height of step");
165 dealii::Triangulation<dim> &triangulation)
const final
168 triangulation, length_, height_, step_position_, step_height_);
174 double step_position_;
Step(const std::string &subsection)
void create_coarse_triangulation(dealii::Triangulation< dim > &triangulation) const final
void step(Triangulation< dim, dim > &, const double, const double, const double, const double)