isothermal and adiabatic wall BCs for reacting flows#1604
Conversation
# 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.
There was a problem hiding this comment.
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(*)%isothermalandpatch_ib(*)%twallparameters (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. |
…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).
…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.
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
Approving. Verified: CF9AFA00 passes CPU + GPU (V100) to 1e-9; precheck clean; review resolved.
Codecov Report❌ Patch coverage is 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. 🚀 New features to boost your workflow:
|
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:
Regression test
CF9AFA00(2D -> Chemistry -> IBM Isothermal Wall) passes on CPU and NVIDIA GPU (V100, OpenACC) to1e-9.Maintainer takeover
Finished by the maintainers on top of the original feature:
present()-guarded the new optionalt_step/stageargs in the cons→prim conversion; guarded theYs_IP/T_IPwrites on the bubbles/QBMM paths and prohibited the unsupportedchemistry + ib + (bubbles_euler | qbmm)combo; device-initializeghost_points_index/pressure_ghost_point(uninitialized on nvfortran,ACC_SETUP_SFsis Cray-only), allocate them only underib .and. chemistry, and cover the moving-IB pressure store.1e-11); golden regenerated.case.md+check_chemistryPHYSICS_DOCS) added; Copilot review resolved.Checklist
GPU changes