Skip to content

IBM: TSC image points of an injecting body sample fluid cells only - #2252

Draft
sbryngelson wants to merge 1 commit into
MFlowCode:masterfrom
sbryngelson:feat/tsc-extras
Draft

sbryngelson wants to merge 1 commit into
MFlowCode:masterfrom
sbryngelson:feat/tsc-extras

Conversation

@sbryngelson

Copy link
Copy Markdown
Member

Summary

With ib_ip_interp = 2 (TSC), the 3x3 stencil around the image point of an injecting body (patch_ib%inj_species > 0) weights solid cells. Those cells are the body's own ghost cells, which hold the imposed injectant state rather than a mirror of the gas, so the injected state feeds back into its own image point. This change zeroes the solid cells of the stencil for injecting bodies and renormalises, which is what the inverse-distance stencil (ib_ip_interp = 1) already does. Non-injecting bodies and ib_ip_interp = 1 are unchanged.

Evidence

Hand runs on Tuolumne (MI300A, amdflang, --gpu mp), 1 rank, cylinder in a closed chamber, no-slip, v_blow = 20 m/s, quarter-length runs (reacting) or full length (inert). "IDW" is ib_ip_interp = 1, the reference. Shell s1 is the first fluid shell, 1 to 2 cells off the wall.

Inert N2 injection into O2/Ar at 300 K (reactions off), injected mass flux over v_blow (kg/m3) and shell density range:

cells/D IDW flux TSC master flux TSC patch flux IDW density TSC master density TSC patch density
4 1.0687 1.0919 1.0643 1.240-1.257 1.266-1.300 1.236-1.256
8 1.1424 1.1624 1.1421 1.230-1.254 1.253-1.279 1.237-1.252
16 1.1975 1.2267 1.1978 1.227-1.256 1.256-1.293 1.237-1.250

Reacting H2 injection into hot O2/Ar (examples/2D_ibm_burning_grain), first-shell H2 mass flux over v_blow and shell density range, at 1/4 of the run:

cells/D IDW flux TSC master flux TSC patch flux IDW density TSC master density TSC patch density
4 0.0113 0.0710 0.0104 0.041-0.356 0.163-0.402 0.041-0.357
8 0.0281 0.1021 0.0283 0.031-0.146 0.082-0.302 0.026-0.145

examples/2D_ibm_flameholder (4 cells/D, 1/8 of the run) shows the same: first-shell flux 0.0049 (IDW), 0.0197 (master TSC), 0.0048 (patch); minimum shell density 0.046, 0.198, 0.047.

Species stay in [0, 1] and no NaN appears in any of these runs on either build. The master TSC value is the near-wall H2 density of pure H2 at a far lower temperature than the case's, the signature of the injected state being sampled back.

Tests

  • New case 2D -> IBM -> Injecting Body -> ib_ip_interp=2 (burning-grain Example at 25x25, 50 steps, tolerance 1e-3). Its golden passes on the patch and fails on master.
  • Labels IBM: 103 passed. Chemistry: 44 passed, 2 failed (the two Thermostat cases, relative error 2.5e-6 against a 1e-6 tolerance; they fail identically, with the same errors, on unmodified master on this machine, and do not use inj_species).
  • ./mfc.sh precheck passes.

Limitations

  • Hand-tested on MI300A only (amdflang, --gpu mp); not on NVHPC or Cray CCE here.
  • The reacting Examples at 4 cells/D reach NaN late in the run (about 2000 steps) with ib_ip_interp = 1 as well as with the patch, so that is not related to this change; the comparisons above stop before it.
  • Which of IDW or TSC is closer to the true blown state is not established; the patch makes TSC agree with the existing IDW treatment of the injecting wall.

This PR was made with Claude Code (AI).

An injecting body's ghost cells hold the imposed injectant state, not a mirror of the gas. With ib_ip_interp = 2 the 3x3 stencil
weighted them, so the injected state fed back into its own image point. Zero the solid cells of the stencil for bodies with
inj_species > 0 and renormalise, as the inverse-distance stencil already does. Adds a golden-file test.
@github-actions

Copy link
Copy Markdown

Lines of Code

File Lines Diff
src/simulation/m_ibm.fpp 2891 +13
Directory Lines Diff
simulation 39491 +13
total 59457 +13

@github-actions

Copy link
Copy Markdown

Claude Code Review

Head SHA: 5672e63

Files changed:

  • 3
  • docs/documentation/case.md
  • src/simulation/m_ibm.fpp
  • toolchain/mfc/test/cases.py

Findings:
No issues found. Checked the changed hunks in m_ibm.fpp, cases.py and case.md from the diff only. The context directory was empty (m_ibm.fpp exceeds 1500 lines), so declarations of ii/jj/kk/ic and the s_tsc_weights internals were not verified. The 2D/3D stencil indexing (merge(3,1,p/=0), (kk-2)*min(p,1)) and the renormalization are consistent with each other.

This branch has not been deployed

No deployments
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.

1 participant