A cube rather than a ball with GridGenerator::hyper_ball

19 views
Skip to first unread message

Alberto Salvadori

unread,
Nov 17, 2017, 5:51:57 AM11/17/17
to deal.II User Group
Dear community 

I have been trying to solve this cumbersome issue but I could not. I must have been doing something wrong. 

I am defining a triangulation and a dof handler as follows in the main class:

parallel::shared::Triangulation<dim>   triangulation;

DoFHandler<dim>      dof_handler;

 

and creating a grid afterwards with the following commands:

  const Point<dim> center;

  double cell_radius = 20.0 ; // microns

  

  GridGenerator::hyper_ball ( triangulation, center, cell_radius );

  static SphericalManifold<dim> volume_boundary;

  

  triangulation.refine_global ( 3 );

  triangulation.set_all_manifold_ids_on_boundary(0);

  triangulation.set_manifold (0, volume_boundary);


On this grid I aim at solving an elastic problem, and it works just fine. Output is printed but once I open the pvtu file, I see a cube of edge 11.5 rather than a ball of radius 20. See the attached image.
It looks like the Spherical Manifold is not linked. Numbers are just fine, for what they may mean.

By the way, if I use a GridGenerator::hyper_cube everything comes out as expected.

Thanks for your help and suggestions! I am using version 8.5.1 on a mac, running on 8 processors.
Alberto
Screen Shot 2017-11-17 at 11.46.31 AM.png

luca.heltai

unread,
Nov 17, 2017, 6:31:17 AM11/17/17
to Deal.II Users
Dear Alberto,


> GridGenerator::hyper_ball ( triangulation, center, cell_radius );
>
> static SphericalManifold<dim> volume_boundary;
>
>
> triangulation.refine_global ( 3 );
>
> triangulation.set_all_manifold_ids_on_boundary(0);
>
> triangulation.set_manifold (0, volume_boundary);


You should put the `refine_global` **after** set_manifold.

Now you are refining a coarse hyperball (a cube) and then you are attaching a manifold. You should first attach the manifold, then refine.

Best,
Luca.
Reply all
Reply to author
Forward
0 new messages