Repository navigation
Fix segfault when managed memory is not used. - #147
Merged
Merged
Conversation
asalmgren
approved these changes
Jul 28, 2023
This was referenced Aug 13, 2026
Closed
asalmgren
added a commit
that referenced
this pull request
Oct 12, 2026
Fixes #233. `NavierStokesBase::init_eb` has no caller anywhere in `Source/`, `Exec/` or `Tutorials/`, and it is the only caller of `initialize_eb2_structs`, which is in turn the only writer of `ebmask` and the only place that clears `no_eb_in_domain`. With `no_eb_in_domain` stuck at its default of `true`, `define_body_state` and `set_body_state` return on their first line, and the two `set_body_state(S_new)` calls in `NavierStokes.cpp` were commented out anyway. Besides being dead, the code was a hazard if revived: the `singlevalued` branch of `initialize_eb2_structs` and the point search in `define_body_state` walk an `EBCellFlagFab` and a `BaseFab<int>` with a `BoxIterator` on the host, which is invalid for the device-resident data of a GPU build (the bug class fixed in 92f0e72 / #147), and the rank search would `Bcast` with `body_rank == -1`, guarded only by an `AMREX_ASSERT`, if no rank found an uncovered cell. Removed `init_eb`, `initialize_eb2_structs`, `define_body_state`, `set_body_state`, `ebInitialized`, and the `ebmask`, `body_state`, `body_state_set`, `no_eb_in_domain` and `eb_initialized` members. `Source/NSB_K.H` held only `set_body_state_k`, so the header is deleted along with its four `#include`s. `facecent` goes too — `initialize_eb2_structs` held its only assignment and nothing reads it. `volfrac` and `areafrac` stay: they are set on the live path in `NavierStokesBase.cpp:774-775` and used by the reflux and diffusion code. The `NavierStokes.cpp` comments that pointed at `set_body_state` are updated. `initData`'s `EB_set_covered(S_new, COVERED_VAL)` is unchanged and remains how covered cells get their values. ## Verification - `Exec/run2d`, `Exec/run3d`, `Exec/eb_run2d` and `Exec/eb_run3d` all build clean. - EB regtest `regtest.2d.flow_past_cylinder-x` (2 MPI ranks, 10 steps) agrees bit-for-bit with the pre-change build on all fields including `vfrac` (`fcompare`: PLOTFILE AGREE). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
No description provided.