how to refine only the outer cells of a mesh?

12 views
Skip to first unread message

Loylick

unread,
Dec 4, 2017, 5:56:38 AM12/4/17
to deal.II User Group
Hello!

I have hyper_ball triangulation refined couple of times globally. Now I want to refine only the cells which lay on the surface. In tutorial I've found the function refine_and_coarsen_fixed_number but I have not arrived at formulating the proper criteria. In examples you use a solution to buld the critaria to refine adaptively a mesh. What is the most simple way to make it?

Alex

Daniel Arndt

unread,
Dec 4, 2017, 6:44:19 AM12/4/17
to deal.II User Group
Alex,

have a look at step-1. The relevant piece of code there looks like

for (; cell!=endc; ++cell)
{
  for (unsigned int v=0; v < GeometryInfo<2>::vertices_per_cell; ++v)
  {
    const double distance_from_center = center.distance (cell->vertex(v));
    if (std::fabs(distance_from_center - inner_radius) < 1e-10)
    {
      cell->set_refine_flag ();
      break;
    }
  }
}

For your purpose, it should be sufficient to check for cell->at_boundary().

Best,
Daniel
Reply all
Reply to author
Forward
0 new messages