mesh_generator

46 views
Skip to first unread message

LY XXXiao

unread,
Jun 23, 2022, 11:22:08 AM6/23/22
to deal.II User Group
Hi there,

Has anyone experienced this issue in mesh refinement:

I have already a basic mesh with 120 cells, and I only want to refine one element among them, so I set a refine_flag for this element. But the refinement does not happen ?? Is there anything else that I missed? I learned step 1 and step 6 for meshing problem.

Best regards,
Longying


Simon Sticko

unread,
Jun 23, 2022, 11:33:04 AM6/23/22
to dea...@googlegroups.com
Hi,

Did you call

triangulation.execute_coarsening_and_refinement();

after setting the refinement flag?

Best,
Simon
> --
> The deal.II project is located at http://www.dealii.org/ <http://www.dealii.org/>
> For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en <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 <mailto:dealii+un...@googlegroups.com>.
> To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/0cfddd51-4380-4cd3-81af-9259046b2c8en%40googlegroups.com <https://groups.google.com/d/msgid/dealii/0cfddd51-4380-4cd3-81af-9259046b2c8en%40googlegroups.com?utm_medium=email&utm_source=footer>.

Wolfgang Bangerth

unread,
Jun 23, 2022, 11:34:42 AM6/23/22
to dea...@googlegroups.com
On 6/24/22 00:22, LY XXXiao wrote:
>
> I have already a basic mesh with 120 cells, and I only want to refine one
> element among them, so I set a refine_flag for this element. But the
> refinement does not happen ?? Is there anything else that I missed? I learned
> step 1 and step 6 for meshing problem.
>

When you call the constructor of Triangulation, you provide "refinement flags"
that determine how refinement should happen. If you only mark one cell, you
would create an "island" of refined cells that has five additional degrees of
freedom, four of which are hanging nodes. This isn't worth it, and some of the
refinement flags will specifically avoid this kind of thing. You will want to
choose flags that allow it.

Best
W.

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

LY XXXiao

unread,
Aug 3, 2022, 3:34:27 AM8/3/22
to deal.II User Group
Dear Simon and prof. Bangerth

Thanks for your kind replies. The issue finally turned out to be that I set a 'smoothness' when I defined the triangulation ( my supervisor found it, he is a deal ii deep lover XD).

I have a further question though. The background is that, I am doing some electromagnetic geophysics simulation based on an octree mesh, and before that, I make a rectangular base mesh (make_grid) using GridGenerator::subdivided_hyper_rectangle. For the current case, my mesh size is 41*41*37, it will take 90s to make the grid. Is this time cost reasonable, as I don't feel so..

Best regards,
Longying

Wolfgang Bangerth

unread,
Aug 3, 2022, 12:14:19 PM8/3/22
to dea...@googlegroups.com
On 8/3/22 01:34, LY XXXiao wrote:
>
>
> I have a further question though. The background is that, I am doing some
> electromagnetic geophysics simulation based on an octree mesh, and before
> that, I make a rectangular base mesh (make_grid) using
> *GridGenerator::subdivided_hyper_rectangle*. For the current case, my mesh
> size is 41*41*37, it will take 90s to make the grid. Is this time cost
> reasonable, as I don't feel so..

It probably shouldn't take that long. Do you think you could come up with a
small test program (only containing the generation of the mesh) that
illustrates the issue and shows that the time is really spent in the
generation of the mesh?

As a general rule, though, one should try to create meshes by using as coarse
a mesh and then refine it. That's obviously not possible with a 41x41x37 mesh
because these are all prime numbers, but if you had wanted a mesh with
40x40x36 cells, for example, then one would generate a 10x10x9 cell mesh and
refine it globally twice.

LY XXXiao

unread,
Aug 11, 2022, 1:11:14 PM8/11/22
to deal.II User Group
Dear prof. Bangerth,

Thank you so much for your help. 

Yes, I tested the make_grid part on a separate sheet. As long as my size is 41*41*37, the time cost did not go down, i.e. approx. 90-110 s.

However, your solution 'coarse mesh + global refinement' did help, now it only cost 20s :)

Thanks again and best regards,
Longying

Reply all
Reply to author
Forward
0 new messages