walberla: fix LB VTK writers exporting last block's data on multi-block ranks (bug-sweep #14)#5381
Draft
RudolfWeeber wants to merge 1 commit into
Draft
Conversation
…ck ranks (bug-sweep #14) register_vtk_field_writers installed one VTKWriter instance plus a beforeFunction that looped over all local blocks, repeatedly calling set_content/set_dims on a single shared buffer. waLBerla runs the beforeFunction exactly once, so the buffer retained only the LAST block's data; the subsequent per-block evaluate pass then wrote that same buffer for every block. On any MPI rank holding more than one waLBerla block (blocks_per_mpi_rank with >1 block), density, velocity_vector and pressure_tensor VTK output was corrupted for all blocks but the last. Single-block ranks were unaffected, masking the bug. BoundaryVTKWriter already reads per-block via configure()/block_. Fix: make the VTKWriter buffers block-aware. m_content/m_dims become per-block maps keyed by the IBlock pointer, filled by the beforeFunction for every local block. configure() (invoked per block with block_ set) selects the current block's buffer, so evaluate()/get_first_index read the correct per-block data. The single-block path is numerically identical. Adds LBWalberlaVTKDoublePrecisionBlocksCPU to lattice_vtk.py (blocks_per_mpi_rank=[2,1,1]) which fails on the unfixed code with a ~50% per-node velocity/density mismatch and passes after the fix. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Your pull request does not meet our code documentation rules. The Doxygen documentation generated 1 unique warnings (total: 1, ignored: 0): You can generate these warnings with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
register_vtk_field_writers installed one VTKWriter instance plus a
beforeFunction that looped over all local blocks, repeatedly calling
set_content/set_dims on a single shared buffer. waLBerla runs the
beforeFunction exactly once, so the buffer retained only the LAST
block's data; the subsequent per-block evaluate pass then wrote that
same buffer for every block. On any MPI rank holding more than one
waLBerla block (blocks_per_mpi_rank with >1 block), density,
velocity_vector and pressure_tensor VTK output was corrupted for all
blocks but the last. Single-block ranks were unaffected, masking the
bug. BoundaryVTKWriter already reads per-block via configure()/block_.
Fix: make the VTKWriter buffers block-aware. m_content/m_dims become
per-block maps keyed by the IBlock pointer, filled by the beforeFunction
for every local block. configure() (invoked per block with block_ set)
selects the current block's buffer, so evaluate()/get_first_index read
the correct per-block data. The single-block path is numerically
identical.
Adds LBWalberlaVTKDoublePrecisionBlocksCPU to lattice_vtk.py
(blocks_per_mpi_rank=[2,1,1]) which fails on the unfixed code with a
~50% per-node velocity/density mismatch and passes after the fix.
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
🤖 Generated with Claude Code