Hybrid-PIC: operator-split implicit magnetic diffusion with exact curl-curl preconditioning - #7061
Conversation
50c223c to
7ea167e
Compare
91a1e17 to
82e0c11
Compare
16d2343 to
c4ad7bc
Compare
|
The application validation in the PR description has been refreshed from the completed RCYL study. The obsolete 0-50 ns RZ figure and timing estimate are replaced by the 0-164 ns RCYL density/Btheta comparison, current 9-16 ms hybrid timing measurements, and the full-trajectory error metrics. The text now also separates the roles of implicit magnetic diffusion (vacuum-field evolution) and D-D collisions (ion-shock broadening), and explicitly documents the remaining post-stagnation phase drift after about 144 ns. The timing comparison is labeled as cross-host application performance rather than a same-node microbenchmark. |
|
PICMI support is now included. |
|
ping @prkkumar for coordination with existing implicit implementation |
|
Thanks @ax3l. Tagging @prkkumar-he and @RemiLehe for coordination. We are aware of the fully implicit work in #7208. This PR implements the standard operator-split/IMEX middle ground:
Treating the stiff diffusive term implicitly while retaining non-stiff terms explicitly is a standard IMEX/operator-splitting strategy. The exact curl-curl preconditioner makes that targeted solve practical for spatially varying resistivity. Since the feature is opt-in, preserves existing defaults, and has analytic, regression, PICMI, and application validation, it can be merged as an independently useful capability. |
Add the theta-method curl-curl solve, integrate it with hybrid magnetic half-steps, support constant and parser-driven resistivity, and cover Cartesian and RZ decay modes.
Add radial and axial pec_insulator feeds, PEC axial walls, affine feed handling for Krylov linearity, and finite-safe matrix-free vector operations.
Drive the matrix-free operator with an optional PETSc KSP and extend variable-resistivity and feed cases to the full theta method. Co-authored-by: Claude <noreply@anthropic.com>
Keep covered magnetic degrees of freedom inert, remove covered PETSc unknowns, and stage PETSc vectors safely between host and device memory. Co-authored-by: Claude <noreply@anthropic.com>
Route RCYLINDER through the matrix-free operator and assemble metric-aware RZ and radial curl-curl matrices from edge-centered resistivity.
Reuse PETSc state across timesteps, keep build guards portable, advance only the residual resistivity implicitly, and support affine feeds in radial geometry.
Assemble exact Cartesian curl-curl matrices, add physical boundary coverage, expose PETSc and diffusion controls through PICMI, and document the user-facing inputs.
20d82a0 to
fbe30b8
Compare
Add distributed ASM/ILU and EB coverage, replace weak extrema checks with spatial and full-field oracles, isolate PETSc options, enforce scalar and convergence contracts, and remove development residue.
fbe30b8 to
dbeb374
Compare
Summary
This PR adds an optional, default-off operator-split implicit magnetic diffusion step for hybrid-PIC.
In boundary-driven hybrid problems with a large vacuum (or vacuum-like) resistivity, leaving resistive diffusion of B entirely in the explicit Faraday / Ohm path makes the vacuum region stiff: substeps collapse and the driven B signature tends to lock to the wall instead of the plasma edge. The new split advances
after each hybrid B half-step with a theta-method linear solve. Ohm's-law resistivity used by the explicit Faraday update is capped by
mag_diff_eta_explicit_max(default 0) and the implicit solve advances the residualmax(eta - mag_diff_eta_explicit_max, 0), so resistivity is not applied twice.Zero places all resistive diffusion in the implicit solve. In coupled production problems, a small positive, explicitly CFL-safe cap can improve robustness by retaining controlled resistive damping in the explicit substeps. The appropriate value is problem-, mesh-, and timestep-dependent; the Z-pinch validation below used
2.0e-2 Ohm m.The split is inspired by the FLASH MagDiff approach; the implementation is native WarpX/AMReX. It does not make the Hall or electron-pressure terms implicit.
Motivation and application validation: RCYL dynamic Z-pinch
The motivating application is a 164 ns RCYL dynamic Z-pinch with an outer-radius B_theta drive (
pec_insulator), a 15 mm deuterium column, and a high-resistivity vacuum gap. Without implicit magnetic diffusion, the hybrid field update is either unstable at the required vacuum resistivity or does not transmit the applied field from the wall to the moving plasma boundary correctly.The current comparison uses the calibrated hybrid run rather than the earlier RZ demonstration:
2.0e-2 Ohm mThe timings above are application measurements from different hosts, not a controlled same-node microbenchmark. They nevertheless describe the practical runs: the hybrid also takes 7.8x fewer steps. The corrected full hybrid run completed in 338 s locally; extrapolating the measured implicit step cost gives roughly 1.64e4 s for the reference trajectory, about a 50x observed time-to-solution difference for this setup.
Magnetic diffusion is responsible for the close B_theta front and vacuum-field profile. Matching the density sheath additionally requires deuterium-deuterium Coulomb collisions; resistive electron-ion drag alone does not supply ion-ion shock broadening. With both pieces present:
n0in hybrid and 40.1n0in the kinetic reference.The figure shows the full trajectory rather than only the favorable run-in interval. The upper row is deuterium density and the lower row is B_theta.
Scope
0 < theta <= 1; backward Euler is the default and Crank-Nicolson is testedpec_insulatorin Cartesian 1D/XZ/3D; axis, PEC, andpec_insulatorhandling in RZ/RCYLINDERrtol=1e-8,atol=0HybridPICSolverMain inputs
The same controls are available through PICMI:
When variable eta is enabled, resistivity comes from the existing hybrid resistivity parsers and is frozen on Yee E/J faces for the diffusion solve. PETSc always receives the exact assembled curl-curl
Pmatmatching the matrix-free operator. The algebraic preconditioner applied to that matrix is configurable through themag_diff_petsc_*inputs or PETSc runtime options.Implementation
HybridMagDiffusionapplies the theta method to the matrix-free FDTDcurl(eta curl B) / mu0operator.MLCurlCurlpath has been removed.BfieldEvolvehalf-step, with the explicit Ohm eta cap applied inHybridPICSolveE.Pmat, including Cartesian component coupling and the cylindrical metric/axis terms.Validation
Examples/Tests/hybrid_mag_diffusion/covers:HybridPICSolver; non-Python builds use the equivalent native deck.pec_insulatorboundaries in 1D, XZ, and 3D, with XZ and 3D EB coverage.pec_insulatorfeed cases.After synchronizing with current
development, all 29 local non-PETSc magnetic-diffusion run/analysis tests and all 10 PETSc-enabled RCYLINDER tests passed. The full GitHub Actions matrix remains the merge gate.Follow-up work
theta=1) and Crank-Nicolson (theta=0.5). Add old/new boundary-value blending for time-dependentpec_insulatorfeeds; driven CN boundaries are currently first-order in time.