Skip to content

Add heterogeneous reacting surface boundary conditions - #1821

Open
rocfire11 wants to merge 18 commits into
MFlowCode:masterfrom
rocfire11:carbon-surface-v1
Open

Add heterogeneous reacting surface boundary conditions#1821
rocfire11 wants to merge 18 commits into
MFlowCode:masterfrom
rocfire11:carbon-surface-v1

Conversation

@rocfire11

@rocfire11 rocfire11 commented Sep 4, 2026

Copy link
Copy Markdown

Contribution Policy

We do not accept pull requests generated primarily by AI without genuine understanding or real-world usage context.

All contributions are expected to demonstrate:

  • A clear understanding of the codebase
  • Alignment with product direction
  • Thoughtful reasoning behind changes
  • Evidence of real-world usage or hands-on experience with the problem

If these expectations are not met, we would prefer to implement the changes ourselves rather than spend time reviewing low-effort submissions.


Acknowledgement

  • [ X] I confirm this PR meets the above expectations and reflects my own understanding and real-world context.

PR template credit: junegunn

Summary

This PR adds heterogeneous reacting surface boundary conditions for immersed
boundaries. The implementation was developed for reacting carbon-particle
simulations in which heterogeneous surface chemistry is coupled to the
compressible gas-phase species equations.

The surface treatment supports:

  • zero-normal-gradient temperature (thermal_bc = 0)
  • prescribed surface temperature (thermal_bc = 1)
  • coupled reacting-surface energy balance (thermal_bc = 2)
  • heterogeneous species-flux boundary conditions
  • Cantera-based heterogeneous surface mechanisms through
    surface_cantera_file and surface_phase

For a reacting surface, the species boundary condition balances diffusive
transport, Stefan mass flux, and heterogeneous surface production. One species
equation is replaced by the mass-fraction closure. When thermal_bc = 2, the
surface temperature is included as an additional Newton unknown and the
conductive and heterogeneous reaction heat fluxes are balanced.

Motivation

The immediate application is heterogeneous oxidation/gasification of carbon
particles using an immersed-boundary representation. The implementation is
intended to remain general with respect to the number of gas species and the
Cantera surface mechanism rather than hard-coding a particular carbon
mechanism.

Testing

The implementation has been tested using an 11-species reduced GRI-based gas-phase
mechanism together with a compatible heterogeneous carbon surface mechanism, including:

  • prescribed surface temperature
  • coupled surface species/energy solution
  • MPI CPU/GPU simulations on HiPerGator

Both prescribed-temperature and coupled-energy carbon cases run successfully
and produce the expected surface reaction products, oxygen consumption,
thermal field, and reacting wake.

The branch was rebased from current MFC master before the surface changes were
introduced, and ./mfc.sh precheck and the simulation build pass.

@codecov

codecov Bot commented Sep 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 56.97674% with 74 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.03%. Comparing base (e7139bc) to head (94ac09d).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/simulation/m_ibm.fpp 56.84% 55 Missing and 8 partials ⚠️
src/simulation/m_checker.fpp 15.38% 7 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1821      +/-   ##
==========================================
- Coverage   61.26%   61.03%   -0.23%     
==========================================
  Files          84       84              
  Lines       22330    22529     +199     
  Branches     3265     3286      +21     
==========================================
+ Hits        13680    13751      +71     
- Misses       6207     6307     +100     
- Partials     2443     2471      +28     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Thomas Jackson and others added 15 commits September 5, 2026 06:21
Conflict in m_ibm.fpp: master added the alpha_q, alpha_rho_q and e_q locals for per-phase EOS evaluation, this branch added W_species and the surface-reaction locals. Both sets are kept, and both appear in the kernel's private clause - a scalar assigned in the loop but absent from that list races under OpenMP offload.
get_slug hashed the phase name, which is conventionally 'gas', so two cases with different mechanisms shared one build and the second ran against the first's species set. This branch is the first to carry two gas mechanisms: the 3D reacting mixing layer's sandiego.yaml has nine species and the carbon surface case's reduced GRI mechanism has eleven, so whichever built first decided sys_size for both, and the mixing layer wrote 34 output files where its golden has 30. Reproduced by running both cases together, which is also why each passes alone. The build already reports the mechanism by source when it prints Chemistry:; this makes the key agree with what it prints.
…ombined with

W_species and Ys_s were declared dimension(num_species) outside the USING_AMD guard, while Ys_IP and Ys_g inside it carry the padded literal. Ys_g(:) = 2*Ys_s(:) - Ys_IP(:) is then a shape mismatch in any generic amdflang build, at any species count: with the literal at ten and a nine-species mechanism it is ten against nine and the compile fails. Both arrays now follow the guard, and the four whole-array assignments are pinned to 1:num_species so they do not depend on the padding happening to match. Separate from the ten-species ceiling itself, which this does not lift -- an eleven-species mechanism still needs case optimization on AMD, or MFlowCode#1848.
@github-actions

Copy link
Copy Markdown

Lines of Code

File Lines Diff
src/simulation/m_ibm.fpp 1543 +290
src/simulation/m_checker.fpp 83 +13
src/common/m_derived_types.fpp 472 +3
src/pre_process/m_global_parameters.fpp 453 +3
src/simulation/m_global_parameters.fpp 774 +3
src/simulation/m_particle_cloud.fpp 414 +3
src/pre_process/m_mpi_proxy.fpp 132 +2
src/simulation/m_mpi_proxy.fpp 525 +2
Directory Lines Diff
common 10356 +3
pre_process 4518 +5
simulation 28397 +311
total 46659 +319

@sbryngelson

Copy link
Copy Markdown
Member

requires me to merge #1852 before this works on amd compilers

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