collect_periodic_faces slow on large grids and in parallel

14 views
Skip to first unread message

Praveen C

unread,
Dec 16, 2025, 5:10:41 AM (2 days ago) Dec 16
to Deal.II Googlegroup
Dear all

I am using parallel::distributed::Triangulation for a 3D problem.

Case 1. Suppose I create a 256^3 mesh like this

GridGenerator::subdivided_hyper_rectangle
Call for x,y,z
    GridTools::collect_periodic_faces
triangulation.add_periodicity

then code runs for a very long time to do this, and on some machines crashes with oom_kill error, which is related to out of memory error.

Case 2. It works fine if I do

GridGenerator::hyper_rectangle (initial mesh has single cell)
Call for x,y,z
    GridTools::collect_periodic_faces
triangulation.add_periodicity
triangulation.refine_global(8)

However I have nonstandard grid sizes, e.g., 195x72x106 which cannot be obtained by refine_global.

What options are there to improve the periodicity setup part.

Will parallel::fullydistributed:Tria help ?

thanks
praveen

Wolfgang Bangerth

unread,
Dec 17, 2025, 11:34:21 PM (1 hour ago) Dec 17
to dea...@googlegroups.com
On 12/16/25 03:10, Praveen C wrote:
>
> *Case 1.* Suppose I create a 256^3 mesh like this
>
> GridGenerator::subdivided_hyper_rectangle
> Call for x,y,z
>     GridTools::collect_periodic_faces
> triangulation.add_periodicity
>
> then code runs for a very long time to do this, and on some machines crashes
> with oom_kill error, which is related to out of memory error.

Praveen:
Can you be more specific? Show us a minimal code that demonstrates the problem
and that we can run. It should be possible to do this with not much more than
20 lines of code.

Specifically, in which operation is the CPU time used, and in which do you run
out of memory?

(My best guess is that the algorithms use a double loop over all coarse mesh
cells. This works well if you have a few dozen or a few hundred coarse mesh
cells, as we often do. But your 195x72x106 mesh has 1.5M coarse mesh cells,
and I'm not surprised that that doesn't work. You won't fix that issue by
going to a different triangulation class. I think it's inherent in the current
design of the periodic face finding algorithm, but we can't know for sure
unless we know where exactly the problem appears.)

Best
W.
Reply all
Reply to author
Forward
0 new messages