Dear all,
I created a mesh using GridGenerator::hyper_cube_with_cylindrical_hole and removed after that half of the total number of the cells in order to make use of symmetry.
Then I set a SphericalManifold<2> (2D) respectively CylindricalManifold<3> (3D) in order to get a true circle (2D) respectively a true cylinder (3D) after global and/or adaptive refining.
Without removing some cells, i.e. just using the GridGenerator::hyper_cube_with_cylindrical_hole without using symmetry, both 2D and 3D variants work fine.
With removing some cells, i.e. using symmetry, only in 2D I get a true circle as result. In 3D however, the SphericalManifold<3> does not work anymore. (I can adaptively refine the inner hole, but the result is not a true cylinder anymore which was the case without removing the cells).
In the following is a snippet of my code. It´s hard for me to find out what the problem actually is, since in 2D the manifold description worked after removing some cells.
Thanks for helping!
Best
Simon
const double outer_radius = 1.0;
const double inner_radius = 0.5;
const Point<dim> center;
GridGenerator::hyper_cube_with_cylindrical_hole(triangulation_tmp,
inner_radius,
outer_radius,
0.5,
1,
false /*boundary_id_inner_hole is set to 1*/);
std::set<typename Triangulation<dim>::active_cell_iterator> cells_to_remove;
typename Triangulation<dim>::active_cell_iterator cell =triangulation_tmp.begin_active(),
endc = triangulation_tmp.end();
for(; cell!=endc; cell++)
{
if(cell->center()[1]<0)
{
cells_to_remove.insert(cell);
}
}
GridGenerator::create_triangulation_with_removed_cells(triangulation_tmp, cells_to_remove, triangulation);
std::unique_ptr<Manifold<dim>> ptr_manifold=nullptr;
if(dim==2)
{
ptr_manifold = std::make_unique<SphericalManifold<dim>>(center);
}
else if(dim==3)
{
ptr_manifold = std::make_unique<CylindricalManifold<dim>>(dim-1);
}
else
{
throw std::runtime_error("only allowed for dim == 2 or dim == 3");
}
types::boundary_id boundary_id_inner_hole=1;
types::manifold_id manifold_id_inner_hole=1;
triangulation.set_all_manifold_ids_on_boundary(boundary_id_inner_hole,manifold_id_inner_hole);
triangulation.set_manifold (manifold_id_inner_hole, *ptr_manifold);
..........