12 namespace GridGenerator
22 template <
int dim,
template <
int,
int>
class Triangulation>
23 void step(Triangulation<dim, dim> &,
29 AssertThrow(
false, dealii::ExcNotImplemented());
35 template <
template <
int,
int>
class Triangulation>
36 void step(Triangulation<2, 2> &triangulation,
39 const double step_position,
40 const double step_height)
42 using namespace dealii;
44 dealii::Triangulation<2, 2> tria1, tria2, tria3;
45 tria3.set_mesh_smoothing(triangulation.get_mesh_smoothing());
47 GridGenerator::subdivided_hyper_rectangle(
48 tria1, {15, 4}, Point<2>(0., step_height), Point<2>(length, height));
50 GridGenerator::subdivided_hyper_rectangle(
54 Point<2>(step_position, step_height));
56 GridGenerator::merge_triangulations(tria1, tria2, tria3);
57 triangulation.copy_triangulation(tria3);
63 for (
auto cell : triangulation.active_cell_iterators()) {
64 for (
auto f : cell->face_indices()) {
65 const auto face = cell->face(f);
67 if (!face->at_boundary())
77 const auto center = face->center();
79 if (center[0] > 0. + 1.e-6 && center[0] < length - 1.e-6)
82 if (center[0] < 0. + 1.e-06)
91 triangulation.refine_global(4);
93 Point<2> point(step_position + 0.0125, step_height - 0.0125);
94 triangulation.set_manifold(1, SphericalManifold<2>(point));
96 for (
auto cell : triangulation.active_cell_iterators())
97 for (
unsigned int v : cell->vertex_indices()) {
99 (cell->vertex(v) - Point<2>(step_position, step_height)).norm();
100 if (distance < 1.e-6) {
101 for (
auto f : cell->face_indices()) {
102 const auto face = cell->face(f);
103 if (face->at_boundary())
104 face->set_manifold_id(1);
105 cell->set_manifold_id(1);
110 for (
auto cell : triangulation.active_cell_iterators()) {
111 if (cell->manifold_id() != 1)
114 cell->set_manifold_id(0);
116 for (
unsigned int v : cell->vertex_indices()) {
117 auto &vertex = cell->vertex(v);
119 if (std::abs(vertex[0] - step_position) < 1.e-6 &&
120 vertex[1] > step_height - 1.e-6)
121 vertex[0] = step_position + 0.0125 * (1 - std::sqrt(1. / 2.));
123 if (std::abs(vertex[1] - step_height) < 1.e-6 &&
124 vertex[0] < step_position + 0.005)
125 vertex[1] = step_height - 0.0125 * (1 - std::sqrt(1. / 2.));
144 Step(
const std::string subsection)
149 "length", length_,
"length of computational domain");
153 "height", height_,
"height of computational domain");
155 step_position_ = 0.6;
157 "step position", step_position_,
"x position of step");
160 this->add_parameter(
"step height", step_height_,
"height of step");
167 triangulation, length_, height_, step_position_, step_height_);
173 double step_position_;
Step(const std::string subsection)
void create_triangulation(typename Geometry< dim >::Triangulation &triangulation) final
typename Discretization< dim >::Triangulation Triangulation
void step(Triangulation< dim, dim > &, const double, const double, const double, const double)