Dear all,

attached is a minimal example in which I create two simple triangulations 
(tria1, tria2),
merge them, and finally anisotropically refine all cells 
(RefinementCase<3>::cut_xz).
I also write the merged triangulation to a file for visualizations sake.

My objective is to refine only in the global xy plane, that is, in global 
z-direction, I want to have one element everywhere (if hanging nodes allow 
that, of course).
For the given example,
RefinementCase<3>::cut_xz 
is correct for tria1, but not for tria2. 
I read the documenation which states that anisotropic refinement occurs 
w.r.t the local coordinate system of the cell, so I am not really surprised 
about the above result.

Anyway, is there a way to perform anisotropic with regard to the global 
system?
My ideas was to, based on the local orientation of the cell system, pass a 
different RefinementCase when marking the cells for refinement.
The TriaAccessor class offers the combined_face_orientation() function, but 
I am
not sure if it helps here.

Thank you for your input!

Best,
Simon


-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/68df0485-a2dc-4c75-abdf-27dd52e87bb5n%40googlegroups.com.
#include <deal.II/grid/tria.h>
#include <deal.II/grid/grid_generator.h>
#include <deal.II/grid/grid_out.h>
#include <deal.II/grid/grid_tools.h>

#include <deal.II/base/geometry_info.h>

using namespace dealii;

int main()
{

  Triangulation<3> tria, tria1, tria2;
  
  GridGenerator::hyper_cube_with_cylindrical_hole(tria1,
                                                    2.5,
                                                    7.5,
                                                    15.0,
                                                    1,
                                                    false);
  GridGenerator::hyper_cube(tria2, 7.5, 22.5);
  GridTools::shift(dealii::Point<3>{0,-15.0,-7.5}, tria2);
  // merge them
  dealii::GridGenerator::merge_triangulations<3>(tria1, tria2, tria);
  // execute global refinements
  for (unsigned int i = 0; i<2; ++i)
    {
      for(const auto &cell : tria.active_cell_iterators())
        cell->set_refine_flag(RefinementCase<3>::cut_xz);
      tria.execute_coarsening_and_refinement();
    } 

  // output the mesh
  std::ofstream             file("tria.vtk");
  dealii::GridOut           gridOut;
  dealii::GridOutFlags::Vtk vtkFlags(true, true, true, false);
  gridOut.set_flags(vtkFlags);
  gridOut.write_vtk(tria, file);

  return 0;
}

Reply via email to