Skip to content

Add Perfectly Matched Layer (PML) for LinearEuler2D#127

Open
fluidnumericsJoe wants to merge 1 commit into
mainfrom
feature/lineareuler2d-pml
Open

Add Perfectly Matched Layer (PML) for LinearEuler2D#127
fluidnumericsJoe wants to merge 1 commit into
mainfrom
feature/lineareuler2d-pml

Conversation

@fluidnumericsJoe
Copy link
Copy Markdown
Member

Summary

  • New LinearEuler2D_PML model: Hu (2001) unsplit ADE-form PML extending the existing 2D linear-Euler model. Adds 4 auxiliary variables (phi_rho, phi_u, phi_v, phi_P; nvar 5 → 9) and per-node sigma_x, sigma_y damping fields. Interior dynamics are unchanged where sigma = 0.
  • PML elements are tagged by material-name prefix (pml*) in mesh%elemMaterial, supporting both programmatic tagging on a StructuredMesh and HOHQMesh ISM-MM input.
  • Full CPU + GPU (HIP / CUDA) parity: PML-aware Riemann, interior-flux, source, no-normal-flow, and radiation kernels.
  • New SetPMLProfile API builds a polynomial sigma ramp from a user-supplied interior box, PML thickness, peak value, and ramp exponent.
  • Reference doc, tutorial covering both the programmatic and HOHQMesh ISM-MM workflows, mkdocs nav entries.

Test plan

  • CPU build (cmake --build) clean (gfortran, debug)
  • GPU container build (self-dev-gpu / AMD ROCm HIP) clean — kernels and Fortran wrappers compile
  • ctest -R lineareuler2d_pml_absorption passes (planar pulse, east-side PML, residual ratio 7.3e-8 ≪ 5% tolerance)
  • Existing LinearEuler2D / LinearShallowWater2D regression tests still pass with WORKSPACE set (failures otherwise are pre-existing mesh-path issues)
  • fprettify clean across src/, test/, examples/ (zero diffs)
  • Visualise examples/linear_euler2d_pml_planewave snapshots in PySELF/ParaView to confirm clean absorption

Notes

  • Sound speed c continues to live in solution(:,:,:,5) and is preserved across the parent → PML model — the impedance-matched Riemann solver works unchanged through PML interfaces.
  • Auxiliary variables phi_* carry zero flux and must be initialised to zero by user IC code; the example and test both demonstrate this.
  • SELF_BC_PRESCRIBED is not auto-registered for the PML model — users registering their own prescribed handler need to fill extBoundary(:,:,:,6:9) (zero is the natural choice).

🤖 Generated with Claude Code

Implements Hu (2001) unsplit auxiliary-differential-equation PML as a
new LinearEuler2D_PML model extending LinearEuler2D. Four auxiliary
variables (phi_rho, phi_u, phi_v, phi_P) carry the time integral of
the acoustic state and couple back through sigma_x*sigma_y; nvar grows
5 -> 9. Auxiliaries have identically zero flux and evolve only via the
PML source term, so interior dynamics are unchanged where sigma = 0.

PML elements are identified by a configurable material-name prefix
(default "pml") in mesh%elemMaterial, which can be populated either
programmatically on a StructuredMesh or via the HOHQMesh ISM-MM reader.
SetPMLProfile builds a polynomial sigma ramp from a user-supplied
interior bounding box, PML thickness, and peak value.

Includes CPU and GPU (HIP/CUDA) backends with PML-aware Riemann/flux/
source kernels and no-normal-flow/radiation BC handlers, a regression
test asserting >95% absorption of a planar acoustic pulse, an example
program demonstrating programmatic mesh tagging, and reference plus
tutorial documentation wired into the mkdocs nav.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 20, 2026

Codecov Report

❌ Patch coverage is 93.61702% with 9 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/SELF_LinearEuler2D_PML_t.f90 94.28% 8 Missing ⚠️
src/cpu/SELF_LinearEuler2D_PML.f90 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant