Skip to content

Clean correct state subroutine - #1838

Draft
danieljvickers wants to merge 4 commits into
MFlowCode:masterfrom
danieljvickers:clean-correct-state-subroutine
Draft

Clean correct state subroutine#1838
danieljvickers wants to merge 4 commits into
MFlowCode:masterfrom
danieljvickers:clean-correct-state-subroutine

Conversation

@danieljvickers

@danieljvickers danieljvickers commented Sep 10, 2026

Copy link
Copy Markdown
Member

Since we are planning to extend the immersed boudnary method to include more features and EOS, I have moved out some of the subroutines involved in this calculation to clean up the s_ibm_correct_state subroutine. Mostly adding abstractions and making it clear where modifications for various EOS need to go.

I have a few branches open right now as I am still waiting for pull requests to go through. This will heavily conflict with my current debug branch that is still uncovering new bugs. When that branch eventually gets merged, I will have to return and do similar abstraction for getting temperature and density and setting energy.

This is not a draft, but a full PR ready for merge. I am leaving it as a draft for now by request of @sbryngelson. I will let him determine when to open a PR

@github-actions

Copy link
Copy Markdown

Claude Code Review

Head SHA: 9ae77c5

Files changed:

  • 1
  • src/simulation/m_ibm.fpp

Findings:

  • src/simulation/m_ibm.fpp (new s_compute_ghost_point_pressure, ~line 166-172): the case default branch for state-dependent EOS (Mie-Gruneisen/JWL/Vinet) only calls s_mpi_abort under #ifndef MFC_GPU. On a GPU build, hitting this branch (moving IB + a fluid using a non-ideal/non-stiffened-gas EOS) silently skips the pressure contribution for that fluid instead of erroring — pres_GP stays at its 0._wp initializer contribution for that species, and if every fluid uses a state-dependent EOS the ghost-point pressure is silently set to 0. Since src/simulation/ is the only GPU-accelerated target and this guard exists specifically to prevent an unimplemented/incorrect physics path from running, the CPU-only abort leaves GPU runs to silently produce wrong energy/pressure fields for this combination rather than failing loudly, which is the exact "silent wrong answer" failure mode this codebase treats as most severe.

@github-actions

Copy link
Copy Markdown

Lines of Code

File Lines Diff
src/simulation/m_ibm.fpp 1281 +28
Directory Lines Diff
simulation 28065 +28
total 46290 +28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants