moose icon indicating copy to clipboard operation
moose copied to clipboard

Add distributed mesh support and fake neighbor handling in BreakMeshByBlock

Open ChengHauYang opened this issue 2 months ago • 2 comments

closes #12033 closes #21161

Previous PR #31636 had many repeated messages from the moosebuild bot due to a temporary CIVET hiccup, making the thread difficult to review. As suggested, I am opening a new clean PR here and closing the previous one.

Reason

Currently, BreakMeshByBlock (bmbb) uses a hacky approach to prepare the mesh.
When nodes are duplicated by bmbb, their former neighbors are no longer neighbors (since neighborhood is based on shared nodes). As a result:

  • We cannot call prepare_for_use() at the end of bmbb, because it would erase the discontinuous neighbor information.
  • To work around this, the framework has special hacks for bmbb (e.g., skipping mesh validity checks in debug mode when bmbb is present).

Another limitation is that bmbb cannot run with distributed meshes. This PR addresses that.


Design

  1. Preserving discontinuous neighbors

    • Since prepare_for_use() wipes out discontinuous neighbor data, we introduce a new data structure to store this information (referred to as fake neighbors).
    • These fake neighbors remain accessible to interface kernels that require them (e.g., CZM).
  2. Support for distributed meshes
    Following Roy’s suggestions:

    • Unique node IDs: In replicated meshes, new nodes were created with
      Node::build(*current_node, mesh->n_nodes()).release();
      
      This fails in distributed meshes.
      -> Solution: use communication between processors and assign deterministic IDs based on max_node_id strides.
    • Ghost node handling:
      • Phase 0: Each rank computes locally connected blocks for its owned nodes and sends this info to the node owner.
      • Phase 1: Node owners aggregate connected block info and broadcast the global set to all ranks.
    • Boundary ID assignment: Updated in line with Roy’s fix (commit link).

Impact

  • bmbb now supports distributed meshes.
  • prepare_for_use() can be safely called at the end of bmbb.
  • Removes the need for special hacks in the MOOSE framework for bmbb.

ChengHauYang avatar Dec 13 '25 16:12 ChengHauYang

Job Documentation, step Docs: sync website on 4b5ade5 wanted to post the following:

View the site here

This comment will be updated on new commits.

moosebuild avatar Dec 13 '25 19:12 moosebuild

Job Coverage, step Generate coverage on a06ed48 wanted to post the following:

Framework coverage

e6abc1 #32091 a06ed4
Total Total +/- New
Rate 85.81% 85.82% +0.01% 100.00%
Hits 125810 125901 +91 305
Misses 20802 20803 +1 0

Diff coverage report

Full coverage report

Modules coverage

Coverage did not change

Full coverage reports

Reports

This comment will be updated on new commits.

moosebuild avatar Dec 16 '25 09:12 moosebuild

Hi @lindsayad and @GiudGiud, thank you both for the feedback. Since my family is visiting the U.S. for the first time, I’ll be starting a vacation tomorrow. I may not be able to address any additional comments promptly for the rest of December. Thanks for your understanding!

ChengHauYang avatar Dec 16 '25 22:12 ChengHauYang

Hi @lindsayad and @GiudGiud, thank you both for the feedback. Since my family is visiting the U.S. for the first time, I’ll be starting a vacation tomorrow. I may not be able to address any additional comments promptly for the rest of December. Thanks for your understanding!

No rush. We appreciate your contributions any time they come in!

lindsayad avatar Dec 17 '25 20:12 lindsayad

Job Test, step Results summary on 4b5ade5 wanted to post the following:

Framework test summary

Compared against fb28c06 in job civet.inl.gov/job/3464837.

Added tests

Test Time (s) Memory (MB)
constraints/equal_value_boundary_constraint.set_primary_and_coord_error 1.38 102.53
constraints/equal_value_boundary_constraint.error_multiple_primary_nodes 1.31 116.55
constraints/equal_value_boundary_constraint.error_not_find_node_id 1.31 105.50
constraints/equal_value_boundary_constraint.test_primary_node_coord 0.89 95.55

Modules test summary

Compared against fb28c06 in job civet.inl.gov/job/3464837.

Added tests

Test Time (s) Memory (MB)
solid_mechanics/test:cohesive_zone_model.czm_framework/boundary_pair_not_found 1.55 130.24

moosebuild avatar Dec 19 '25 04:12 moosebuild