Repository navigation
Add convolutional PML (CPML) and fix PEC-mask handling at the PML interface - #163
Merged
Merged
Conversation
…e the exchange. The mask after the excitation is still applied, so masked edges stay exactly zero. new feature: algo.extend_PEC_mask_into_pml (default 1, same behaviour as before). Set it to 0 to have no PEC mask in the PML.
ajnonaka
marked this pull request as ready for review
November 9, 2026 19:18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an unsplit convolutional PML (Roden & Gedney) for the Yee FDTD solver, selected with warpx.pml_type = convolutional. The default remains split.
Also fixes a bug in how the PEC mask (algo.use_PEC_mask) is applied, which affects split-field runs too (see below).
CPML
-CPML E, B and H (LLG) updates in the existing PML boxes, using the same σ profile as the split-field PML (warpx.pml_ncell, warpx.pml_delta). The total field is stored in component 0, so the existing exchange, fill-boundary, PEC and checkpoint code is reused.
-Works with spatially varying ε, μ and σ, using the same Lax-Wendroff or backward-Euler material update as the interior.
-Supports the PEC mask and its extension into the PML, including a second layer (sigma_npy_file2, npy_k_index2).
Optional stretching parameters warpx.cpml_kappa_max and warpx.cpml_alpha_max, plus their grading orders.
-The CPML auxiliary variables are written to checkpoints, so restarts reproduce an uninterrupted run exactly.
Aborts for unsupported combinations: CKC, nodal or PSATD solvers, divergence cleaning in the PML, J-damping, moving window.
PEC-mask fix (changes results of existing use_PEC_mask runs)
-Before: the main-grid E was masked only after the guard-cell/PML exchange. The exchange therefore sent unmasked tangential E on PEC edges to the PML and to neighbouring grid boxes. The next B update saw inconsistent E across the PML interface along the PEC layer. This caused an instability that showed up as NaNs at the PEC layer next to the PML in long runs.
-Now: the main-grid E is masked right after its update, before the exchange. It is still masked again after the excitation, so masked edges stay exactly zero.
-This applies to both PML types, so results of existing PEC-mask runs will change slightly.
New inputs
warpx.pml_type: split (default) or convolutional
warpx.cpml_kappa_max (default 1), warpx.cpml_alpha_max (1/s, default 0), warpx.cpml_grading_order (default 2), warpx.cpml_alpha_grading_order (default 1)
algo.extend_PEC_mask_into_pml (default 1, same behaviour as before; 0 = no PEC mask in the PML)
All are documented in parameters.rst.
Testing (3D, GCC, CPU)
-Reflection compared against a large-domain reference for vacuum, uniform ε_r = 11.7, a layered substrate, and a microstrip defined by a PEC mask. With default settings the CPML matches the split-field PML in each case. Tuned settings (pml_delta = 17 plus small κ/α) reduce reflection by up to about 3×.
-PEC strip running into a lo-x CPML (5.5 GHz soft source):
--before the fix, the PML field blew up within 30k (tuned) to 180k (default) steps;
--after the fix, it stayed stable to 500k steps (tuned) and 210k steps (default, end of run).
-Two PEC layers: stable for 60k steps.
-Restart: checkpoint/restart is bit-identical.
-Other builds: LLG and 2D XZ syntax-checked only, not run. GPU and Windows builds not tested locally.