Similarly, we can transform a regularly refined
unit square to a wall-adapted mesh in y direction using the formula
-$(x,y) \mapsto (x,\tanh(2*y)/\tanh(2))$. This is done in <code>grid_6()</code>
+$(x,y) \mapsto (x,\tanh(2 y)/\tanh(2))$. This is done in <code>grid_6()</code>
of this tutorial:
<TABLE WIDTH="60%" ALIGN="center">
<tr>
<code>manifold_id</code> with a Manifold object. For more information on this
see the @ref GlossManifoldIndicator "glossary entry on this topic".
- Finally, you must mark cells and cell faces with the correct
- <code>manifold_id</code>. For example, you could get an annular domain with
+ <code>manifold_id</code>. For example, you could get an annular sector with
curved cells in Cartesian coordinates (but rectangles in polar coordinates)
by doing the following:
@code
- PolarManifold<2> polar_manifold;
- Triangulation<2> triangulation;
- const types::manifold_id polar_id = 42;
- GridGenerator::hyper_shell(triangulation, Point<2>(), 0.5, 1.0, 10);
- triangulation.set_manifold(polar_id, polar_manifold);
- triangulation.set_all_manifold_ids(polar_id);
+ Triangulation<2> tria;
+ GridGenerator::hyper_cube(tria);
+ const auto cell = tria.begin_active();
+ cell->vertex(2) = Point<2>(-0.5, 1.0);
+ cell->vertex(3) = Point<2>(1.5, 1.0);
+ tria.set_all_manifold_ids(42);
+ tria.set_manifold(42, PolarManifold<2>(Point<2>(0.5, -1.0)));
+ tria.refine_global(3);
@endcode
Now, when the grid is refined, all cell splitting calculations will be done in
polar coordinates.
}
}
- // In the second step we will refine the mesh twice. To do this
- // correctly, we have to associate a geometry object with the
- // boundary of the hole; since the boundary of the hole has boundary
- // indicator 1 (see the documentation of the function that generates
- // the mesh), we need to create an object that describes a spherical
- // manifold (i.e., a hyper ball) with appropriate center and assign
- // it to the triangulation. Notice that the function that generates
- // the triangulation sets the boundary indicators of the inner mesh,
- // but leaves unchanged the manifold indicator. We copy the boundary
- // indicator to the manifold indicators in order for the object to
- // be refined accordingly.
- // We can then refine twice:
- GridTools::copy_boundary_to_manifold_id(triangulation);
- const SphericalManifold<2> boundary_description(Point<2>(0,0));
- triangulation.set_manifold (1, boundary_description);
+ // In the second step we will refine the mesh twice. To do this correctly,
+ // we should place new points on the interior boundary along the surface of
+ // a circle centered at the origin. Fortunately,
+ // GridGenerator::hyper_cube_with_cylindrical_hole already attaches a
+ // Manifold object to the interior boundary, so we do not need to do
+ // anything but refine the mesh (see the @ref Results results section for a
+ // fully worked example where we <em>do</em> attach a Manifold object).
triangulation.refine_global(2);
-
- // The mesh so generated is then passed to the function that generates
- // output. In a final step we remove the boundary object again so that it is
- // no longer in use by the triangulation when it is destroyed (the boundary
- // object is destroyed first in this function since it was declared after
- // the triangulation).
print_mesh_info (triangulation, "grid-3.eps");
- triangulation.reset_manifold(1);
}
// There is one snag to doing things as shown above: If one moves the nodes on