Skip to content

isothermal and adiabatic wall BCs for reacting flows#1604

Open
DimAdam-01 wants to merge 58 commits into
MFlowCode:masterfrom
DimAdam-01:Chem_IBM_V2
Open

isothermal and adiabatic wall BCs for reacting flows#1604
DimAdam-01 wants to merge 58 commits into
MFlowCode:masterfrom
DimAdam-01:Chem_IBM_V2

Conversation

@DimAdam-01

@DimAdam-01 DimAdam-01 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Description

Immersed boundaries now support chemistry, with isothermal and adiabatic wall boundary conditions at immersed surfaces (patch_ib(i)%isothermal, patch_ib(i)%twall).

Testing

2D thermal flat plate, bottom wall isothermal at 600 K:

image T_vs_y

Regression test CF9AFA00 (2D -> Chemistry -> IBM Isothermal Wall) passes on CPU and NVIDIA GPU (V100, OpenACC) to 1e-9.

Maintainer takeover

Finished by the maintainers on top of the original feature:

  • Correctness: present()-guarded the new optional t_step/stage args in the cons→prim conversion; guarded the Ys_IP/T_IP writes on the bubbles/QBMM paths and prohibited the unsupported chemistry + ib + (bubbles_euler | qbmm) combo; device-initialize ghost_points_index/pressure_ghost_point (uninitialized on nvfortran, ACC_SETUP_SFs is Cray-only), allocate them only under ib .and. chemistry, and cover the moving-IB pressure store.
  • CPU/GPU divergence: the IB spanned the full domain width, so corner ghost points read solid/buffer cells — ill-conditioned and CPU/GPU-divergent (~9%). Widening the IB past the domain fixes it (now ~1e-11); golden regenerated.
  • Docs (case.md + check_chemistry PHYSICS_DOCS) added; Copilot review resolved.

Checklist

  • Tests added/updated
  • Documentation updated

GPU changes

  • GPU results match CPU results
  • Tested on NVIDIA GPU

Dimitrios Adam and others added 17 commits June 4, 2026 11:38
# Conflicts:
#	toolchain/mfc/test/cases.py
- s_convert_conservative_to_primitive_variables read optional t_step/stage
  without present() guards; m_time_steppers/m_data_output call it without
  them (UB on every 2D/3D chemistry run). Hoist a present()-guarded
  apply_ib_ghost_pres flag, gated on chemistry.and.ib.and.n>0.
- s_interpolate_image_point wrote Ys_IP/T_IP (non-present optionals) on the
  bubbles/qbmm call paths; guard under chemistry. Guard caller T_GP/E_GP
  compute under chemistry; drop unused MW_GP.
- Only allocate ghost_points_index/pressure_ghost_point when ib; push their
  host init to the device (ACC_SETUP_SFs is Cray-only, @:ALLOCATE creates
  uninitialized device memory on nvfortran) and reset the per-step
  ghost-point flag on-device instead of a host array assignment.
- Remove dead #ifndef/#else duplicate declaration block.
The IB spanned the full domain width, so its top corners sat on the domain
x-boundaries. Corner ghost points then had diagonal-normal image-point
stencils that reflected into solid/ghost/buffer cells instead of clean
fluid; interpolating temperature there is ill-conditioned and amplified
inherent CPU/GPU differences (ghost-loop order + chemistry FP) into a ~9%
energy divergence, failing the GPU golden.

Widen the IB in x past the domain (length_x 0.05->0.06 in the test, Lx->1.2*Lx
in the example) so its vertical faces sit outside [0, x_end]. Inside the
domain the only IB surface is the horizontal top (normal +y), so every ghost
point reflects straight into fluid. CPU vs GPU now agree to ~1e-11 relative
(was 9.4%); regenerated golden. CPU and GPU tests both pass.
…over

# Conflicts:
#	src/simulation/m_ibm.fpp
#	toolchain/mfc/test/cases.py
…st reset

- The ghost-point image interpolation reaches s_interpolate_image_point via a
  bubbles/qbmm call path that omits the chemistry T_IP/Ys_IP optionals, so
  chemistry+ib+(bubbles_euler|qbmm) dereferenced non-present optionals. Prohibit
  the unsupported combination in the simulation checker (explicit named abort);
  chemistry then always takes the else call path, so the interpolation's
  chemistry guards are provably safe.
- Only clear ghost_points_index over the whole domain for moving IBs. Static IBs
  keep the same ghost set every RK sub-stage and the device copy is
  zero-initialized, so the per-substage full-grid pass was pure overhead.
@sbryngelson
sbryngelson marked this pull request as ready for review July 21, 2026 23:23
@sbryngelson
sbryngelson self-requested a review as a code owner July 21, 2026 23:23
Copilot AI review requested due to automatic review settings July 21, 2026 23:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for immersed boundary (IBM) walls in reacting-flow simulations, including isothermal and adiabatic wall behavior, by plumbing new IB thermal parameters through the toolchain, validation, MPI distribution, and the simulation-side ghost-point enforcement/conversion logic.

