Refine per direction

30 views
Skip to first unread message

Uclus Heis

unread,
Aug 16, 2022, 9:23:15 AM8/16/22
to deal.II User Group
Good afternoon,

I am using the following function to create a mesh of a rectangle 2x1x1m

GridGenerator::hyper_rectangle(triangulation,Point<dim>(0,0,0),Point<dim>(2,1,1),false );
triangulation.refine_global(2);

This code generates. rectangle with 4 cells per direction. How can I perform a refinement so that I get more elements at the long dimension of the rectangle, for example 8 cells? I can not find a function to determine the number of refinements per direction. Could you please help me?

Thank you
Regards, 


Wolfgang Bangerth

unread,
Aug 16, 2022, 9:38:15 AM8/16/22
to dea...@googlegroups.com
On 8/16/22 07:23, Uclus Heis wrote:
>
> GridGenerator::hyper_rectangle(triangulation,Point<dim>(0,0,0),Point<dim>(2,1,1),false
> );
> triangulation.refine_global(2);
>
> This code generates. rectangle with 4 cells per direction. How can I perform a
> refinement so that I get more elements at the long dimension of the rectangle,
> for example 8 cells? I can not find a function to determine the number of
> refinements per direction. Could you please help me?
>

Take a look at GridGenerator::subdivided_hyper_rectangle().

Best
W.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/

Uclus Heis

unread,
Aug 17, 2022, 3:06:50 AM8/17/22
to deal.II User Group
Dear Wolfgang, 

Thank you very much I could solve that. 

I would like to ask another question if it is ok. When I try to export the mesh, using a parallel::distributed::Triangulation<dim>  with MPI, I am not able to export the whole mesh. What I get is the pieces of the mesh corresponding to a certain process.  Is it possible to export the msh file of the whole domain grid?


GridGenerator::subdivided_hyper_rectangle ( triangulation,repetitions,Point<dim>(0,0,0),Point<dim>(2, 1, 1),false);
triangulation.refine_global(1);
std::ofstream out("domain_grid.msh");
GridOut grid_out;
grid_out.write_msh(triangulation, out);


Thank you
Regards



Daniel Arndt

unread,
Aug 17, 2022, 8:46:57 AM8/17/22
to dea...@googlegroups.com
Uclus,

Use GridOut::write_vtu or GridOut::write_vtu_with_pvtu_record as demonstrated in step-40 instead.

Best,
Daniel

--
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 dealii+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/c51493cc-a651-4504-8dc9-9d901a5cf4efn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages