8#include <compile_time_options.h>
14 namespace GridGenerator
24 template <
int dim,
template <
int,
int>
class Triangulation>
25 void step(Triangulation<dim, dim> &,
31 AssertThrow(
false, dealii::ExcNotImplemented());
37 template <
template <
int,
int>
class Triangulation>
38 void step(Triangulation<2, 2> &triangulation,
41 const double step_position,
42 const double step_height)
44 using namespace dealii;
46 dealii::Triangulation<2, 2> tria1, tria2, tria3;
47 tria3.set_mesh_smoothing(triangulation.get_mesh_smoothing());
49 GridGenerator::subdivided_hyper_rectangle(
50 tria1, {15, 4}, Point<2>(0., step_height), Point<2>(length, height));
52 GridGenerator::subdivided_hyper_rectangle(
56 Point<2>(step_position, step_height));
58 GridGenerator::merge_triangulations(tria1, tria2, tria3);
59 triangulation.copy_triangulation(tria3);
65 for (
auto cell : triangulation.active_cell_iterators()) {
66 for (
auto f : cell->face_indices()) {
67 const auto face = cell->face(f);
69 if (!face->at_boundary())
79 const auto center = face->center();
81 if (center[0] > 0. + 1.e-6 && center[0] < length - 1.e-6)
84 if (center[0] < 0. + 1.e-06)
93 triangulation.refine_global(4);
95 Point<2> point(step_position + 0.0125, step_height - 0.0125);
96 triangulation.set_manifold(1, SphericalManifold<2>(point));
98 for (
auto cell : triangulation.active_cell_iterators())
99 for (
unsigned int v : cell->vertex_indices()) {
101 (cell->vertex(v) - Point<2>(step_position, step_height)).norm();
102 if (distance < 1.e-6) {
103 for (
auto f : cell->face_indices()) {
104 const auto face = cell->face(f);
105 if (face->at_boundary())
106 face->set_manifold_id(1);
107 cell->set_manifold_id(1);
112 for (
auto cell : triangulation.active_cell_iterators()) {
113 if (cell->manifold_id() != 1)
116 cell->set_manifold_id(0);
118 for (
unsigned int v : cell->vertex_indices()) {
119 auto &vertex = cell->vertex(v);
121 if (std::abs(vertex[0] - step_position) < 1.e-6 &&
122 vertex[1] > step_height - 1.e-6)
123 vertex[0] = step_position + 0.0125 * (1 - std::sqrt(1. / 2.));
125 if (std::abs(vertex[1] - step_height) < 1.e-6 &&
126 vertex[0] < step_position + 0.005)
127 vertex[1] = step_height - 0.0125 * (1 - std::sqrt(1. / 2.));
146 Step(
const std::string &subsection)
151 "length", length_,
"length of computational domain");
155 "height", height_,
"height of computational domain");
157 step_position_ = 0.6;
159 "step position", step_position_,
"x position of step");
162 this->add_parameter(
"step height", step_height_,
"height of step");
166 dealii::Triangulation<dim> &triangulation)
const final
169 triangulation, length_, height_, step_position_, step_height_);
175 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)