Repository navigation
Ig 031 fbpic external fields - #42
Conversation
…fields.ExternalField`; add `UniformExternalField` (a constant field over the full domain) and `ExpressionExternalField` (using the `MathExpression` class)
… used for both `_DensityProfile` and `_ParticleBeam` classes
…length_scale"` as they are reserved by FBPIC; add documentation regarding this
|
@claude , please review this PR. |
|
Claude finished @joshmann-inversionsemi's task in 2m 27s —— View job PR Review: FBPIC external fields
This PR is well structured. The 🔴 Bug: a parameter named after a callback argument is silently replacedWhere: The generated callback is: def field_function(gathered_field, x, y, z, t, amplitude, length_scale):
return gathered_field + amplitude * (<expr>)The expression's parameters are passed in as module globals through
Nothing errors in either case; the physics is just wrong. Suggested fix: reject any parameter named after a callback argument: _RESERVED_CALLBACK_PARAMETERS = frozenset(
{"gathered_field", "x", "y", "z", "t", "amplitude", "length_scale"}
)Also add a test using 🟠 Please confirm: transverse fields in boosted-frame runsWhere: the The docstring says FBPIC "transforms the fields and coordinates to the boosted frame". Each I couldn't open the FBPIC source in this environment, so I haven't confirmed whether
🟡 Smaller issues
🟢 Tests
Summary
I didn't run the test suite because running Python commands needed approval in this environment. This review is from reading the code only. |
|
Addressed each of Claude's concerns. FBPIC's documentation indicates that the applied fields are lab frame, implying they are boosted for boosted simulations automatically. Please provide another review, @claude . |
|
Claude finished @joshmann-inversionsemi's task in 2m 13s —— View job Re-review: FBPIC external fields
All of the previous findings have been addressed, and I found no regressions. I have two small new notes and one optional follow-up. Nothing here blocks merge. ✅ Previous findings
The diagnostics refactor still preserves the old behaviour. The 🟡 New minor notes1. An
Example: The fix is to include 2. The documented Numba subset is only partly enforced. The docstring says list/tuple literals and 💬 On boosted framesI still couldn't read the FBPIC source here, so I'm relying on your reading of the docs, which is reasonable. The remaining question is narrow. Each This doesn't affect the demo, because Optional follow-up (unchanged)The "impossible Verdict: LGTM. Note 1 is a quick fix worth making before merge; everything else is optional. I reviewed by reading the code only. I couldn't run the tests or open the FBPIC source, because running Python and reading outside the repo need approval in this environment. |
|
All of Claude's main concerns have been resolved. It is being a bit confused about boosted fields, but FBPIC handles boosting so it's all good. After this merge, I don't think there are any other classes that will need to be added. Some small gaps will still need to be filled but we should be good to excise |
Adds an
_ExternalFieldclass which covers adding external fields in FBPIC:fbpic.lpa_utils.external_fields.ExternalFieldUniformExternalFieldandExpressionExternalFieldconfigurations, the former being a uniform and constant field profile and the latter using theMathExpressionfunctionality for general field functionsParticlesmappings inSimulation; refactor shared particle-diagnostic registration for plasma and beam species