Roadmap
The project task list. Claude Code picks the lowest unchecked item of the current milestone (CLAUDE.md §11). Each item is done when the Definition of Done (CLAUDE.md §7) holds. Estimated effort is in rough "focused sessions".
M0 — Scaffold ✅
- [x] CMake + presets, strict warnings, FetchContent deps
- [x] CI matrix (gcc/clang/asan), clang-format, clang-tidy, docs deploy
- [x] Python package skeleton (scikit-build-core + pybind11)
- [x] Docs site, theory pages, ADRs, this roadmap
M1 — Mesh infrastructure (≈ 6) ✅
- [x]
mesh::Mesh<Dim>: vertices, cells (tri/tet), derived edges and faces with consistent global orientation (lowest-vertex-first rule, ADR-0003) - [x] entity connectivity tables (cell→edge, cell→face, face→cell, edge→cells)
- [x] boundary and material tags (physical groups)
- [x] Gmsh
.mshv4 reader (ASCII), simple structured generators for tests - [x] affine geometry mapping: Jacobian, det, inverse-transpose, per cell
- [x] curved (order-2) geometry hook (interface only; implementation in M4)
- [x] uniform refinement (red refinement in 2D and 3D, Bey's rule) → prepares M5
- [x] unit tests: Euler characteristic, orientation consistency, boundary extraction
- [x] VTK (
.vtu) export of mesh + cell data
M2 — Scalar FEM on the infrastructure (≈ 4) ✅
- [x]
fespace::ReferenceElement<Dim>with fixed local numbering (theory/nedelec.md) - [x] Gauss–Jacobi quadrature on triangle/tetrahedron, exactness tests up to order 20
- [x] hierarchical H1 Lagrange basis, arbitrary order p (Legendre/Jacobi based)
- [x]
fespace::DofMap: vertex/edge/face/cell DoFs, variable p per entity - [x] global sparse assembly (COO → CSR), element loop with
std::span - [x] Dirichlet via DoF elimination
- [x] solver interface + Eigen SparseLU backend
- [x] convergence test #1: Poisson, manufactured solution, rate p+1 in L2, p in H1
M3 — Nédélec elements and Maxwell eigenproblems (≈ 8) ✅
- [x] hierarchical H(curl) Nédélec-I basis, 2D (p ≤ 6) and 3D (p ≤ 4), per Schöberl–Zaglmayr (theory/nedelec.md)
- [x] orientation-aware local→global mapping of edge/face functions
- [x] curl–curl stiffness and mass matrices with complex tensor ε, μ
- [x] PEC boundary condition, PMC (natural)
- [x] Maxwell eigenproblem: shift-invert Arnoldi (Spectra) on
(S − σM) - [x] gauge handling / kernel filtering (discrete gradients); spurious-mode test
- [x] convergence test #2: PEC box eigenvalues, rate 2p; zero spurious modes
- [x] field evaluation at arbitrary points (point location + reference-coordinate inversion)
- [x] VTK export of vector fields (cell-averaged + high-order via subdivision)
M4 — Time-harmonic scattering & waveguides (≈ 10) ✅
- [x]
physics::Scattering: total/scattered-field formulation, plane-wave and dipole sources (theory/maxwell.md) - [x] PML as complex coordinate stretching in boundary layer cells (theory/pml.md), polynomial profile, adaptive σ from wavelength and cell size
- [x] Bloch-periodic constraints (
E(x+a) = e^{ik·a} E(x)) via constrained DoFs - [x] curved elements (isoparametric order 2) + PML-compatible quadrature
- [x] post-processing: Poynting flux through surfaces, absorption, scattering cross-section, far field (Stratton–Chu), Fourier/diffraction coefficients
- [x]
physics::PropagatingMode: 2D waveguide cross-section eigenproblem for effective index (quadratic → linearized) - [x] convergence test #3: PML reflection < 1e-6 for plane wave
- [x] convergence test #4: Mie cylinder (2D) cross section vs. series
- [x] convergence test #5: slab waveguide n_eff
- [x] convergence test #6: lamellar grating efficiencies vs. RCWA
- [x] examples:
cavity_modes,mie_cylinder,slab_waveguide,lamellar_grating
M5 — Adaptivity: a-posteriori estimation and hp-refinement (≈ 10) ✅
- [x] residual-based estimator for curl–curl (theory/error-estimation.md): element residual + tangential-curl jump + normal-displacement jump
- [x] Dörfler marking
- [x] conforming h-refinement with hanging edges/faces → constrained DoFs (one-irregular rule), re-numbering, transfer of solution (prolongation)
- [x] p-refinement: per-entity order increase, minimum rule on shared entities
- [x] hp-decision: Legendre-coefficient decay / analyticity estimate per element (plus the error-prediction strategy, which is the default: the decay of the Galerkin solution misjudges unresolved corner cells)
- [x] goal-oriented (dual-weighted) estimator for a scalar quantity of interest (e.g. a Fourier coefficient) — needed for scatterometry accuracy claims
- [x] convergence test #7: exponential convergence at re-entrant corner (L-shape,
then plasmonic wedge) —
adaptive_hp_refinementandplasmonic_wedge - [x] example
plasmonic_dimer
M6 — Solvers & performance (≈ 8) ✅ (apart from the optional MPI item)
- [x] MUMPS / PARDISO backend behind
solvers::DirectSolver— MUMPS (sequential complex build) behindsolvers::LinearSolver/DirectSolverBackend(ADR-0007); PARDISO can follow as another backend - [x] static condensation of interior (cell-bubble) DoFs
- [x] OpenMP parallel assembly (colouring or per-thread COO buffers) — per-thread buffers, also the estimator loops
- [x] parameter sweeps / reduced basis hooks (frequency, angle, geometry parameters) —
physics::ScatteringOperator/solve_many/plane_wave_sweep(one factorisation per frequency),solvers::ReducedBasis(affine frequency sweeps); geometry parameters come with the Python layer (M7) - [ ] optional: MPI domain decomposition (own ADR before starting)
- [x] benchmarks recorded in
benchmarks/results/(bench_assembly_solve)
M7 — Python API & usability (≈ 6) ✅
- [x] bindings for mesh, spaces, materials, problems, solvers, post-processing —
python/bindings/bind_*.cpp(pybind11,<Name>2D/<Name>3D, NumPy / SciPy at the boundary, callbacks with the GIL, exceptions mapped),python/tests/,docs/python.md - [x]
hpfem.units(nm, µm, eV, THz → SI) andhpfem.materialslibrary (Si, SiO₂, Au, Ag, Al, TiO₂, GaAs, perovskite — tabulated n,k with sources) —python/hpfem/units.py,python/hpfem/materials.py+python/hpfem/data/*.csv(refractiveindex.info, CC0), Sellmeier / Drude–Lorentz / tabulated models - [x] JSON/YAML project files (
hpfem run project.json) + CLI —hpfem.project(scattering / waveguide / cavity, sweeps, outputs),hpfem.cli(run,validate,info,materials),examples/*/project.json - [x] meshio / pyvista interop, matplotlib helpers —
python/hpfem/interop.py(to_meshio/from_meshio/field_to_meshio,to_pyvista/field_to_pyvistaon the subdivided mesh,plot_mesh/plot_field/plot_convergence/plot_far_field),python/tests/test_interop.py(commit 2265608) - [x] Jupyter example notebooks —
examples/notebooks/(Mie cylinder, hp-adaptivity on the L-shape, gold nanowire spectrum), executed bypython/tests/test_notebooks.py
M8 — Application examples (≈ 6) ✅
- [x]
metasurface_unitcell: phase/transmission map over pillar diameter —examples/metasurface_unitcell/run.py(TiO₂ ridges on SiO₂, Bloch unit cell with PML, zeroth-order transmission and phase over the width), regression test inpython/tests/test_examples.py - [x]
vcsel_cavity: DBR micro-cavity mode, Q-factor, resonance wavelength —solvers::complex_eigenpairs_near(complex shift-invert Arnoldi),physics::Resonance(quasi-normal modes with PML), convergence testfabry_perot_resonance(exact complex Fabry–Pérot resonances),examples/vcsel_cavity/run.py(GaAs/AlAs DBR cavity against the transfer-matrix pole) - [x]
quantum_dot_purcell: dipole in micropillar, Purcell factor, β-factor —examples/quantum_dot_purcell/run.py(line dipole in a DBR ridge cavity, scattered field of the analytic dipole, emitted power from the flux around the dipole, Purcell and beta spectra; validated against the image dipole in front of a PEC mirror) - [x]
euv_mask: 3D absorber on multilayer, oblique incidence, near-field export —examples/euv_mask/run.py(Ta pad on a Mo/Si mirror at 13.5 nm and 6°, Bloch unit cell in x and y, structured Kuhn tetrahedra on the layer interfaces, reflectivity against the transfer matrix of the bare mirror, VTK near field) - [x]
ring_resonator: coupling + resonance (2D effective-index model first) —examples/ring_resonator/run.py(quasi-normal modes of the ring coupled to the bus byResonance2D, transmission spectrum from a Gaussian current in the bus; the dip sits at the eigenmode resonance)
M9 — Multiphysics (≈ 8) ✅
- [x] absorbed-power density → heat-conduction solve on the same mesh (H1) —
physics::absorbed_power_load/absorbed_power_density,physics::Thermal(κ by tag, fixed temperatures, hanging nodes), convergence testheat_conduction(damped wave in a lossy slab against the closed-form temperature), Python bindings,docs/theory/multiphysics.md - [x] temperature-dependent ε feedback loop —
physics::ThermoOptical(fixed-point iteration with relaxation, complex dεr/dT by tag, per-cellMaterialMapoverrides), unit tests (uncoupled limit, self-consistent fixed point, linear response, relaxation) - [x] carrier-generation profile export for PV device solvers —
hpfem.pv(generation rate per cell and as a field, spectral weighting, depth profiles, meshio / CSV export),physics::absorbed_power_per_cell, Beer–Lambert check,examples/solar_cell_texture
M10 — Validation against the literature
Independent, published reference values instead of our own implementations; every
benchmark is a convergence test with the labels convergence and validation, the long
local runs carry validation-long and are stored under benchmarks/results/. Results and
assessment: docs/validation.md.
- [x] A. rib waveguide (Vassallo, Opt. Quantum Electron. 29, 95, 1997, Table I / MTRM):
quasi-TE and quasi-TM effective indices for five lateral thicknesses within the
four-digit reference — tests/convergence/rib_waveguide.cpp, test helper
tests/convergence/tensor_mesh.hpp (graded tensor meshes), PR #58
- [x] B. metallic lamellar grating, H parallel to the ridges (Granet & Guizal, J. Opt. Soc.
Am. A 13, 1019, 1996, Table 1): Littrow and specular efficiencies — h = 0.1 and 4.8 µm
within 3·10⁻⁴ with the validated fill factor 0.5, h = 1 µm (resonant slot) reported
only; PML needs 3 µm / order 4 for a 10⁻⁶ energy balance —
tests/convergence/metal_grating.cpp, PR #64
- [x] C. Mie sphere (Bohren & Huffman ch. 4): physics::mie_sphere (coefficients,
efficiencies, fields inside and outside for complex ε; eight digits against
miepython), mesh::box_with_ball, 3D convergence test mie_sphere (dielectric and
absorbing sphere, converging in p to the 10⁻³ level that the quadratic geometry and
SparseLU allow), Python bindings — PR #67
- [x] D. layered background for the scattered-field formulation (ADR-0009:
physics::LayerStack, ScatteringSetup::background) and the slit–groove benchmark in
silver (Besbes et al., J. Eur. Opt. Soc. Rapid Publ. 2, 07022, 2007; Burger et al.,
Proc. SPIE 8880, 88801Z, 2013): S/S₀ within 1.4·10⁻⁵ of Burger and 1.8·10⁻⁵ of Besbes,
the 0.1 % difference between the sources is the substrate permittivity; the 10⁻⁶
target is left by the surface-plasmon truncation of the PML — PRs #65, #68
- [x] gold sphere dimer (Hoffmann et al., Proc. SPIE 7390, 73900J, 2009; 80 nm spheres,
1 nm gap, 632 nm, reference |E|² at the gap centre = 5.47624·10⁵ V²/m² for
|E_inc| = 1 V/m) — computed under the documented assumption of Johnson & Christy gold
(the source does not state its ε): examples/gold_dimer with the axisymmetric solver
(orders m = 0, ±1), converged to five digits at 2.9724·10⁵ (−46 %); the ε scan shows the
reference reproduced for ε ≈ −10.3 + 0.8i, a gold with 35 % lower loss, so the
material datum, not the solver, sets the deviation — docs/validation.md G,
benchmarks/results/2026-10-08-validation-gold-dimer.json (maintainer's decision of
2026-10-08 to replace the five-digit comparison by the sensitivity statement)
M11 — Axisymmetric (2.5D) solver (ADR-0010)
Bodies of revolution on the meridian mesh, one 2D problem per azimuthal order m.
- [x] forms of order m (assembly::assemble_axisymmetric: (E_r, E_z) in Nédélec,
v = −i r E_φ in H1, diagonal tensors in (r, φ, z), order-m gradient for the gauge),
axis conditions per m, physics::AxisymmetricCavity; convergence test on the PEC
cylinder against the Bessel zeros (rate 2p for m = 0, 1, 2); docs/theory/axisymmetric.md
- [x] resonances with the cylindrical PML (physics::AxisymmetricResonance, Teixeira–Chew
tensors as material, complex gauged eigensolver); convergence test on the quasi-normal
modes of a dielectric sphere (Mie poles, exponential in p)
- [x] scattering with the axial plane wave (physics::AxisymmetricScattering,
axial_plane_wave, m = ±1) and the power flux through surfaces of revolution
(axisymmetric_poynting_flux); convergence test against the Mie cross-section of a
sphere (exponential in p)
- [x] Python bindings (AxisymmetricCavity, AxisymmetricResonance,
AxisymmetricScattering, axial_plane_wave, axisymmetric_poynting_flux)
- [x] dipole sources on the axis (axisymmetric_gaussian_dipole, total-field formulation
with AxisymmetricScatteringSetup::current); convergence test against the Larmor power
of the smeared dipole, Purcell peak at the TM_1 Mie pole
- [x] the micropillar quantum-dot example (examples/micropillar_qd: resonance of the
fundamental m = 1 mode, Purcell and beta factor of the in-plane dipole, regression test)
- [x] far field from the m contributions (axisymmetric_far_field: Stratton–Chu with the
analytic azimuthal integration; Larmor pattern of the dipole, Mie cross-section from the
far field)
- [x] oblique incidence by the sum over the orders (oblique_plane_wave, scatter_orders,
superpose_far_field; sphere at 50° vs Mie, exponential in p)
- [x] hp-adaptivity on the meridian plane (adaptivity::axisymmetric_residual_estimate,
hanging-node constraints in the three problem classes, AxisymmetricScattering::estimate /
error); convergence test at a re-entrant PEC edge, exponential in N^(1/3)
M12 — Ports, modal expansion, sensitivities
Integrated photonics beyond the effective-index model and the tools around the solvers.
- [x] waveguide ports with modal excitation and S-parameters in 2D
(physics::WaveguidePort, PortModes<2>: TM slab modes on the port edges by a 1D p-FEM,
low-rank modal boundary term in Scattering, port_coefficients, s_parameters);
convergence test waveguide_port (slab section: S21 and |S11| exponential in p),
Python WaveguidePort / PortModes2D / s_parameters
- [x] 3D ports: cross-section modes from PropagatingMode on the extracted port mesh
(PortModes<3>: frame, planar section with the inside cells' tags and orders, PEC rim,
n × (μ⁻¹ curl E) = (∇ₜE_z − iβEₜ)/μᵣ, modal powers, orientation-independent signs);
convergence test waveguide_port_3d (rectangular waveguide TE10: S21 and |S11| decay
with p), PortModes3D / s_parameters for Scattering3D in Python
- [x] the ring resonator with ports in 3D (SOI cross-section): done as stage A, the 3D
directional coupler against coupled-mode theory (examples/directional_coupler_3d with the
mesh / port builder, the coupled-mode reference and the CPU regression test by dev; the
cuDSS production runs at p = 1–3 and 2–30 µm, ScatteringOperator::solve_port for one
factorisation per S-matrix, --cell-z, the p-convergence table and docs/validation.md
section F by gpu). The full ring in 3D (stage B) is in the backlog by the maintainer's
decision of 2026-10-08
- [x] modal expansion by Riesz projection on the resonance solver (physics::RieszProjection,
AxisymmetricRieszProjection: residues of the resolvent on circles around the
quasi-normal modes plus a background contour, spectra of linear observables as sums over
modes; verification against the direct solution and the micropillar Purcell spectrum)
(riesz_projection.hpp, test_riesz_projection.cpp, examples/micropillar_qd,
docs/theory/maxwell.md#modal-expansion-by-riesz-projection)
- [x] sensitivities, material derivatives of observables by the adjoint solve
(physics/sensitivity.hpp: adjoint_solution / material_sensitivity and the conical
pair, dQ/dε_tag = k0² ∫_tag E·z, holomorphic; hpfem.grating.sensitivity for the
efficiencies; verified against finite differences to 1e-6)
- [x] sensitivities, shape derivatives (ADR-0011: the discrete adjoint on the mesh,
shape_gradient / shape_derivative and the conical pair, parameters as mesh velocity
fields, region_normal_velocity, move_nodes; hpfem.grating.shape_sensitivity;
verified against finite differences of the solve on moved meshes in 2D, conical and 3D)
M13 — Conical incidence and the E_z polarisation (2.5D)
From the user test report of 5 October 2026 (spec-m12-ez-polarisation-2d.md): the missing
polarisation of the 2D solver and the longitudinal wavenumber for the microscope model.
- [x] conical forms (assembly::assemble_conical: in-plane E in Nédélec, v = −i E_z in H1,
longitudinal wavenumber β, diagonal tensors, conical_gradient), physics::ConicalScattering
(PEC, Bloch on both spaces, PML tensors Λ = diag(s_y/s_x, s_x/s_y, s_x s_y), hanging nodes,
scattered- and total-field formulation, layered background with layered_conical_wave),
conical_plane_wave / conical_polarisation, conical_poynting_flux, conical_fourier_coefficients
(any line orientation) and conical_diffraction_efficiencies with complex vector amplitudes;
at β = 0 the solver is the E_z ("TE") polarisation. Unit tests (gradient kernel, decoupling,
manufactured solutions, flat interface under conical incidence vs the stack), convergence
tests conical_mie_cylinder_ez (series) and conical_lamellar_grating_ez (in-test TE RCWA,
layered background); theory section docs/theory/maxwell.md#conical-incidence
- [x] Python bindings (ConicalScattering, layered_conical_wave, orders); the project-file
keys for the conical case are superseded by hpfem.grating.solve and the job runner
(hpfem.run, M15 F2 / F5: "polarisation": "s" | "p", theta_deg, phi_deg)
- [x] example (Si ridge in E_z, the R1 Ag case) as a job file under examples/
(examples/lamellar_grating/jobs/: Si TM, Si conical, Ag TE = R1; regression test in
test_examples.py)
- [x] conical grating validation at β ≠ 0 against the conical RCWA of the GUI work
(conical_grating_validation: glass lamellar grating, s at θ = 40°, φ = 30° and p at
θ = 50°, φ = 30° with the order m = −2 evanescent in air; 3.5e-5 and 4e-6 at p = 4,
energy balance 1e-6)
- [x] the acceptance case R1 of the report (Ag lamellar grating, 50°, TE, and the conical
Ag / Si cases of gui-support-features.md section 3) as a validation-long test
(conical_grating_hp, cases (a) TM Ag, (b) TE Ag, (c) conical Si, M15 F1 stage 2;
docs/validation.md section E)
- [x] hp-adaptivity for the conical solver (M15 F1: residual and goal-oriented estimators of
the coupled system), E_z resonances and the open-cell band structure (M15 F14,
physics::ConicalResonance, grating.resonances / bands)
- [x] scalar E_z path (ConicalScatteringSetup::scalar_ez: the H1 block alone at β = 0 with
an E_z-only excitation, identical solution, grating.solve(scalar="auto")) in place of a
separate ScatteringEz solver
M14 — Accuracy infrastructure for oblique incidence and gratings
From the same report (spec-m14a/b/c); A and C by the gpu agent, B by dev.
- [x] M14-A PML for oblique incidence (PmlProfile::for_angle, PmlBox::max_resolution /
resolution_limit / recommended_thickness(profile, p), under-resolution warning in
Scattering, R0^(cos θ / 2) documented in docs/theory/pml.md; convergence test
flat_surface_fresnel: Si and Ag half spaces at 10-70° against Fresnel; Python / project
keys theta_max / target)
- [x] M14-B hp-adaptivity on a plasmonic grating (Bloch + layered background + PML): done as
M15 F1 stage 2 (conical_grating_hp, estimator options, the Ag grating to the hp reference)
with M15 F16 (non-matching Bloch coupling) in place of the symmetrised marking
- [x] M14-C post-processing for gratings (diffraction_orders on an OrderLine of any
orientation with the incident wave subtracted, complex vector amplitudes; power_balance /
absorbed_power(problem, solution) of the total field; Surface::plane; total_field on
stack interfaces by the cell side; incident_wave on the stack wave, setup and problem;
convergence test grating_postprocessing: the report's Si grating to 1e-6 of the RCWA,
lossless balance 2e-6; convergence test #6 moved to the layered background)
M15 — Features requested by the GUI work (FEM model builder)
From the user's GUI work of 6 October 2026 (details, API proposals, acceptance data and the measurements
behind them in gui-support-features.md; IDs F0–F16 as there). The GUI builds
a periodic unit cell, meshes it with Gmsh and runs ConicalScattering / Scattering2D; every item
removes glue code or a workaround on its side. Priorities P1 > P2 > P3. Overlaps: F1 contains the
unchecked "hp-adaptivity for the conical solver" of M13, F16 the "marking symmetrised across periodic
faces" of M14-B.
- [x] F0 (P1) conventions of the conical API documented in layered_conical_wave (s = k × ŷ / |·|
= (−sin φ, 0, cos φ), p = k̂ × s, phase 1 at the origin on the top interface, scaled against
physical components, solver frame against the literature frame, ky is the normal
wavenumber) and tested at five (θ, φ) pairs to 1e-10
- [x] F16 stage 1 (P1): symmetric refinement across a Bloch pair in the adaptive mesh
(AdaptiveMesh::set_periodic, mirrored after the closure in refine / hp_refine; 2D
and 3D unit tests, Python set_periodic)
- [x] F16 stage 2 (P1): non-matching Bloch coupling for the Nédélec and H1 traces (facets
grouped by overlap; the coarser facet carries the trace truncated to the common order, the
finer facets interpolate it, exact for different levels and orders on the two faces; unrelated
layouts by interpolation with a warning), assembly::PeriodicLocator, and the Bloch facets in
the residual estimators (periodic argument); test_periodic_nonmatching.cpp, case (d) of
conical_grating_hp (ridge off centre, faces refined independently). Observed before stage
1: bloch_constraints: 14 master facets but 16 slave facets after a closure refinement on an
unstructured Gmsh mesh
- [x] F1 stage 1 (P1) hp-adaptivity for ConicalScattering: adaptivity::conical_residual_estimate
(residual of the coupled system with the β terms, PML tensors and the E_z / εE_z interface
conditions), ConicalScattering::estimate / error, Python bindings and hp loop; convergence
tests conical_hp_corner (re-entrant PEC corner at β = 1.3, exponential, b = 0.26) and
conical_grating_hp (acceptance (a) and (d): Ag grating TM 50° from p = 4, ΔR−1 = −5e-6,
ΔR0 = −2.2e-4 at 88 k DoFs, validation-long; docs/validation.md E)
- [x] F1 stage 2 (P1): goal-oriented estimator for the conical solver
(physics::conical_dwr_estimate, conical_point_functional, conical_order_functional,
adaptivity::conical_weighted_residual; convergence test conical_goal_oriented), corner
pre-refinement adaptivity::refine_at_points, generator hpfem.adaptive_solve that streams
steps and stops on a tolerance, acceptance (b) TE Ag 50° and (c) conical TM Si 50°/40° in the
long variant of conical_grating_hp (docs/validation.md E)
- [x] dimensionally consistent Gauss-law terms in the three residual estimators
(EstimatorOptions::length_scale, default ℓ = 1/k; in SI units the unscaled terms dominated η
by 1/(kh)², docs/validation.md E)
- [x] F2 (P1) one-call periodic scattering API: hpfem.grating.solve (interfaces snapped onto
mesh vertices with Mesh::set_vertex, PML from the largest propagating-order angle, measurement
lines between structure and PML, reflected / transmitted orders with vector amplitudes,
absorbed power per tag, power balance, field(points), timing, GratingError diagnostics);
test_grating_solve.py against the conical RCWA references. The six GUI presets of
fem_worker.py are not in this repository; the worker can be reduced to JSON handling on top
- [x] F3 (P1) vectorised field sampling and triangulated field export as NumPy
(physics/field_sampling.hpp: sample_field / triangulate_field with SamplingOptions
for E, H and the Poynting vector, grouped per cell; solution.sample(points),
solution.triangulate(subdivisions) for both solvers)
- [x] F4 (P1) exact absorbed power per material tag and per cell (physics/absorption.hpp:
absorbed_power_by_tag, absorption_density; solution.absorbed_power() with by_tag /
per_cell) by volume quadrature
- [x] F5 (P1) job runner / CLI with a stable JSON schema and JSON-lines events
(python -m hpfem.run, hpfem.run.run_job, hpfem.version_info, schema version 1 for grating
jobs with sweeps, maps, cancellation; the six GUI presets are not in the repository)
(python -m hpfem.run job.json), hpfem.version_info()
- [x] F6 (P1) mesh module: unit-cell mesher (hpfem.meshing), mesh.report(),
mesh.check_periodic, read_gmsh reading $Periodic
- [x] F7 (P1) structured diagnostics (hpfem.diagnostics, grating.validate, run by
grating.solve): interface off the mesh lines, untagged
cells, missing periodic partner, under-resolved or thin PML, too few elements per wavelength,
material outside its data range, lossy incidence medium, PEC wall too close in a lossy substrate
- [x] F8 (P2) sweep acceleration: LinearSolver::refactorize reusing the symbolic analysis
(SparseLU, MUMPS, cuDSS), physics::ConicalSweep (affine operator per material tag with a
pattern cache), hpfem.sweep.solve_sweep; 2.1× over 50 points on cuDSS
- [x] F9 (P2) progress callback, cancellation, timing breakdown, estimate_memory
- [x] F10 (P2) conical equivalents of diffraction_orders / power_balance (flux based, complex
vector amplitudes)
- [x] F11 (P2) isolated scatterers for the conical solver: cross sections, far field, automatic
closed measurement contour
- [x] F12 (P2) H field and Poynting vector of the conical solution (curl_field, h_field,
poynting and the incident counterparts, also on the layered background)
- [x] F13 (P2) dispersive materials directly in the setup (materials.DispersiveMap.apply(setup,
omega), library names, numbers and core materials accepted; grating.solve takes dispersive
dicts), explicit
out-of-range policy, Drude–Lorentz fit helper
- [x] F14 (P3) high-level eigenproblems on the periodic-cell front end (resonances, bands)
- [x] F15 (P3) distribution: Windows/Linux wheels, pip install hpfem[gui], hpfem-gui entry point
M16 — Optimisation, calibration and uncertainty quantification
Proposal of 9 October 2026, revised after the review of PR #134; scope, rationale, API sketches
and validation plan in optimisation-uq-features.md (IDs S0–S9
as there). The adjoint sensitivities of M12 (material and shape) are the foundation. Everything
is Python (hpfem.opt) on the existing C++ core, except the eigenvalue derivatives of S4. Own
code only where the project has an advantage (gradients, Laplace via the Jacobian, DWR);
gradient-enhanced / multi-fidelity / multi-objective BO, NUTS and further UQ methods come from
mature libraries as optional extras (BoTorch, emcee, SALib) with an ADR note. Flagship
problems: a 2D grating and a metasurface unit cell (the 3D ring later). Priorities P1 > P2 > P3;
effort in focused sessions.
- [x] S0 (P1, ≈ 1) ADR-0012 (accepted, docs/adr/0012-optimisation-and-uq.md): scope of
hpfem.opt, dependencies (NumPy/SciPy required, own light Gaussian-process code,
BoTorch / emcee / SALib only optional), study file format, the evaluator contract and the
morphing-versus-remeshing strategy: a reference mesh is morphed with move_nodes
within a parameter range, remeshing only when the quality guard trips, so that the
objective stays consistent with the adjoint gradient
- [x] S1 (P1, ≈ 4) gradient infrastructure: geometry parameters (radius, width, height,
position) mapped to mesh velocity fields; Jacobian of several observables in the direct
(tangent) mode (one solve per parameter) and the adjoint mode (one solve per
observable) on the same factorisation, the cheaper one chosen from the counts; derivatives
with respect to frequency and angle; mesh-quality guard; finite-difference checks on the
morphed mesh (LinearSolver::solve_transposed, KeptFactorisation, residual derivatives
and grating.jacobian, hpfem.opt parameters / shape_velocity / Morph,
conical_parameter_tangent with the derivative of the Bloch constraints for "theta",
"phi", "omega", "wavelength")
- [x] S2 (P1, ≈ 3) study framework: design space (continuous, integer, categorical,
constraints), evaluation cache, resume, JSON-lines result store, job-runner integration with
events and cancellation; batch proposals are evaluated sequentially, several processes only
with an explicit thread budget (OpenMP, one cuDSS GPU, per-process factorisations on Windows) (hpfem.opt.study: DesignSpace, Study, *.study.jsonl;
hpfem.opt.evaluator: Evaluation, FunctionEvaluator; events and cancellation as
callbacks, the hpfem.run tasks follow in S9; workers > 1 not yet)
- [x] S3 (P1, ≈ 4) classical optimisers and the Laplace approximation: L-BFGS-B with
gradients, Nelder–Mead, differential evolution (SciPy wrappers), Gauss–Newton /
Levenberg–Marquardt with the Jacobian of S1, parameter covariance from the Fisher
information; end-to-end showcase: Si-grating reconstruction (CD, height, side-wall angle)
with uncertainties from synthetic data (hpfem.opt.minimize / fit / laplace, MGH17 to
1e-6; GratingEvaluator; examples/grating_reconstruction)
- [x] S4 (P2, ≈ 3–4) eigenvalue derivatives of resonances and bands (C++): non-Hermitian
problem with PML and losses (left eigenvector; with Bloch / conical incidence the solution
at −k), nonlinear eigenproblem for dispersive ε(ω) (extra dε/dω term), complex Q;
verified against finite differences (physics/eigen_sensitivity.hpp,
grating.resonance_sensitivity / refine_resonance, physics/band_sensitivity.hpp,
group_velocity)
- [x] S5 (P2, ≈ 3) Bayesian optimisation: own light Gaussian process (Matérn ARD, noise),
expected improvement and LCB, constraints, gradient-enhanced GP with the adjoint
derivatives; multi-fidelity and multi-objective via the optional BoTorch extra. The DWR
estimate is used as a fidelity indicator or for adaptive refinement until the error is small
against the noise, not as independent GP noise (hypothesis, tested in S8) (hpfem.opt.gp,
hpfem.opt.bo; the BoTorch drivers are experimental, not run yet)
- [x] S6 (P2, ≈ 2) parameter retrieval beyond Laplace: Bayesian least squares on the surrogate,
MCMC through the optional emcee extra (posterior against the Laplace result)
- [x] S7 (P2, ≈ 2) uncertainty propagation and sensitivity analysis: linearised propagation
from the Jacobian (own), Monte Carlo on the surrogate, Sobol' indices by one route (GP
surrogate, SALib optional), fabrication-tolerance example (hpfem.opt.uq; SALib not
needed: the own estimators are verified against the analytic Ishigami indices)
- [x] S8 (P2) validation: Branin / Rosenbrock for BO, Ishigami for Sobol', NIST MGH17
for the reconstruction uncertainties, linear-Gaussian problems (MCMC = Laplace), gradient-based
against gradient-free BO on the 2D grating and the metasurface unit cell, test of the DWR
hypothesis (fidelity indicator against independent noise). Done (docs/validation.md H–L,
benchmarks/opt_validation.py, the long runs on the server, issue #202): BO with/without
gradients against Nelder–Mead, differential evolution and L-BFGS-B on the Si grating (H) and
on a TiO₂ metasurface deflector (L: both BO variants find the global maximum, the local
methods depend on the start), the DWR estimate as fidelity indicator (I: effectivity, the κσ
rule holds, DWR as noise rejected; rerun after the PML fix #156) and multi-fidelity BO (MF-KG,
DWR screening) against single-fidelity BO (K: no gain at this budget, on a workstation and a
server)
- [x] S9a (P3) job schema version 2 with the tasks optimize, reconstruct and uq
(hpfem.run, study store next to the results, version-1 documents unchanged; written by the
helper agent opt-jobs)
- [x] S9b (P3) study view in hpfem-gui (history, Pareto front, Sobol' bars, posteriors):
GUI-hpFEM mode „Studie“ on the job runner (python -m hpfem.run, schema 2), start, cancel and
resume, the history from the study store; the Pareto front is that of the evaluations of two
observables (the runner has no multi-objective task). Found on the way: the first-order Sobol'
estimator now works on the centred output (bootstrap half-widths of an efficiency near 1)
M17 — Dipole emitters in periodic structures (ADR-0013)
Proposal of 9 October 2026 from the GUI work, reviewed the same day; physics, conventions, stages,
tests and the GUI interface in dipole-emitters-features.md (IDs
S0–S4 as there). A single point dipole in a 1D-periodic structure by array scanning over the
Bloch wavenumber kx and the out-of-plane wavenumber β of the conical solver: Purcell factor,
radiated power into cover and substrate per direction, guided and absorbed power. Order A
(phased array) → C (reciprocity) → B (array scanning, the hard part).
- [x] S0: ADR-0013 (accepted, docs/adr/0013-dipole-emitters-in-periodic-structures.md): the
M11 Gaussian dipole by array scanning over kx and β (z-smearing as a factor per β sample,
β and kx symmetries), the delivered power as the volume integral of J·E, guided-mode poles
subtracted with β_g(kx) by Newton on the bands and the group velocity of M16 S4 (complex β
deferred), cost model with the three orientations as right-hand sides of one factorisation
- [x] S1: conical_gaussian_dipole, conical_source_power, grating.emit (Bloch-periodic
emitter array: delivered power as the volume integral of J·E (ADR-0013), orders up / down
with power, PML-boundary fluxes, absorbed, guided remainder); tests: homogeneous cell
against the closed form of a phased dipole array (including β = 0, the line-source case),
energy balance on a lossy ridge; the cross-check with Scattering<2> line sources moves
to S3
- [x] S2: grating.emission_pattern by reciprocity (angle-resolved emission: one solve per
direction and polarisation, cover and substrate, normalised to P_bulk; checked against the
homogeneous and the Fresnel closed forms and against Stage A; written by opt-jobs)
- [x] S3: grating.dipole_emission (array scanning, guided-mode poles, parallel samples on
ConicalSweep, cost estimate before the run); tests: mirror, planar multilayer (Sommerfeld),
period independence, plasmonic film, reciprocity against S2. Done: the kx integral on the
complex contour of ADR-0013 §3a with the analytic Bloch elimination
(Constraints::set_test), the power matrix on a kept factorisation, the radiated channels by
reciprocity over the half-spaces; a dipole above glass against the Sommerfeld integral
(8e-5 at a period of 1 µm, 1e-3 at 0.8 µm: period independence), the homogeneous cell,
benchmarks/m17_dipole_scan.py; the guided-mode poles of lossless structures (ADR-0013 §4a:
AAA on a detection pass, bumps on the side of positive guided power, β breaks from a pre-pass;
a dipole above a Si₃N₄ slab on glass against the layered Sommerfeld integral to 4e-4, the
guided power from the residues equal to the non-radiated rest to 3e-4) with its cost in
emission_cost; a dipole above a perfect mirror against the image dipole (F_P to 6e-4, all
power up); the lossy surface-plasmon poles with graded β panels towards their pinch (checked on
the analytic spectrum of a dipole above silver); parallel samples (workers, threads in one
process; the FEM validation of the plasmonic film against the layered Sommerfeld integral
(benchmarks/m17_dipole_scan.py --cases silver, server run of 65 h, record
2026-11-07-validation-m17-silver-server.json): a dipole in n = 1.5 80 nm above silver, F_P to
3e-4, up to 1.3e-4, the quenched rest to 2e-3 relative at p = 4)
- [x] S4: job-runner task emitter (schema 2) with events, cancellation and the cost estimate
before the run (grating.emission_cost, dry_run), extraction into a numerical aperture
(grating.emission_cone); docs (maxwell.md "Stage B", python.md), example
examples/grating_emitter (quantum dot above a glass grating, LED extraction) with the quick
variant as regression test (written by the helper agent opt-jobs); the remainder of
1.7–3.5 % on the diffracting grating came from the Gauss–Hermite average across the ridge
interface and the angle rule at the Rayleigh anomalies (fixed: cell quadrature, 16 × 32,
Wood breaks of the β rule); the example's record is to be recomputed
M18 — Layered background for the axisymmetric solver (ADR-0014)
Proposal of 10 October 2026 from the GUI work, reviewed the same day; channels, tests and the GUI
interface in axisymmetric-layered-features.md (IDs S0–S4 as
there). ADR-0009 (layered background) carried over to the body-of-revolution solver of ADR-0010:
particles on substrates, nanoparticle-on-mirror, holes and grooves in films (negative deviations).
- [x] S0: ADR-0014 (accepted, docs/adr/0014-axisymmetric-layered-background.md): background
stack in AxisymmetricScatteringSetup, analytic order-m expansion of the stack field with real
k_ρ and complex k_z (numerical φ-transform as the test reference), substrate-side incidence by
the reversed stack, new axisymmetric absorbed power, cross-section channels in layered media
- [x] S1: AxisymmetricScatteringSetup::background, contrast against the stack at the cell
centroid, checks (interfaces on mesh lines, no deviation in the PML), layered_axisymmetric_wave
(top / bottom, s / p, value and curl) with the φ-transform reference, reciprocity / TIR and the
homogeneous limit; Python bindings (written by the helper agent opt-jobs)
- [x] S2: axisymmetric absorbed power with the stack-field variant (body absorption, absorption
change around holes), scattered power split into up / down / lateral, axisymmetric_disc_flux
(aperture transmission); tests: quasi-static sphere above a substrate against the image dipole,
power balance of a hole in an absorbing film; 3D cross-checks with Scattering<3> +
LayerStack<3> as long local runs (benchmarks/m18_validation_3d.py, record in
benchmarks/results/, CI regression python/tests/test_m18_records.py): sphere on a two-layer
stack to 0.15 %, nanohole in a gold film to 2.5 % at p = 3; full spectra of
examples/particle_on_substrate (docs/validation.md J) (written by the helper agent
opt-jobs)
- [x] S3: reciprocity-based far field in both half-spaces (axisymmetric_layered_far_field),
collection over a numerical aperture (power_between); tests: homogeneous limit against the
near-to-far transform, reciprocity with a dipole source above glass (amplitudes in both
half-spaces, power balance) (written by the helper agent opt-jobs)
- [x] S4: docs (theory/axisymmetric.md "Layered background"), python.md, example
examples/particle_on_substrate (Au sphere on glass, dark field; NPoM gap mode; single nanohole
in a gold film, transmission) with README and a quick regression test (written by the helper
agent opt-jobs)
M19 — Optically anisotropic materials (ADR-0015)
Proposal of 1 November 2026, reviewed and accepted the same day: substrates, unstructured layers
and structured parts of anisotropic crystals (uniaxial, biaxial, rotated optic axis) as used in
semiconductor metrology; Jones and Mueller matrices. Out of scope of the
first step: gyrotropy / optical activity, a μ tensor, anisotropic cover media, tilted axes in the
axisymmetric solver, isolated structures in a tilted substrate; the anisotropic emitter scan comes
last.
- [x] S0: ADR-0015 accepted (docs/adr/0015-anisotropic-materials.md); review results: the
conical interface conditions are natural (no re-derivation), but an optic axis with a component
along the lines breaks the symmetry of the conical system (A(β)ᵀ = S A(−β) S); the stack uses
the ordered Schur form instead of eigenvectors (degenerate, near-degenerate and defective
layers); the PML condition fails already for tilted ordinary crystals (diagnostic, modal
substrate boundary for gratings); Material gets private scalar fields (breaking, Python alias)
- [x] S1: material model: optional symmetric 3×3 ε tensor in materials::Material (μ scalar),
private eps_r / mu_r with eps_scalar() / refractive_index() throwing
AnisotropicUnsupported for tensors (all uses in the repository migrated), Material::isotropic
/ anisotropic (gyrotropic tensors refused), MaterialMap::is_isotropic; Python: eps_r
stays a property (raises for tensors, no API break), Material.anisotropic / eps_tensor,
hpfem.AnisotropicUnsupported, hpfem.materials.Anisotropic / Uniaxial(o, e, theta, phi) /
axis_rotation / euler_rotation (ADR §6), sapphire Al2O3 with ordinary / extraordinary
data (Malitson & Dodge 1972), diagnostic anisotropic_unsupported in grating.validate /
solve and validate_scattering; docs/theory/materials.md
- [x] S2: volume solvers 2D / 3D: regression test first: ε·I through the tensor path reproduces
the existing benchmarks to round-off; tensors in form_of_cell, PML ε̃_ij = ε_ij s_x s_y s_z/(s_i s_j)
with the pml-backward-wave diagnostic (geometric condition), estimators (divergence,
n·εE jump), per-cell tensor overrides; tests: uniaxial slab in 3D, PML reflection with a full
tensor (aligned and tilted axis), symmetry detection (non-gyrotropic crystals take the LDLᵀ
paths); done in Scattering, Resonance, BandStructure, the losses and Thermal, 2D on
the in-plane block (plane-to-z coupling refused); finding: aligned biaxial crystals also fail
the PML condition, along their intermediate axis (ADR-0015 S2 amendment)
- [x] S3: conical solver: full tensors in ConicalForm, derivation in the conical section of
docs/theory/maxwell.md, estimators; first ε_xz = ε_yz = 0 (symmetric), then the general tensor
with the transposed paths (adjoint of conical_goal, emission pattern by reciprocity at −β,
power matrix on ConicalSweep, sensitivities), scalar_ez rejecting coupling tensors; tests:
A(β)ᵀ = S A(−β) S on the cell matrices, each transposed path against a forward solve, conical
against 3D with the crystal and the grating rotated together, form-birefringent grating against
the effective-medium plate (and L. Li 2003 where it applies)
- [x] S3a: full tensors in ConicalForm (both stages at once: diagonal tensors keep their
path, full ones the general product), PML and scattered-field source, estimators,
scalar_ez refusal, transposed adjoints of conical_adjoint_solution (sensitivities) and
conical_dwr_estimate (a latent error for coupling crystals, caught by the finite-difference
test), derivation in maxwell.md; tests: A(β)ᵀ = S A(−β) S, the 2D solver at β = 0, the
adjoint against finite differences, the estimator identity, a crystal plate conical against
3D (anisotropic_conical_vs_3d)
- [x] S3b: ConicalSweep with tensor groups (six mass parts per crystal), the left vector of
conical_resonance_adjoint for non-symmetric pencils (a latent error, checked against finite
differences), crystals in hpfem.grating.solve / validate in the laboratory frame
(y ↔ z to the conical frame, ADR-0015 S3 amendment)
- [x] S3c: the emission pattern and the array scan by reciprocity with crystals (mirrored
tensor for the substrate directions; done in S7d, except a crystal substrate), the grating
rotated with the crystal against 3D, form birefringence against the effective-medium plate
(L. Li 2003)
- [x] form birefringence: a lamellar grating (isotropic and crystal lamellae) against the
effective-medium plate; the difference falls like P/λ (boundary layers of the evanescent
orders), its Richardson extrapolation like (P/λ)² (test_grating_jones.py)
- [x] the grating rotated with the crystal against 3D: a crystal ridge (axis (1, 1, 1)) in
the conical solver against 3D cells with the lines along z and with grating, crystal, wave
and probe rotated by 90° about the normal; 5e-5 at p = 4
(tests/convergence/anisotropic_conical_vs_3d.cpp)
- [x] S4: anisotropic LayerStack: 4×4 system per layer (ε_zz ≠ 0), ordered complex Schur form
and 2×2 block exponentials, stable S-matrix recursion on the up / down subspaces, substrate modes
(o / e by the axis, biaxial by power orthogonality), Jones matrix, analytic stack field for the
scattered-field source; tests: independent eigenvector 4×4 transfer matrix (thin layers), closed
forms at normal incidence, isotropic layers between anisotropic ones, axis along z and 10⁻⁶ rad
off, a Voigt direction of an absorbing biaxial layer, R+T+A=1
- [x] S4a: physics::AnisotropicStack (laboratory frame, Python AnisotropicStack): Berreman
4×4, two ordered Schur forms per region, triangular 2×2 exponentials, S-matrix recursion,
Jones reflection, substrate transmission, R/T/A; tests: LayerStack for isotropic stacks,
an eigenvector-free transfer reference (expm; the eigenvector one fails already on a
degenerate isotropic layer), the closed forms at normal incidence, the axis along z and
10⁻⁶ rad off, a Voigt point found by Newton, energy balance, a 100-λ absorbing crystal;
docs/theory/anisotropic-stack.md
- [x] S4b: o / e labelling of uniaxial substrate modes, power-orthogonal modes where they
coincide, per-mode power channels; AnisotropicStack::plane_wave (analytic field per
region), layer_stack(), crystal layers in LayerStack for lookup, the tensor contrast
against a crystal background in Scattering<3> and the conical solver,
anisotropic_conical_wave (laboratory → solver frame, curl as a pseudovector); tests: the
field solves Maxwell in every region, LayerStack / layered_conical_wave for isotropic
stacks, a crystal plate on a c-cut half-space against the full stack in 3D and conical
(anisotropic_stack_background). Crystal stacks in hpfem.grating need the mode-resolved
orders of S5
- [x] S5: post-processing: mode-resolved diffraction orders in anisotropic half-spaces, modal
transparent substrate boundary for gratings over tilted crystals, absorption and Poynting flux
with tensors, Jones / Mueller output with the s/p convention of conical_polarisation; tests:
mirror symmetry in the azimuth (r_sp odd, r_ss / r_pp even), reciprocity
r_ps(k_in → k_out) = −r_sp(−k_out → −k_in) on a rotated crystal (stack and conical)
- [x] S5a: half_space_modes (upward / downward modes of a crystal half-space with kinds, k_z,
flux), conical_mode_orders (orders on any line decomposed on the outgoing modes: o / e,
biaxial or s / p channels with efficiencies); tests: modes against K and closed forms, the
mirror symmetry and the reciprocity r_ps(φ) = −r_sp(φ + π) of the stack Jones matrix (also
for a tilted axis), a known-mode field recovered on a line, the transmitted o / e channels of
the conical FEM field against the stack (anisotropic_stack_background)
- [x] S5b: modal transparent boundary (ConicalScatteringSetup::modal_boundaries,
conical_modal_boundary_matrix: DtN of the half-space modes per Fourier order) for the
conical solver, where a PML over a tilted crystal is unstable; tests: the transposition
symmetry of the DtN matrix, a crystal plate on a tilted substrate against the stack, a
lossless grating with a backward order −1 (energy balance converges, the PML stalls)
(anisotropic_modal_boundary)
- [x] S5c: grating.jones (Jones / Mueller matrix of every propagating order,
conical_polarisation s / p in isotropic media, mode channels in crystal substrates,
power-normalised and referred to the stack interfaces), crystal stacks in hpfem.grating
as AnisotropicStack (laboratory frame) with mode-resolved transmitted orders
(Order.channels) and bottom="modal", the refusal of a bottom PML over backward orders;
scalar_ez also checks crystals of the background stack; tests: a flat crystal stack
against the stack Jones matrix (J = D r D) and channels, reciprocity of the specular order
of a tilted crystal ridge (test_grating_jones.py)
- [x] S6: axisymmetric solver with diagonal (r, φ, z) tensors, rejection of tilted axes
(axisymmetric_permittivity: a tensor is read in (r, φ, z) and must be diagonal; the material
and PML forms, the componentwise scattered-field contrast, the absorption and the cavity loss
check take it; the background and the layered background stay isotropic); tests: a uniaxial
filling with the axis along z against the ordinary / extraordinary closed forms, a radially
anisotropic coaxial cavity against the Bessel modes of non-integer order (5e-11), an isotropic
tensor equal to the scalar case, the refusals (axisymmetric_anisotropic)
- [ ] S7: dipole emitters above anisotropic stacks (ADR-0015 S7 amendment), after S4 / S5 are
validated
- [x] S7a: reference: AnisotropicStack::reflection_at (Jones reflection at any in-plane
wavevector, evanescent included), hpfem.planar.dipole_above_stack (Purcell factor of a
point dipole above a crystal stack from the 2D plane-wave spectrum, exact for the Gaussian
emitter); tests: the CPS / Airy Sommerfeld integrals for a glass half-space and an absorbing
layer, the closed-form r_p of a c-cut half-space, the rotational covariance of a tilted
crystal, reflection_at against response and the evanescent Fresnel coefficients
- [x] S7b: grating.emit above an AnisotropicStack (isotropic lossless host, downward orders
of a crystal substrate per mode channel, bottom="modal", a warning when the Gaussian
reaches across a stack interface), hpfem.planar.array_sample_above_stack (the cell sample
of a flat stack: the plane-wave spectrum on the orders); tests: a tilted absorbing crystal
layer (6e-8 inside the light cone, 2e-5 beyond it), a tilted lossless crystal substrate with
the modal bottom (1e-5, P_cell = up + down)
- [x] S7c: dipole_emission for crystals (an AnisotropicStack or crystal cells): β over
(−β_max, β_max), the full kx zone, every power-matrix entry, the light lines and branch
points of crystal half-spaces from their Fresnel quartic and the β turning points of their
sheets; refused with crystals: symmetric, channels (S7d), the guided-mode poles (a
lossless crystal structure that may guide modes), bottom="modal"; tests: the light lines
against closed forms, the scan rule on the exact spectrum of a tilted crystal half-space
(1e-4), the refusals; long run benchmarks/m19_crystal_dipole_scan.py: the FEM scan against
S7a to 5e-4
- [x] S7d: emission pattern / channels by reciprocity with crystals: emission_pattern,
emission_cone and the channels of dipole_emission take crystal cells and an
AnisotropicStack; the substrate directions mirror the cell with M ε M (M = diag(1, −1, 1))
and the stack as a mirrored AnisotropicStack; no z mirror of the directions and no odd-entry
zeroing with crystals; a crystal substrate has no down directions yet (refused: it would
need incidence from a crystal); tests: the pattern up and down against |p · E_pw(x0)|² of
the analytic stack field per polarisation (6e-5); local run
benchmarks/m19_crystal_emission_balance.py: the hemisphere powers up + down (8×16
directions each) against the total of S7a to 4.8e-5
- [ ] S7e: guided-mode poles above crystals, down channels into a crystal substrate
- [x] S7e-1: radiation into a crystal substrate: a lossless crystal incidence medium in
AnisotropicStack and LayerStack (lookup), AnisotropicStack::mode_wave,
anisotropic_conical_mode_wave, the reciprocity with power-normalised modes over the
in-plane wavevector (emission_cone(side="down"), dipole_emission channels); tests: the
mode fields against the analytic ones, the analytic up + down against the S7a total
(1.2e-4), the FEM balance (7.5e-5, benchmarks/m19_crystal_substrate_balance.py);
fixed on the way: the crystal cover was left in the laboratory frame by
anisotropic_conical_wave
- [ ] S7e-2: guided-mode poles above crystals
- [x] S7e-2a: the reference on a deformed path (reflection_at at complex in-plane
wavevectors, the causal up / down split beyond the half-space indices,
dipole_above_stack(depth=...)); tests: an isotropic slab against Airy, a crystal slab
independent of the depth and the small-loss limit
- [ ] S7e-2b: the guided-mode poles in the array scan of crystal structures: implemented
(detection and causal bumps per β node; dipole_emission warns); without the β
pre-pass the server runs stayed at 2e-3 to 6e-3, not monotone in 6 / 8 / 10 β nodes
(issue #205): the pre-pass now runs for crystals without a coupling along the lines
(poles even in kx by the z mirror and reciprocity); validation pending:
benchmarks/m19_crystal_guided_scan.py against dipole_above_stack(depth=0.03) (a long
run, to be done on a server)
- [x] S8: GUI material editor (isotropic / uniaxial / biaxial / full, axis angles, per part and
layer) and display of the Jones / Mueller elements (GUI-hpFEM PR #4: crystal spec in the
laboratory frame, AnisotropicStack for crystal layers / substrate, grating.jones with the
Mueller map / curves and the Jones table; end to end against the analytic Jones matrix of a flat
crystal plate on a crystal substrate, 3e-16)
M20 — Linear elasticity with eigenstrain (ADR-0016) ✅
Proposal from Voxelspaetzle (two-photon printing process model) in issue #213, accepted on
19 November 2026. The model is the shrinkage of printed polymer parts:
−∇·σ = 0, σ = C : (ε(u) − ε), on Dim copies of the scalar H1 space, assembled complex, with the
existing solver stack.
- [x] S0: ADR-0016 (accepted, docs/adr/0016-linear-elasticity.md): vector H1 space
(component-major blocks of DofMap), complex assembly with LDLᵀ backends, Dirichlet data per
component, traction-free default, rigid-body modes by Lagrange multipliers, eigenstrain as a
callable / data port / temperature, output down to the ADR-0011 mesh velocity
- [x] S1: vector H1 assembly with the C : ε forms and physics::Elasticity<Dim> (3D and 2D plane
strain): Dirichlet per component, tractions, body force, eigenstrain callable, hanging nodes,
static condensation (assembly/elasticity_forms.hpp, physics/elasticity.hpp); tests: the
patch test (linear fields to round-off for p = 1 … 3, with hanging nodes and condensation), the
rigid-body kernel, a two-material bar under a traction with symmetry planes, a stress-free
uniform eigenstrain, and the manufactured solution (rates p + 1 in L², p in H1 for p = 1 … 4 in
2D and 1 … 3 in 3D, tests/convergence/elasticity.cpp); docs/theory/elasticity.md
- [x] S2: eigenstrain sources (ε(x), isotropic s(x), the thermal strain α (T − T₀) I from a
temperature on the same map, e.g. Thermal), GridField<Dim> (bi- / trilinear on a regular
grid, the data-port path), remove_rigid_modes (3-2-1 pins, equilibrium check, L2 projection
onto the rigid-body modes, ADR-0016 §4a); tests: the free sphere on the curved ball mesh
(u = −s x to 1e-12 for p = 2, 3, also with condensation and from a grid), the laterally
constrained layer (u_z = −s z (1 + ν)/(1 − ν), σ_xx = s E/(1 − ν)), a linear temperature in a
free cube (stress-free) and a two-material one (stresses), the unbalanced-load refusal
- [x] S3: output (displacements_at for point and surface values with NaN outside,
strain_energy, deformed_mesh with the edge nodes moved for p ≥ 2), the Python API
(hpfem.Elasticity2D / 3D, ElasticitySetup, DisplacementCondition, TractionCondition,
ElasticMaterial, GridField2D / 3D with set_shrinkage_grid), the bonded strip against
Timoshenko (1925) (agreement to 1e-8 at the centre, docs/validation.md M), the example
examples/printed_block_shrinkage (shape error and wall pull-in of a printed block, a
constrained-layer check inside) with its regression test
- [x] S4: coupling to the optics: Elasticity::mesh_velocity(u) (Re u on the geometry nodes,
the ADR-0011 velocity) and deformed_mesh(u, t) = move_nodes(mesh, V, t); test: a shrinking
resin disc in a soft surrounding, the scattered field at a point by shape_derivative along
V against the central difference of the optical solve on the deformed meshes (2e-4), and the
full 1 % shrinkage predicted to first order within 0.9 %
- S5 (optional):
- [x] S5a: axisymmetric elasticity (u_r, u_z) for printed bodies of revolution
(ElasticitySetup::axisymmetric, axis_tag, hoop_eigenstrain; hoop strain u_r / r, weight
r, u_r = 0 on the axis, the z translation as the only rigid-body mode; hoop_strain,
hoop_stress); tests: the patch test with the hoop stress, the free sphere on the half disc
(1e-12), the hollow sphere under internal pressure against Lamé (8.4e-7 at p = 4, the
quadratic geometry of the arcs falling like h_θ⁴)
- [x] S5b: a residual estimator and hp-adaptivity for elasticity (the singular edges of
clamped printed parts): adaptivity::elasticity_residual_estimate (and the axisymmetric
one) in the energy norm, Elasticity::estimate / energy_error, Python; tests: zero
indicators for solutions in the space (hanging nodes, eigenstrain, axisymmetric), the
closed-form boundary residual, effectivity and rate on smooth solutions; convergence test
elasticity_hp_corner (Williams modes I + II at the traction-free re-entrant corner:
super-algebraic, effectivity 2.3–3.3). Fixed on the way: Dirichlet sets on 3D hanging meshes
include the hanging parent edges lying on the facets
- S5c (a real-valued solver path) moved to the backlog on 20 November 2026: no measurement
asks for it (issue #213)
M21 — Crossed (doubly periodic) gratings in 3D
Request of 23 November 2026 (issue #237): compute models of FourierGrating (RCWA, doubly
periodic) with hpfem and compare them order by order, e.g. a hole array in a glass layer on glass
(period 0.5 µm in x and z, hole radius 0.125 µm, layer 0.150 µm, λ = 0.405 µm). The solver parts
exist (Scattering<3> on a LayerStack<3> background, Bloch pairs in two directions,
read_gmsh_periodic in 3D); missing are the orders, the unit-cell meshes and the import.
- [x] S1: diffraction orders (m, n) on a plane (physics::diffraction_orders for OrderPlane:
oblique lattices, incident wave subtracted, efficiencies; Python OrderPlane,
DiffractionOrder3D); tests: analytic plane-wave sums on an oblique lattice in a tilted plane
(1e-12), the analytic stack field (R, T of s and p to 1e-10), a film as scatterer in a Bloch cell
against the transfer matrix (s 8e-6, p 1.6e-3 at p = 3), a lossless square-hole array with
propagating orders: ΣR + ΣT = 1 and x / y polarisation equal, converging in p
(tests/convergence/crossed_grating_orders.cpp). Fixed on the way: Bloch pairs of matched 3D
meshes no longer fall back to the interpolation of non-matching facets
- [x] S2: hpfem.crossed: the model (CrossedGrating, Layer, Shape: circle, ellipse,
rectangle, polygon as holes or pillars, continued periodically), the Gmsh unit cell
(unit_cell_mesh: periodic side faces paired explicitly, second-order cells for curved
shapes, PML space) and solve: homogeneous layers as the layered background (only the shapes
scatter), PML for the steepest propagating order, Bloch phases in x and y, s and p with one
factorisation, orders (m, n) above and below, absorption, polarised for any (a_s, a_p)
without a new solve; tests: the bare stack against the transfer matrix (1e-9), a lossless hole
array (balance 1e-4, C4 symmetry 1e-4), an absorbing one (balance, the circular sum rule of
the mixed absorption). The FourierGrating example converges in p on a fixed mesh (balance
1.1e-2, 9.5e-4, 5.8e-5 for p = 2, 3, 4; docs/python.md)
- [x] S3: hpfem.fouriergrating (import of FourierGrating crossed-grating configurations:
homogeneous, contour2d, polygon2d layers, constant materials, scans; refusals name the JSON
pointer), hpfem fg model.json writing FourierGrating's efficiencies.csv, the frames fixed
against FourierGrating's fields and efficiencies on a case without mirror symmetry (FG
(x, y, z) = (x, −z, y − H), ψ = −φ, p = −p, order (n, m) = (n, −m)), CrossedResult.field;
example examples/crossed_hole_array and docs/validation.md N: the hole array against the RCWA
(N = 20): diffracted orders within 5e-5 at p = 4, T00 3.4e-4, near fields 5e-3. The project
format dim: 3 with a stack moved to the backlog: the FourierGrating file and the Python API
cover the use case
- [ ] S4 (GUI-hpFEM, GUI agent): model type “crossed grating” and the FG import; load_model()
normalises or rejects foreign material formats
Backlog / ideas
- [ ] elasticity: a real-valued solver path (M20 S5c, ADR-0016 §3). The complex assembly with a zero imaginary part costs about twice the memory and four times the flops of a real factorisation; worth doing only when a measured elasticity solve (e.g. a Voxelspaetzle part) is limited by it
- [ ] the full ring resonator with ports in 3D (M12 stage B): needs an hp-mesh that is fine only across the cores and in the coupling region, p = 3 there for the resonance widths (the coarse axial mesh of the long couplers loses the phase as h_z^(2p), docs/validation.md F)
- [x] dual H-formulation for guaranteed error bounds (
adaptivity::dual_solutionon the H1 / Nédélec dual space,hypercircle_estimatewith the Prager–Synge bound for the coercive problem; convergence testhypercircle_bound, Pythondual_solution/hypercircle_estimate) - [x] hypercircle bound on constrained meshes and in the hp loop:
dual_solutionwith the hanging-node constraints and the Bloch pairs of the primal problem, the hypercircle indicators as marker of the hp loop; convergence testhypercircle_adaptive(L-shape corner singularity: the bound holds in every step, effectivity 1.02–1.29, exponential in N^(1/3)), Pythondual_solution(..., periodic=...)andbloch_constraintson the H1 map - [x] Floquet-Bloch band structure solver (
physics::BandStructure: Bloch constraints with complex phases on the Nédélec and H1 spaces, gauged complex shift-invert Arnoldi, bands per wave vector and along Γ–X–M paths; convergence test on the empty lattice,BandStructure2D/3Din Python) - [x] transient (time-domain) solver via implicit time stepping (
physics::TimeDomain: Newmark-β on the second-order E wave equation, conductivity, PEC, first-order absorbing boundary, current sources with time signals; convergence testtime_domain_cavity, PythonTimeDomain2D/3D) - [x] GPU backend: cuDSS direct solver behind
solvers::LinearSolver(ADR-0008, measured on the RTX 3090: factorisation 2×, repeated solves 30–140× against MUMPS;DirectSolverBackend::kCudssopt-in, separately builthpfem_gpulibrary ingpu/loaded at run time behindHPFEM_ENABLE_CUDA,LinearSolver::solve_many); GPU assembly deferred (FP64 rate of consumer GPUs, MSVC-only toolchain) - [x] GPU backend for hp-adaptive systems: cuDSS pivots statically and perturbed tiny
pivots on systems with hanging nodes and high orders even after the scaling to
max |a_ij| = 1 (L-shape test: 103 of 16 359 and 2 639 of 19 723 pivots; plasmonic wedge
28 / 1 591 / 16 356), so
kAutosent them to MUMPS / SparseLU. Resolved by the diagonal equilibration D A D (d_i = 1/√|a_ii|, row norm where the diagonal is tiny) inside the GPU library: 0 perturbed pivots in every step of both tests, convergence identical to the CPU; cuDSS matching and reordering options changed nothing, and accepting perturbed factorisations with iterative refinement had lost accuracy at 2 639 pivots. The refusal of perturbed factorisations and the CPU fallback stay as the safety net; a residual-checked acceptance remains the option should future systems still trip the static pivoting. - [x]
physics::PropagatingMode<2>on adaptive meshes: apply the hanging-node constraints asResonancedoes (found during M10 validation; fixed in PR #63)