Repository navigation
lumped element cleanup - #171
Merged
ajnonaka merged 1 commit intoNov 25, 2026
Merged
Conversation
ajnonaka
marked this pull request as ready for review
November 24, 2026 23:06
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.
Lumped resistor/capacitor: fix non-3D bug, add input validation, move flags to
algo.Summary
This PR fixes an out-of-bounds read in the lumped resistor/capacitor E-field update when built in 2D/1D, adds input checks so a bad or ignored setup fails loudly, and moves the enable flags from
warpx.toalgo.to match the other circuit-element options (algo.use_lumped_inductor,algo.use_josephson_junction,algo.use_PEC_mask). The physics is unchanged: the 3D update is the same as before.Changes
Bug fix: non-3D builds (
MacroscopicEvolveE.cpp)dx[2], butdxis aGpuArray<Real, AMREX_SPACEDIM>. In XZ/1D builds with the feature on, this read past the end of the array.WARPX_DIM_3Dblock. Outside 3D it is 0, and the kernels never touchdx[2].Input validation (
WarpX.cpp,MacroscopicProperties.cpp)use_lumped_resistororuse_lumped_capacitoris on andalgo.em_solver_medium != macroscopic. Before, the flags were silently ignored in that case.macroscopic.lumped_{resistor,capacitor}_{x,y,z}_function(x,y,z)are now optional per direction and default to"0". Warn if a flag is on but no function is given.Parameter rename (
WarpX.cpp)warpx.use_lumped_resistor→algo.use_lumped_resistorwarpx.use_lumped_capacitor→algo.use_lumped_capacitoralgo.value wins.Cleanup
lumped_*_stagdeclarations and a commented-outprintfinMacroscopicEvolveE.cpp.lumped_{resistor,capacitor}_{x,y,z}_IndexTypewere declared but never assigned. They are now set from J's staggering inMacroscopicProperties::InitData.Review notes
(ε + C·Δℓ/ΔA) ∂E/∂t + (σ + Δℓ/(R·ΔA)) E = ∇×H − J. Both the Lax-Wendroff and Backward Euleralpha_compact/beta_compactmatch.R·N/M(resistor) orC·M/N(capacitor).Compatibility
warpx.use_lumped_*keep working, with a warning.Testing
USE_LLG)warpx.use_lumped_resistor = 1runs with the deprecation warningem_solver_medium = vacuumaborts with a clear message