Changes:

  • Introduces patch_ib(*)%isothermal and patch_ib(*)%twall parameters (toolchain definitions/descriptions + validation) and propagates them via MPI.
  • Extends IBM ghost-point correction to carry chemistry state (Ys/T) at image points and impose isothermal/adiabatic thermal behavior at ghost points, with pressure re-imposition during cons→prim conversion.
  • Adds a regression test case (CF9AFA00) and an example case for an IBM isothermal wall thermal flat plate.

Reviewed changes

Copilot reviewed 18 out of 19 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
toolchain/mfc/test/cases.py Adds the IBM isothermal-wall chemistry regression case definition.
toolchain/mfc/params/validate.py Tweaks unknown-attribute error truncation threshold.
toolchain/mfc/params/descriptions.py Adds help-text patterns for patch_ib%isothermal and patch_ib%twall.
toolchain/mfc/params/definitions.py Adds isothermal/twall to IB patch parameter definitions.
toolchain/mfc/case_validator.py Validates patch_ib%isothermal/twall constraints under chemistry.
tests/CF9AFA00/golden-metadata.txt Adds golden metadata for the new regression UUID.
src/simulation/m_rhs.fpp Passes t_step/stage into cons→prim conversion from RHS path.
src/simulation/m_mpi_proxy.fpp Broadcasts new IB thermal parameters in simulation.
src/simulation/m_ibm.fpp Implements chemistry-aware IBM interpolation and thermal wall behavior; stores ghost pressure for later conversion.
src/simulation/m_global_parameters.fpp Initializes new IB patch fields with defaults.
src/simulation/m_checker.fpp Prohibits unsupported chemistry+IBM+bubbles/QBMM combination.
src/pre_process/m_mpi_proxy.fpp Broadcasts new IB thermal parameters in pre_process.
src/pre_process/m_global_parameters.fpp Initializes new IB patch fields with defaults.
src/pre_process/m_check_ib_patches.fpp Adds pre_process-time twall validation for isothermal IB patches.
src/common/m_variables_conversion.fpp Adds ghost-point bookkeeping fields and re-imposes ghost pressure during cons→prim for chemistry IBM.
src/common/m_derived_types.fpp Extends IB patch derived type with isothermal and Twall.
src/common/include/2dHardcodedIC.fpp Adjusts HCID=291 IC to set zero streamwise velocity below the wall.
examples/2D_ibm_Thermal_Flatplate/case.py Adds a runnable example case for IBM isothermal wall with chemistry enabled.

Comment thread src/simulation/m_ibm.fpp
Comment thread src/common/m_variables_conversion.fpp Outdated
…ry-only fields

Copilot review:
- pressure_ghost_point was stored only on the moving_ibm<=1 branch, but
  ghost_points_index is tagged unconditionally, so for chemistry + force-driven
  moving IB (moving_ibm>1) the cons->prim override re-imposed a stale/zero
  pressure. Store the finalized ghost pressure once, after both branches.
- ghost_points_index/pressure_ghost_point are only read when chemistry, so
  allocate/deallocate them under (ib .and. chemistry) and guard their writes
  (tag, per-step reset, pressure store) on chemistry — no full-grid integer+real
  fields or device updates for non-reacting IBM runs.

Verified: CPU and GPU pass for the chemistry-IBM case and two non-chemistry IBM
cases (the now-unallocated path).
sbryngelson
sbryngelson previously approved these changes Jul 22, 2026
…HYSICS_DOCS

- case.md: document patch_ib(i)%isothermal and %twall (immersed-boundary
  isothermal/adiabatic walls), including the chemistry+diffusion requirement
  and the guidance to not place the patch flush with a domain boundary.
- case_validator.py: add the missing PHYSICS_DOCS entry for check_chemistry so
  the auto-generated physics-constraints docs cover the num_fluids=1 and
  isothermal-wall (domain + IB) temperature requirements.

@sbryngelson sbryngelson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. Isothermal/adiabatic IB walls for reacting flows; CF9AFA00 passes CPU + GPU (V100) to 1e-9.

Takeover: fixed the optional-arg/device-init correctness bugs, prohibited the unsupported chemistry+IB+bubbles/QBMM combo, root-caused and fixed the CPU/GPU divergence (IB was flush with the domain boundary → widened it), resolved the Copilot review, and added docs. precheck clean.

@sbryngelson sbryngelson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. Verified: CF9AFA00 passes CPU + GPU (V100) to 1e-9; precheck clean; review resolved.

@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.03%. Comparing base (30df8e5) to head (d5d99c9).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/common/m_variables_conversion.fpp 61.11% 4 Missing and 3 partials ⚠️
src/simulation/m_ibm.fpp 79.41% 5 Missing and 2 partials ⚠️
src/pre_process/m_check_ib_patches.fpp 60.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1604      +/-   ##
==========================================
+ Coverage   59.62%   60.03%   +0.40%     
==========================================
  Files          83       83              
  Lines       21246    21258      +12     
  Branches     3145     3143       -2     
==========================================
+ Hits        12668    12762      +94     
+ Misses       6467     6424      -43     
+ Partials     2111     2072      -39     

☔ 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.

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.

3 participants