Skip to content

DDMC Bugfix? - #35

Merged
RyanWollaeger merged 1 commit into
developfrom
dempsey/ddmc_fix
Aug 7, 2026
Merged

DDMC Bugfix?#35
RyanWollaeger merged 1 commit into
developfrom
dempsey/ddmc_fix

Conversation

@adamdempsey90

Copy link
Copy Markdown
Collaborator

From GPT

Background

Fix a device-side assertion in Jaybenne IMC/DDMC runs with static mesh
refinement:

Invalid transition from DDMC to IMC.

Problem

A DDMC particle crossing a mesh-block boundary is marked for communication by
zeroing its velocity. On receipt, Jaybenne identifies the DDMC entry face from
the particle position and either samples its fine-block face location or
resamples it as an IMC particle.

The DDMC position offset is eps_ddmc_offset(), but the transition checks use
only parthenon::robust::EPS() as their matching tolerance. Source and
destination cell faces are calculated independently, so valid coarse-to-fine
transitions can miss this machine-epsilon-sized window due to roundoff. The
particle remains zero-velocity and subsequently reaches the
Invalid transition from DDMC to IMC. device assertion.

The issue is exposed by static refinement, including the stratified
rotating-frame IMC/DDMC case on AMD GPUs. Rotating-frame physics can change
where DDMC/IMC interfaces occur but does not directly move photon positions.

Description of Changes

  • Add eps_ddmc_match_tolerance() in transport_utils.hpp.

    It returns 0.1 * eps_ddmc_offset(), providing a tolerance that absorbs
    face-construction roundoff while remaining well below the separation between
    the valid 0.5x, 1x, and 2x DDMC entry offsets.

  • Use this tolerance for DDMC transition detection in:

    • ptcl_ddmc_to_imc() in src/jaybenne/transport_utils.hpp
    • SampleDDMCBlockFace() in src/jaybenne/sample_ddmc_bface.cpp
  • Add the missing break after successfully matching the lower-X2 face in
    ptcl_ddmc_to_imc(). This matches the control flow of the other five face
    branches and avoids a needless second iteration through the offset loop.

Checklist

  • New features are documented
  • Tests added for bug fixes and new features
  • (@lanl.gov employees) Update copyright on changed files

@RyanWollaeger

Copy link
Copy Markdown
Collaborator

Ah - sorry for this - should've anticipated the possible slight block mesh discrepancy - LGTM (assuming it gets past the error you hit).

@RyanWollaeger
RyanWollaeger merged commit ff50556 into develop Aug 7, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants