Repository navigation
Fix issue #233: remove the unreachable EB body-state machinery - #265
Merged
Merged
Conversation
…inery 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 / AMReX-Fluids#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 #includes. 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::define_workspace and used by the reflux and diffusion code. The comments in NavierStokes.cpp 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. 2D, 3D, EB-2D and EB-3D all build. The EB regtest flow_past_cylinder-x (2 MPI ranks, 10 steps) agrees bit-for-bit with the previous 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.
Fixes #233.
NavierStokesBase::init_ebhas no caller anywhere inSource/,Exec/orTutorials/, and it is the only caller ofinitialize_eb2_structs, which is in turn the only writer ofebmaskand the only place that clearsno_eb_in_domain. Withno_eb_in_domainstuck at its default oftrue,define_body_stateandset_body_statereturn on their first line, and the twoset_body_state(S_new)calls inNavierStokes.cppwere commented out anyway.Besides being dead, the code was a hazard if revived: the
singlevaluedbranch ofinitialize_eb2_structsand the point search indefine_body_statewalk anEBCellFlagFaband aBaseFab<int>with aBoxIteratoron 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 wouldBcastwithbody_rank == -1, guarded only by anAMREX_ASSERT, if no rank found an uncovered cell.Removed
init_eb,initialize_eb2_structs,define_body_state,set_body_state,ebInitialized, and theebmask,body_state,body_state_set,no_eb_in_domainandeb_initializedmembers.Source/NSB_K.Hheld onlyset_body_state_k, so the header is deleted along with its four#includes.facecentgoes too —initialize_eb2_structsheld its only assignment and nothing reads it.volfracandareafracstay: they are set on the live path inNavierStokesBase.cpp:774-775and used by the reflux and diffusion code.The
NavierStokes.cppcomments that pointed atset_body_stateare updated.initData'sEB_set_covered(S_new, COVERED_VAL)is unchanged and remains how covered cells get their values.Verification
Exec/run2d,Exec/run3d,Exec/eb_run2dandExec/eb_run3dall build clean.regtest.2d.flow_past_cylinder-x(2 MPI ranks, 10 steps) agrees bit-for-bit with the pre-change build on all fields includingvfrac(fcompare: PLOTFILE AGREE).🤖 Generated with Claude Code