Skip to content

Bug fixes, correctness guards, performance and test coverage from an in-depth review - #623

Closed
oschulz wants to merge 54 commits into
mainfrom
improvements
Closed

oschulz wants to merge 54 commits into
mainfrom
improvements

Conversation

@oschulz

@oschulz oschulz commented Jul 20, 2026

Copy link
Copy Markdown
Member

In-depth review of the package: verified bug fixes, new correctness guards, performance work, and a test-coverage push. 27 commits, each scoped and with regression tests; the full suite passes under CI-like conditions (Julia 1.12, forced bounds checks, Geant4 testset included). Solver changes are bit-identical unless stated.

Bug fixes

  • Geometry/CSG: surface normals of tapered ConeMantle (≈74° off for SI-scale tapers) and EllipsoidMantle (consumed by drift reflections and E-field plots); ConeMantle single-intersection sign; two-frame frame_transformation composed in the wrong order; partial-φ serialization crash; several parsing holes now raise ConfigFileError.
  • Fields/axes: cylindrical E-field used a wrong denominator at the periodic φ-wrap (wrong e_φ on the last φ slice of every non-φ-symmetric map); searchsortednearest never snapped across the periodic seam; missing multiplicity method for periodic Cartesian axes; per-point allocations in the E-field builder.
  • SOR: the periodic boundary condition on the compressed red-black dimension copied ghost rows into ghost rows — wrapped interior values never entered the update.
  • GDML export (all verified against Geant4 readback): placement rotations were never emitted, so rotated primitives — including every partial-φ segment — collapsed onto φ = 0; polyhedra radii written as circumradius where GDML expects apothems (hexagons 4/3 too large in volume); boolean second-operand offsets lost or expressed in the wrong frame.
  • Detector construction/API: doped-contact auto-detection could never run; estimate_depletion_voltage crash when both candidates lay in range; capacitance matrix could not store its documented missing entries; unknown trapping-model names silently disabled trapping.
  • Charge transport: ADL2016 NaN velocities at zero field; unclamped acos NaN; PtypePNJunctionImpurityDensity + offset applied the offset twice; cluster_detector_hits skipped DBSCAN exactly for low-multiplicity events; floating-boundary drift corrupted shared step vectors across charges.

Correctness guards (behavior changes)

  • Grid(sim) rejects 2D and periodic φ-wedge grids for detectors without the corresponding φ-symmetry (the CGD_CylGrid example silently simulated its cuboid in 2D).
  • is_depleted throws when the potential was computed without depletion handling (was warn + true, silently disabling the estimate_depletion_voltage safety check).
  • Out-of-semiconductor charge-cloud centers throw a catchable ArgumentError instead of an assert.
  • spacing_surface_refinement parses in units.length (was silently meters — breaking for configs that relied on that).

