ForestClaw / forestclaw

Quadtree/octree adaptive PDE solver based based on p4est.
http://www.forestclaw.org
BSD 2-Clause "Simplified" License
57 stars 21 forks source link

(gauges) Don't overcount gauges #326

Closed donnaaboise closed 3 months ago

donnaaboise commented 3 months ago

Gauges on the boundary between patches or blocks were getting over-counted. Change comparisons to

xll <= g.x < xur

This may mean that gauges exactly on an upper boundary will not get counted.

cburstedde commented 3 months ago

Gauges on the boundary between patches or blocks were getting over-counted. Change comparisons to

xll &lt;= g.x &lt; xur

This may mean that gauges exactly on an upper boundary will not get counted.
You can view, comment on, or merge this pull request online at:

This is a bit puzzling since our search code makes sure that each point is found on at most one process and at most one patch. Would you be able to double-check our domain_search_points code @hannesbrandt?

https://github.com/ForestClaw/forestclaw/pull/326

donnaaboise commented 3 months ago

I don't think it is a problem with p4est. I allocate an sc_array for num_gauges points. But then in the process of reverse engineering the gauge locations relative to blocks, I included an offset for two different blocks (I suspect). and so the counts in the sc_array didn't match the counts in the block offsets. Something like this. It was an easy fix by just fixing the comparison.

The error message was :

[libsc 0] Abort: Assertion 'num_points == (int) coordinates->elem_count'
[libsc 0] Abort: /Users/calhoun/projects/ForestClaw/code/forestclaw/src/fclaw2d_convenience.c:1101
[libsc 0] Abort: Obtained 8 stack frames
[libsc 0] Stack 0: 0   magic                               0x0000000102e25be0 sc_abort_handler + 60
[libsc 0] Stack 1: 1   magic                               0x0000000102e264f4 sc_abort + 20
[libsc 0] Stack 2: 2   magic                               0x0000000102e265e8 sc_malloc_aligned.part.0 + 0
[libsc 0] Stack 3: 3   magic                               0x0000000102d94c64 fclaw2d_domain_search_points + 1024
[libsc 0] Stack 4: 4   magic                               0x0000000102d86388 fclaw_locate_gauges + 104
[libsc 0] Stack 5: 5   magic                               0x0000000102d8f63c fclaw_initialize + 620
[libsc 0] Stack 6: 6   magic                               0x0000000102e4df4c main + 412
[libsc 0] Stack 7: 7   dyld                                0x0000000184e710e0 start + 2360