Performance (results bit-identical)

  • GPU SOR iteration loop ~9× (3.4 → 0.37 ms/iteration, 3.4M-point cylindrical grid, A100): removed per-iteration host syncs, replaced the r = 0 boundary condition (getindex + gemv + broadcast with host round-trips) by one kernel, fused the ~10 ghost-face broadcasts into a single kernel per color, static workgroup sizes. The loop is now device-bound.
  • ADL2016 electron velocities 38× by precomputing the valley mass-tensor square roots.
  • Point classification ~2×: conservative per-object bounding spheres skip the CSG in tree walk (Speed up initialization of boundary conditions onto the grid #85), plus a single cylindrical→Cartesian conversion per grid point.

Features

  • Cones and prisms accept z: {from, to} extents as an alternative to a centered height h.

Tests and documentation

  • Line coverage measured at 74.6% overall; the notable gap closed: the whole AbstractGPUArray dispatch path was untested (the pseudoGPUArray trick never reaches it) — new JLArray testsets run it end-to-end and reproduce the CPU results bit-identically on both grid types.
  • Boundary-condition ghost-row semantics pinned per axis role and boundary-type combination, including CPU methods ≡ GPU op tables (groundwork for Boundary conditions as data, not methods #617).
  • InactiveLayerChargeDriftModel mobilities verified against the literature and pinned numerically — the code is correct; Dai et al. (2023) has a 10¹⁰ exponent typo in its neutral-impurity prefactor (details in the source comments).
  • r = 0 depletion handling: investigated in depth and deliberately kept, with documented semantics and regression tests for the ±0.5% depletion-voltage brackets (analysis in Depletion handling: clamp bistability and the hidden 0 V floor #618).
  • test/benchmarks refreshed to current APIs (CUDAKernels→CUDA; the SOR benchmark's GPU row was silently measuring the CPU path).

Related issues: #85 (partially addressed), #617/#618 (analysis from this review; groundwork tests included, refactors pending discussion), #619–#622 (filed from review findings, not addressed here).

🤖 Generated with Claude Code

oschulz and others added 28 commits July 17, 2026 23:22
The tapered-cone normal used the raw local (x, y) (magnitude r) against
the unit-scaled slope dr/dz, tilting normals of SI-scale geometry almost
into +-z. The ellipsoid normal used sign(x_i)*(x_i/r_i)^2 instead of the
gradient x_i/r_i^2. Both now return normalized gradient-direction
normals. Add flip for outwards EllipsoidMantle and regression tests
against analytic normals.

Created by generative AI.
At r = 0 the cylindrical red-black layout (z, phi, r) has its
radially-inward neighbor in tuple slot 5, pointing at a ghost entry that
no boundary condition ever writes. The mask replaced slot 1 (a valid
z-neighbor) instead, so handle_depletion included the stale ghost value
in its neighbor-extremum check for every grid point on the r = 0 axis.
Mask slot 5 with the outward neighbor instead. Affects CPU and GPU
backends (shared helper).

Created by generative AI.
- SolidStateDetector: doped-contact auto-detection referenced an
  undefined variable and never injected the detected contact ids, so
  omitting doped_contact_id always crashed; it now defaults to the
  contact(s) at maximum potential as documented.
- InactiveLayerChargeDriftModel: the semiconductor temperature (already
  in internal units) was re-parsed with the config input units, shifting
  it for non-Kelvin units and making the mismatch check throw spuriously.
- Semiconductor: unknown charge_trapping_model names silently disabled
  trapping; now a ConfigFileError. Missing model key no longer raises a
  raw KeyError.
- Simulation: invalid grid coordinates hit bare @Assert with a string
  argument (TypeError at runtime); now a ConfigFileError with the
  intended message.
- estimate_depletion_voltage: crashed with only() when both voltage
  candidates lay inside the search range.
- calculate_capacitance_matrix: could never store its documented missing
  entries (MethodError); eltype narrows when all entries exist.

Add config-robustness tests covering these paths.

Created by generative AI.
The forward difference from the last phi column to phi = 0 divided by
(axphi[1] - axphi[end]), a large negative non-distance, instead of the
wrap gap (cyclic + axphi[1] - axphi[end]) that the mirror branch at
iphi == 1 already uses. This corrupted e_phi on the last phi slice of
every cylindrical field calculation; invisible for phi-symmetric
detectors (e_phi = 0), wrong for segmented ones.

Also: default use_nthreads to nthreads() instead of threadid(), keep
the NaN/Inf guard type-stable for Float32, and store SVectors directly
instead of allocating a temporary Vector per grid point.

Add an analytic uniform-field regression test covering the wrap column.

Created by generative AI.
- ADL2016 getVe: honor the Emag_threshold argument; zero field returned
  NaN instead of zero velocity (2006 model already guarded).
- ADL getVh: clamp the acos argument; rounding could push it outside
  [-1, 1] for fields along the rotated crystal z-axis.
- PtypePNJunctionImpurityDensity: offset corrections were added to both
  sub-models, shifting the summed density by twice the offset.
- cluster_detector_hits: detectors with 2-3 hits skipped DBSCAN entirely
  and were never clustered.
- Floating-boundary drift handling: compute each crossing from the
  unscaled step vectors and apply one common slow-down factor instead of
  rescaling mid-loop, which corrupted crossings of subsequent charges
  and compounded the scaling.
- simulate_waveforms: accept unitless edep columns (as documented) and
  plain-Real time steps (dt.val crashed on Real).
- readsiggen: missing taper_length keys no longer raise KeyError.
- parse_config_file: mention .config in the unsupported-format error.

Created by generative AI.
- Box: config check tested hZ twice and never hY; missing entries now
  raise ConfigFileError instead of KeyError or falling through.
- RegularPrism: the height assert accepted 'z' but only 'h' was parsed.
- Cone/Torus Dictionary: serializing a full-phi primitive carrying a
  pure-Z rotation crashed on phi0 + nothing; keep the rotation entry.
- Polycone _in: remove dead partial-phi branch referencing an undefined
  variable (Polycone is full-phi by construction).
- TorusMantle: phi-partial mantles now raise a clear ArgumentError from
  distance_to_surface instead of MethodError; drop the dead guard.
- ConeMantle intersection: single-intersection branch lost the sign of
  D1 (used sqrt(D3^2 S^2 - D2^2) = |D1|); use the -D1*L1 quadratic
  limit.
- frame_transformation(a, b): the two half-transforms were composed in
  the wrong order, wrong for any distinct frames.
- CartesianPoint{T}(v::AbstractVector) ignored the requested precision.
- _in_phi: avoid Float64 promotion in the Float32 hot path.

Created by generative AI.
- searchsortednearest on periodic axes now also snaps across the seam
  (a phi just below the period snapped to the last tick instead of the
  first); find_closest_gridpoint passes the axis so the periodic method
  is actually used.
- check_grid: periodic Cartesian y/z axes require an even tick count for
  red-black parity, mirroring the cylindrical phi guard.
- multiplicity: add the missing method for periodic Cartesian axes
  (capacitance calculations raised MethodError on periodic grids).
- even_tick_axis no longer mutates and aliases the input axis ticks.
- r=0 volume weight: replace a Float32 literal of 1/(2pi) with
  inv(T(2pi)) for full precision in Float64 setups.

Created by generative AI.
- Correct parameter order in the RegularPrism docstring and typos in
  TorusMantle/EllipticalSurface annotations.
- intersection docstrings for cone/ellipsoid/torus mantles claimed NaN
  returns for non-intersecting lines; describe the actual behavior.
- Fix broken code examples of get_electron_and_hole_contribution and
  plot_electron_and_hole_contribution (package name, variable names)
  and of PtypePNJunctionImpurityDensity in the manual (missing
  doped-contact-id argument).
- min_tick_distance docstrings described defaults the code no longer
  uses.
- Lithium-diffusion parameter docstrings: render the formulas correctly
  (raw strings; the plain strings mangled the LaTeX via string escapes).
- Reword misleading temperature-scaling comments (anisotropy is
  preserved, not dropped).
- CartesianVector docstring example used CartesianPoint.

Created by generative AI.
- CGD stored-energy check used an atol larger than the expected value
  (any result in [0, 1.4e-5] passed, including zero); use rtol.
- Two-step weighting-potential refinement compared only array sizes;
  also compare grids and values.
- test_gpu_backend.jl relied on T leaking from a previously included
  test file; define it locally.
- Load test config files via @__DIR__ instead of cwd-relative paths.
- Replace duplicated copy-paste assertions in the partial-tube tests
  with distinct points on the φ-boundaries of the wedge.

Created by generative AI.
The periodic wrap for the compressed dimension (Cartesian x, and the
cylindrical z-axis routed through the same method) copied ghost rows
into ghost rows: row 1 read row end (a ghost) and row end read the
just-overwritten row 1. The update loop therefore never received
wrapped interior values. In compressed indexing real index 1 sits at
row 2 and real index N at row size-1, so the wrap is ghost[1] <-
interior[end-1] and ghost[end] <- interior[2], matching all other
methods of this file. Add a red-black layout unit test pinning this.

Also drop unused red-black helpers (AbstractRBArray, RBEven/RBOdd,
rb_bool_*, the non-extended RBArray constructors).

Created by generative AI.
- table_utils: drop unused remove_column, rename_fields/rename_cols,
  sort_by_time, cluster_by_time, add_physics_event_numbers and
  group_by_evt_number (no callers anywhere).
- ChargeDrift: drop the unused DriftPath struct and the bogus 500 m
  default diffusion length of the internal diffusion kick (the only
  caller always passes it).
- Depletion: delete ~200 lines of commented-out superseded code.
- calculate_weighting_potential!: remove the silently-ignored
  n_points_in_phi keyword; passing it now fails loudly.
- PointTypes: an inner constructor now suppresses the auto-generated
  outer constructor that the convenience constructor overwrote (future
  Julia versions reject such overwrites during precompilation).

Created by generative AI.
Many source files carried CRLF (or, after recent edits, mixed) line
endings. Purely mechanical change.

Created by generative AI.
Verified against Geant4 itself (fresh-process GDML readback; placement
rotation matrices, solid volumes, and 200-300-point random in/out sweeps
in the world frame agree with the SSD geometry for rotated, boolean and
polyhedral test cases plus the shipped examples):

- physvol placements never emitted rotations, so rotated primitives
  (e.g. partial-phi segments, which store their start angle as a
  rotation) collapsed onto phi = 0. GDML placement rotations are
  passive; write RotZYX angles of the transposed rotation.
- GDML polyhedra radii are apothems; SSD RegularPrism.r is the vertex
  distance. Hexagonal prisms exported 4/3 too large in volume.
- Boolean solids: the second-operand offset was only emitted when the
  first solid's own origin was nonzero (!) and was expressed in the
  world frame; the rotation used X-Y-Z angles where the reader composes
  Rz Ry Rx and applies them actively, rotating the translation as well.

Also add a generic get_label_name fallback and fix two sample-surface
plot recipes referencing an undefined label variable.

Created by generative AI.
The example originally named its phi axis 'y' (ignored, so the full-2pi
default applied); a later rename to 'phi' kept 'from: 0, to: 0', which
means 2D phi-symmetric - wrong for a cuboid detector. Restore a full
phi range.

New tests: CGD on cylindrical vs Cartesian grid (active-volume
agreement, would have caught this), get_2pi_potential periodic and
reflecting extensions against analytic phi-dependence, NBodyChargeCloud
energy conservation, and numeric velocities of the simple drift models.

Created by generative AI.
- Drop the host-side backend synchronization between the red/black
  kernels and the boundary-condition updates on GPU backends: stream
  ordering already guarantees correctness, and the synchronizations
  stalled the queue twice per iteration. The task-based KA CPU backend
  keeps its explicit synchronization.
- Replace the r = 0 azimuthal-average boundary condition on GPU arrays
  (getindex + CUBLAS gemv + broadcast per color, allocating temporaries
  and forcing host round trips every iteration) with one small kernel.

Per-iteration profile of a 3.4M-point cylindrical grid on an A100:
host-to-device copies 8011 -> 11, pool allocations 12016 -> 16 per
1000 iterations; the update loop is now bound by the SOR kernels
themselves (~2.6e9 point updates/s, up from ~1.0e9 end-to-end before).
CPU and GPU results agree to convergence tolerance (verified with and
without depletion handling).

Created by generative AI.
…odel

getVe recomputed sqrt of the four constant reciprocal mass tensors via
generic (allocating) matrix square roots on every call and summed the
scattering weights inside the valley loop. Store sqrtgamma in the model
(a 6-argument convenience constructor keeps all construction sites and
the temperature-scaling path unchanged) and hoist the sum.

getVe: 20.8 us -> 0.55 us per call (38x) with identical results.

Created by generative AI.
On GPU backends the ghost-face updates ran as ~10 view broadcasts per
red-black color; together with per-call dynamic launch configuration
this left the iteration loop host-bound. Encode each face update as
(active, source row, factor) - a 1:1 transcription of the existing
broadcast methods - and apply all six faces in a single kernel launch
after the r = 0 kernel. Instantiate the SOR kernels with a static
workgroup size, which removes the per-launch configuration cost.

The iteration loop of a 3.4M-point cylindrical grid on an A100 drops
from ~3.4 ms to ~0.37 ms per iteration (~9x) and is now bound by the
device time of the SOR kernels. Verified against the CPU backend for
cylindrical grids (2D, full-2pi periodic with r = 0, reflecting
phi-wedge) and Cartesian grids, with and without depletion handling;
Cartesian and 2D results are bit-identical, 3D cylindrical agrees to
convergence tolerance. The multi-ghost corner entries the fused faces
may write concurrently are never read by the SOR stencil.

Created by generative AI.
Reverts the behavioral part of 'Fix r=0 neighbor masking in SOR
depletion handling' and documents what the original code actually does:
at r = 0 the sub-axis ghost entry (always 0) acts as a potential floor
in the extremum check of handle_depletion. This anchors the axial
channel - without it, the overshoot clamp settles into a stable
spurious undepleted state there (flat channels pin each point to its
lower z-neighbor; the inverted-coax example then reports undepleted
even at 1.05x its depletion voltage, while exact superposition analysis
shows no bulk extremum above the estimate) - while still flagging axis
points that the impurity term would push below 0 V.

The floor is only exact while the grounded contact sits at 0 V; a
proper generalization should use the extrema of the applied potentials
(noted in the review report), and the clamp bistability in flat regions
deserves its own look.

Created by generative AI.
Whether a cylindrical simulation runs in 2D (or on a reduced phi wedge)
was decided purely by the grid's phi interval; nothing verified that the
detector actually has the corresponding symmetry, so a config mistake
silently produced wrong fields (as happened to the CGD_CylGrid example
for years). Grid construction now runs a sampled phi-invariance check of
all field-relevant objects and raises a ConfigFileError with a clear
message for 2D grids of non-symmetric detectors and for periodic wedges
without the matching n-fold periodicity. One mismatching sample is
tolerated for robustness against points on object surfaces; reflecting
wedges (mirror symmetry) are not yet checked.

Created by generative AI.
Add conservative bounding spheres to the CSG module (primitive origin
plus slightly inflated extremum; union merges, difference keeps the
minuend's sphere, intersection the smaller one) and use them in the
potential-calculation setup loops to skip the expensive CSG tree walk
for grid points that are provably outside an object.

Point classification on a 3.4M-point BEGe grid drops from 2.2 s to
1.1 s; resulting potentials, point types and impurity scales are
bit-identical. Conservativeness (pt in geometry implies pt in sphere)
is tested against sampled surface points of all example geometries.

Created by generative AI.
Add JLArray-based testsets: as a real AbstractGPUArray on CPU memory,
JLArray runs the fused boundary-condition kernels, the r0 kernel and the
device convergence checks that the abstract pseudoGPUArray type never
reached (Adapt leaves its arrays as plain Arrays). Cylindrical and
Cartesian solves reproduce the CPU results bit-identically.

Add test_boundary_conditions.jl pinning every ghost-row method exactly
per axis role and boundary-type combination, the equivalence of the CPU
broadcast methods with the GPU ghost-face op tables, and the r0 kernel
against its CPU reference. The r-axis end-2 source row is pinned as
current behavior (issue #617).

Also cover temperature-model selection with the vacuum no-op scaling,
virtual drift volumes (dead and arbitrary, including the Val-id user
hook and its error path), and the geometrical axis weights interface.

Created by generative AI.
is_depleted now throws an ArgumentError when the electric potential was
calculated without depletion handling instead of warning and returning
true; the depletion state is simply unknown then, and the previous
behavior silently disabled the safety check in
estimate_depletion_voltage.

The charge-cloud-center check in move_charges_inside_semiconductor! now
throws an ArgumentError instead of an assert, making the failure a
documented, catchable part of the API (asserts may be compiled out and
are not meant for input validation).

Created by generative AI.
Bare numbers in spacing_surface_refinement were interpreted as meters
regardless of units.length, so mm-based configs got a silently 1000x
different surface refinement. Parse them like every other length in the
config; values with explicit unit strings are unaffected. Breaking for
configs that relied on the implicit meters.

Created by generative AI.
Cones and regular prisms accept an explicit extent along their local z
axis as an alternative to the centered height h; the parsed interval
sets the half-height and shifts the primitive origin along its rotated
z axis. The previously dead parse_height_of_primitive helper now
implements this uniformly and rejects ambiguous inputs (both h and z,
neither, h as an interval, or z as a scalar) with a ConfigFileError.

Created by generative AI.
The bounding-sphere culling already needs the Cartesian form of each
grid point; pass it to the containment test as well instead of letting
every visited primitive re-convert the CylindricalPoint (the remaining
unchecked point of issue #85). Results are bit-identical by
construction. The measured effect after culling is small (~2% setup
time on a 1.1M-point BEGe grid) since culled points skip the tree walk
entirely; it mainly benefits many-object detectors where points survive
several objects' sphere tests.

Created by generative AI.
Verified against the sources: the hole formulas match Dai et al. (2023)
eqs. 5-8 after cm-to-SI conversion, with the seemingly odd neutral-
impurity expression being Sclar's form with light+heavy hole Erginsoy
constants; it collapses to 4.455e21/Nn * (T^0.5 + 4.281*T^-0.5), i.e.
4.46e19 in the paper's cm-units, so the paper's printed 4.46e29 is an
exponent typo, not a bug in this code. The electron formulas match
Ma et al. (arXiv:1705.09562) exactly. Add source comments and a numeric
regression testset pinning both mobilities and the drift directions.

Created by generative AI.
Note in the material table that only Pb carries a conductor-like eps_r:
floating Al/Cu passives act as dielectrics, not conductors (grounded or
biased metal parts are unaffected).

Bring the stale test/benchmarks scripts back to the current APIs:
replace the retired CUDAKernels imports with CUDA, drop the removed
KernelAbstractions.get_device import, fix plot_benchmarks loading the
potential-calculation results under the wrong JLD2 key, and in the SOR
update benchmark stop shadowing the hardware-backend loop variable with
the KA backend and derive via_KernelAbstractions from the device array
type instead of hardcoding false (the GPU row measured the wrong path).
Loop body validated on CPU and CUDA; the full scripts remain operator
tools with multi-hour runtimes and were not re-run end to end.

Created by generative AI.
@fhagemann

fhagemann commented Jul 21, 2026 •

Copy link
Copy Markdown
Collaborator

Tests seemed to have failed because some values of spacing_surface_refinement were parsed in finer units (mm instead of m), resulting in huge grids and out-of-memory errors.

Comment thread src/World/World.jl Resolved
@oschulz

oschulz commented Aug 25, 2026

Copy link
Copy Markdown
Member Author

Also, I don't understand the merge conflicts..

Should be resolved by now.

oschulz and others added 2 commits August 25, 2026 21:02
The inner constructor added in 357dd6f guarded against a constructor
overwrite that cannot occur here: Julia only auto-generates the outer
constructor (which a trailing-default convenience method would overwrite)
when all type parameters are deducible from the field types, and the
phantom parameter D prevents that. Verified on Julia 1.12: the bare
struct generates no unparameterized constructor methods, and main
precompiles cleanly with exactly this shape.

Created by generative AI.
Co-authored-by: Felix Hagemann <hagemann@berkeley.edu>
The modeling limitation (floating metal passives as dielectrics) is now
tracked in issue 627 with workarounds and an implementation sketch; the
in-code note shrinks to a pointer.

Created by generative AI.
When no doped_contact_id is given, the constructor silently selected the
contact(s) at the maximum potential and wrote them back into the config
dict. Emit a warning naming the auto-selected id(s) and showing the
config entry that makes the choice explicit.

Created by generative AI.
The φ-symmetry guard only covered 2D grids and periodic wedges; wedges
with reflecting boundaries (including configs written as periodic +
reflecting, which parse to reflecting-reflecting) assumed mirror symmetry
at both boundary planes unchecked. Sample invariance under the two
boundary-plane reflections plus the rotations they generate (period
2·width). Tests: axisymmetric detector on a periodic+reflecting 60°
wedge, the segmented BEGe on its 30°-90° mirror wedge, a cuboid rejection
case, and a sin(3φ) impurity density that is 3-fold rotationally
symmetric but mirror-antisymmetric, pinning that reflections (not just
rotations) are checked.

Created by generative AI.
Extend the estimate_depletion_voltage assert message with the same hint
as is_depleted: for simulations loaded from files written before v0.11.1
the depletion-handling state is ambiguous and can be restored with
set_point_type_depletion_handling!.

Created by generative AI.
@fhagemann

fhagemann commented Sep 7, 2026 •

Copy link
Copy Markdown
Collaborator

To summarize what still needs to be done for this monster PR to be approved
(or which changes have to be reverted to be dealt with later):

Major things:

  • Decide about scaling of Δt when charges reach the surface / floating boundary of a detector
  • Decide about criterion to fail check_φ_symmetry (one failed attempt per detector or per object)
  • Decide about updating sim.imp_scale and sim.weighting_potentials when updating the electric potentials via one of the convenience methods (should this become a warning, a keyword argument, be done automatically)?
  • Decide if the current implementation of bounding_sphere checks is considered a fix for Speed up initialization of boundary conditions onto the grid #85, or if the issue still remains open.

Manual cross-checks:

  • All changes in the Geant4 extension
  • Check that extremum and radius of a bounding_sphere is always ≥ 0 (non-negative).
  • All changes in BoundaryConditionsCartesian/Cylindrical/GPU
  • Occurrences of GPU_kernel and _sor_kernel_workgroupsize (and especially if the later is used correctly)
  • Rotations of primitives also being applied to the origin (correct order)
  • The update to searchsortednearest and that it's used consistently throughout SSD
  • Depletion voltage candidates in estimate_depletion_voltage
  • All occurrences of mod(..., 2π) and rounding errors due to type promotion
  • Implementation of _φ_wrap_knots_and_data (and maybe rename this?)
  • Requirement of even number of axis ticks in src/Grids/Grids.jl
  • The use of @inbounds in find_closest_gridpoint (inconsistent for Cartesian and cylindrical case)
  • Verify docstring of calculate_weighting_potential! about the default min_tick_distance
  • Check 3mm as good default sampling distance for the bounding_sphere tests
  • Check the new tests for completeness and if they are what we want:
    • test_boundary_conditions.jl
    • test_config_robustness.jl

@fhagemann

Copy link
Copy Markdown
Collaborator

Maybe it would be best to split this PR into things that passed the checks, and things that still need to be checked, to not delay the fixes that were approved. Thoughts?

@fhagemann

Copy link
Copy Markdown
Collaborator

Ok, this PR became a monster. I just spent three hours with pen and paper, going through the commit history commit by commit, and cherry-picking / squashing commits to separate this into smaller PRs (one big one with approved changes, some smaller ones with things that still need to be checked) to advance with this.

PR623_commit_history

@fhagemann

Copy link
Copy Markdown
Collaborator

Closing because this PR was split into smaller PRS:
#644 (merged), #645, #646, and #647

@fhagemann fhagemann closed this Nov 18, 2026
@fhagemann
fhagemann deleted the improvements branch November 18, 2026 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working convenience Improve user-friendliness enhancement Improvement of existing features notation Notation and Interface performance Performance improvements tests Add tests to increase code coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants