Repository navigation
Add Maxwell eigenmode solve with a KrylovKit extension - #76
xtalax-droid wants to merge 30 commits into
Conversation
maxwell_eigenmodes(model; nev, target_frequency) solves Kc u = λ Mε u on the dofs off the PEC facets (eliminated, not constrained by apply!) by shift-invert Arnoldi: one sparse LU of Kc - σ Mε, real or complex when lossy, and KrylovKit eigsolve on u -> (Kc - σ Mε) \ (Mε u). Each Krylov vector is projected, along the discrete gradients of the hat functions off the PEC facets, onto discretely divergence-free fields, so the λ = 0 null space never enters even for a target below the lowest mode; residual |λ| < nullspace_tol·σ is filtered. It returns frequencies, Q = Re(ω)/(2 Im(ω)), complex ω and MaxwellSolution modes. KrylovKit is a weak dependency; without it a fallback hook names the package to load. Tests check the PEC box against the analytic TE/TM list (15 modes with multiplicities, rate ~2 over three meshes), a dielectric fill, Q = 1/tan δ and the SI 100x50x75 mm box. Agent-Harness: Claude Code 2.1.318 Agent-Model: claude-opus-5-5 Agent-Session: ee6a670e-e4ec-446c-b941-3ebb999c45c5 Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Agent-Harness: Claude Code 2.1.318 Agent-Model: claude-opus-5-5 Agent-Session: ee6a670e-e4ec-446c-b941-3ebb999c45c5 Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Without PEC (or on any connected part of the mesh with no PEC node) the gradients of all nodal hat functions sum to zero, so G'MG was singular and maxwell_eigenmodes threw SingularException; one potential dof per such part is now dropped. Shift-invert ranks modes by distance in lambda ~ omega^2, which favours modes below the target; it now computes at least 2nev candidates, grows the count until every mode within the nev-th frequency distance must be among them, and returns the nev nearest in frequency, as documented. Found in review. Agent-Harness: Claude Code 2.1.318 Agent-Model: claude-opus-5-5 Agent-Session: ee6a670e-e4ec-446c-b941-3ebb999c45c5 Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
LinearSolve 3.27 through 5 declares KrylovKit = "0.10" for its KrylovKit extension, and LinearSolve is always installed (NonlinearSolveFirstOrder 2.10 depends on it), so KrylovKit 0.9 cannot resolve and the Downgrade job would fail. Checked on Julia 1.10 with every dependency at its compat floor: KrylovKit 0.10.0 resolves next to LinearSolve 5.18.3, and the eigenmode solve and Q check run. Agent-Harness: Claude Code 2.1.318 Agent-Model: claude-opus-5-5 Agent-Session: ee6a670e-e4ec-446c-b941-3ebb999c45c5 Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
The candidate stopping rule bounded |lambda - sigma| from the distance in Re(omega), which does not bound it when damping is large: with eps_r = 1 - 100i it stopped before the mode it should return. Modes are now ranked by |omega - omega_t| for the real target omega_t, for which |lambda - sigma| <= scale d (2 omega_t + d) holds for complex omega too; for a lossless model this is still the nearest eigenfrequency. The result is now sorted by Re(omega) rather than Re(lambda), which differ under heavy loss. Found in review. Agent-Harness: Claude Code 2.1.318 Agent-Model: claude-opus-5-5 Agent-Session: ee6a670e-e4ec-446c-b941-3ebb999c45c5 Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
A model whose nodes all lie on PEC facets has no gradient basis, and lu(G'MG) of a zero-column G threw; the projection is now the identity there. A problem smaller than the Krylov dimension (KrylovKit would otherwise get krylovdim > n) is solved densely, dropping the projected-out gradients at theta = 0. nev < 1, nev above the number of modes outside the gradient null space, a model with no free edge dof and a non-finite target now raise clear ArgumentErrors, and the eigenvector normalisation falls back to the unit dof norm where Re(eps_r) <= 0 makes the weighted norm non-positive. Found in review. Agent-Harness: Claude Code 2.1.318 Agent-Model: claude-opus-5-5 Agent-Session: ee6a670e-e4ec-446c-b941-3ebb999c45c5 Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
The dense path dropped eigenvalues with |theta| below 1e-8 of the largest, which also dropped physical modes when the target sat on a resonance and made one theta huge. The projected-out gradients are now recognised structurally: their eigenvectors lie in the range of G, which the projection annihilates, while it leaves every other eigenvector unchanged. Found in review. Agent-Harness: Claude Code 2.1.318 Agent-Model: claude-opus-5-5 Agent-Session: ee6a670e-e4ec-446c-b941-3ebb999c45c5 Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Agent-Harness: Claude Code 2.1.318 Agent-Model: claude-opus-5-5 Agent-Session: ee6a670e-e4ec-446c-b941-3ebb999c45c5 Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Agent-Harness: Claude Code 2.1.318 Agent-Model: claude-opus-5-5 Agent-Session: ee6a670e-e4ec-446c-b941-3ebb999c45c5 Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Agent-Harness: Claude Code 2.1.319 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Resolve conflicts against the master sync of maxwell/1-core. Agent-Harness: Claude Code 2.1.322 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
… widen the search past dropped modes The cutoff |lambda| >= nullspace_tol * sigma discarded the lowest physical modes once the target frequency was high enough (a 0.83 Hz mode against a 1000 Hz target), and the candidate search stopped as soon as the filter left fewer than nev of them. The cutoff is now relative to min(sigma, ||K||_1/||M||_1), and the candidate count doubles until the dense solve if fewer than nev survive. Agent-Harness: Claude Code 2.1.322 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Independent review (Codex CLI v0.164.0 / gpt-6.1-sol), reviewer session 01a1c8cf-b4da-7d63-ace0-8310981cb7fe, reviewed head 7b5b914
This is a blind code-only review by a session other than the PR author's, copied below from the reviewer's report with only the grading metadata removed. The posting agent did not re-run the reviewer's commands. A MERGE verdict is advice; merging is left to the maintainers. Riskmedium-low (ML7: additive, documented Maxwell public API; existing calls and defaults remain unchanged). Blocking findings
Non-blocking findingsNone. What I ranCommands below use paths relative to the checkout for the job's scratch environments.
What I did not verifyFull package/QA suites, documentation build, other Julia versions, and CI were not run or inspected. PR body, comments, prior reviews, author risk ratings, and issue-deferral evidence were not accessed. No issues, comments, commits, pushes, or checkout edits were made. Every process started for this review has finished. 🤖 Posted by an AI agent — harness: Claude Code 2.1.322 · model: claude-sonnet-5-5 |
Conflicts in src/maxwell/model.jl resolved keeping both sides; on 2-eigen the facet table also covers the linear Lagrange space used by the eigen solver. Agent-Harness: Claude Code 2.1.322 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
…a resonance The null-space cutoff is now relative to the model's spectrum scale only, and a target below it is raised to it, so gradient modes are rejected for any target. A shift that makes the factorisation exactly singular is nudged by 1e-8 relative and retried. The high-cutoff test passes the same cutoff through a spectrum-relative nullspace_tol. Agent-Harness: Claude Code 2.1.322 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
model.jl conflict resolved keeping both sides; on 2-eigen the linear Lagrange table is the shared facet node table. Agent-Harness: Claude Code 2.1.322 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
The global null-space cutoff and the shifted solve degrade with high material contrast (reproduced: mu_r = 1e-12 in half of a cavity returns modes near 6.7e5 where the lowest physical one is 0.75). No small robust fix exists, so a warning above a contrast of 1e6 and a docstring note. Agent-Harness: Claude Code 2.1.322 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
|
Review feedback on this PR has been addressed on head The high-contrast eigenmode limitation is reported as a warning and documented rather than fixed structurally in the gradient kernel. Items deliberately left as they are: reaction coefficients that are subnormal but representable are still rejected (conservative); coefficients that cancel to zero only up to roundoff are rejected rather than compared with a tolerance; the absorbing-boundary adjoint derivative uses 0 for the sigma term at omega = 0 although the true limit is finite and nonzero. 🤖 Posted by an AI agent · harness: Claude Code 2.1.322 · model: claude-sonnet-5-5 |
Independent review (Codex CLI v0.164.0 / gpt-6.1-sol), reviewer session 01a1ceeb-0406-7e70-997f-c9433d7120c8, reviewed head 4445f19
This is a blind code-only review by a session other than the PR author's, copied below from the reviewer's report with only the grading metadata removed. The posting agent did not re-run the reviewer's commands. A MERGE verdict is advice; merging is left to the maintainers. CI: green Riskmedium-low (ML7: additive public Maxwell model, driven solver, field evaluation and eigenmode API; existing entry points are unchanged). Recorded independently before reading the supplied previous-head review. Blocking findings
Both previous-round blockers are resolved: low targets reject static modes and the exactly resonant one-dof case succeeds. Non-blocking findingsNone. What I ranAll Julia jobs ran serially in memory-capped scopes with
What I did not verifyFull package/QA suites, documentation build, other Julia versions, and CI were not run or inspected; 🤖 Posted by an AI agent — harness: Claude Code 2.1.322 · model: claude-sonnet-5-5 |
The null-space cutoff doubled as the shift floor and was 1e-6 of the spectrum scale, so a model with strongly contrasting materials silently lost resolved physical modes below it. Static modes are now classified against sqrt(eps) of the spectrum scale (nullspace_tol overrides it), the shift keeps its own floor, and modes are ranked by distance from the requested target rather than the raised shift. Agent-Harness: Claude Code 2.1.322 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
|
Follow-up to the latest review on head Codex review of the branch approved with no open findings, and all named CI checks are green on this head. Merge commits only; no rebase or force-push. 🤖 Posted by an AI agent · harness: Claude Code 2.1.322 · model: claude-sonnet-5-5 |
Agent-Harness: Claude Code 2.1.322 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
The comparison used an internal Ferrite function; a linear Lagrange basis function is nonzero on a facet exactly at the facet's nodes. Agent-Harness: Claude Code 2.1.322 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Independent review (Codex CLI v0.164.0 / gpt-6.1-sol), reviewer session 01a1d11e-7381-7e90-905a-ca55c0821a7e, reviewed head 8618747
This is a blind code-only review by a session other than the PR author's, copied below from the reviewer's report with only the grading metadata removed. The posting agent did not re-run the reviewer's commands. A MERGE verdict is advice; merging is left to the maintainers. CI: green Riskmedium-low (ML7: additive, opt-in Maxwell model and solver API; existing package entry points are unchanged). Recorded before reading the explicitly supplied preceding-head review; no author rating was accessed. Blocking findings
None. The preceding review's silent omission at material contrast 200,000 is resolved on both Krylov and dense paths. The identical independent-reference probe fails on the preceding head and passes on this head. Non-blocking findings
What I ranReviewer: codex-cli 0.164.0, model gpt-6.1-sol, local session 01a1d11e-7381-7e90-905a-ca55c0821a7e (no session URL).
What I did not verifyFull package/QA suites, documentation build, other Julia versions, and CI execution were not independently run or inspected; 🤖 Posted by an AI agent — harness: Claude Code 2.1.322 · model: claude-sonnet-5-5 |
At a material contrast of 1e7 a resolved physical mode can lie below the default cutoff; an explicit smaller nullspace_tol recovers it. The docstring and the comment no longer claim that every resolved mode is kept. Agent-Harness: Claude Code 2.1.322 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
PR: #76 Reviewed head: 7726ae0 Risk assessment
Review reportVERDICT: CHANGES Riskmedium-low (ML7: additive, documented Maxwell public APIs; existing PDE implementations are untouched). Blocking findings
Non-blocking findingsNone. What I ran
What I did not verifyThe full package suite, QA group, documentation build, Julia 1.10/LTS and other platforms. Remote CI was not inspected; the AUTHOR_GRADE: {"task":"feature","score":3,"difficulty":4,"rounds":5,"author_harness":"Claude Code 2.1.322","author_model":"claude-sonnet-5-5","note":"All 166 affected tests pass, and independent accuracy probes support the driven and ordinary eigenmode paths. A targeted exact diagonal cavity probe reproducibly shows that Arnoldi can omit a repeated nearest resonance without warning."} Head link: 7726ae0 🤖 Posted by an AI agent — harness: codex-cli 0.164.0 · model: gpt-6.1-sol |
A Krylov space from one starting vector holds one vector per distinct eigenvalue, so a repeated nearest eigenvalue could be reported once, with a farther mode in its place and tiny residuals. After the first pass the search is restarted from vectors M-orthogonal to everything found, until a restart finds nothing nearer than the current nev-th mode (at most nev restarts). Agent-Harness: Claude Code 2.1.322 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
A restart asked for a fixed number of candidates, which can all lie below the static cutoff and then count as nothing nearer found. The widening loop of the first search is now a helper used by every restart pass, which only stops without survivors once the candidate budget is exhausted. Agent-Harness: Claude Code 2.1.322 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
The restart basis normalised by sqrt(v^T M v), which throws for a negative mass norm (lossless negative permittivity) and divides by a vanishing one. It now scales by sqrt(|s|), deflates with the biorthogonal pair (b, M b / sign), and falls back to the Euclidean projection for an isotropic vector. Agent-Harness: Claude Code 2.1.322 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
The restart basis mixed Euclidean and mass-form duals for isotropic vectors, which left earlier modes in the start vector, and divided by a vanishing transpose(w) w for complex ones. The projector x - B pinv(Bt M B) Bt M x has no orthonormalisation, square root or division: the rank-revealing pseudo-inverse absorbs indefinite, isotropic and dependent directions. A restart whose start vector deflates to nothing stops. Agent-Harness: Claude Code 2.1.322 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
PR: #76 Reviewed head: 4c9806f Risk assessment
Review reportVERDICT: MERGE Riskmedium-low (ML7: additive, documented Maxwell public APIs; existing PDE entry points are unchanged). Blocking findings
None. The round-five repeated-eigenvalue blocker is confirmed resolved by running the same exact-spectrum regression against both source revisions. No new blocker was found in the delta. Non-blocking findingsNone. What I ran
What I did not verifyFull package suite, QA, documentation build, Julia 1.10/LTS or other platforms. Remote CI was not inspected; its supplied non-green state remains a separate merge gate. This verdict is code-review advice. No checkout edits, fixes, commits, pushes or GitHub posts were made. AUTHOR_GRADE: {"task":"feature","score":4,"difficulty":4,"rounds":6,"author_harness":"Claude Code 2.1.322","author_model":"claude-sonnet-5-5","note":"All 181 affected tests and 90 targeted assertions pass. The identical exact-spectrum regression fails on the prior source and passes on this head; independent mode-rank and original-pencil residual checks support the deflated restart implementation. No delta blocker found; remote CI remains unverified and supplied as non-green."} Head link: 4c9806f 🤖 Posted by an AI agent — harness: codex-cli 0.164.0 · model: gpt-6.1-sol |
…ngle-assigned The helper assigned names that the enclosing function defines later (lambda, vecs, keep, dense) and the shift was reassigned after being captured, so both were boxed and JET reported them as possibly undefined, failing the QA group. They are now declared local and the shift is bound once. Agent-Harness: Claude Code 2.1.322 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
The gradient projection needs a definite mass form: with negative permittivity (for example half a cube at -1, half at 1) the potential Gram matrix can cancel to a singular one. A material with real(eps_r) <= 0 or mu_r <= 0 is rejected naming its cell sets; loss as Im(eps_r) stays supported. The negative-permittivity cavity regressions of the restart work become rejection tests. Agent-Harness: Claude Code 2.1.322 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
A parse error from the previous commit. Agent-Harness: Claude Code 2.1.322 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
PR: #76 Reviewed head: 24988ae Risk assessment
Review reportVERDICT: CHANGES Riskmedium-low (ML7: additive, documented Maxwell public API; existing entry points and defaults are unchanged). Blocking findings
Non-blocking findingsNone. What I ran
What I did not verify
AUTHOR_GRADE: {"task":"feature","score":3,"difficulty":5,"rounds":7,"author_harness":"Claude Code 2.1.322","author_model":"claude-sonnet-5-5","note":"The full Maxwell group passes 185 assertions and ordinary heterogeneous-pencil probes pass 60 assertions, but independent near-resonance probes expose inaccurate returned eigenpairs that the existing regression misses."} Head link: 24988ae 🤖 Posted by an AI agent — harness: codex-cli 0.164.0 · model: gpt-6.1-sol |
…k the pairs against the pencil A target on a discrete eigenvalue could still factorise, with a condition number of 1/eps that corrupted the other requested pairs (residuals up to 0.2 on a (3,3,3) cube) without a warning. The shift now moves up by a growing relative step until a solve-based condition estimate times eps is below 1e-8, and every returned pair is checked against K v = lambda M v and refined by inverse iteration, with a warning if it still exceeds the tolerance. A regression compares all four modes of the cube at targets on the first frequency and 1e-12, 1e-9 and 1e-6 off it with the dense eigensolve. Agent-Harness: Claude Code 2.1.322 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
PR: #76 Reviewed head: 62fe966 Risk assessment
Review reportVERDICT: CHANGES Riskmedium-low (ML7: additive, documented Maxwell public API; existing package entry points and defaults are unchanged). Blocking findings
Non-blocking findingsNone. What I ran
What I did not verify
AUTHOR_GRADE: {"task":"bugfix","score":3,"difficulty":4,"rounds":8,"author_harness":"Claude Code 2.1.322","author_model":"claude-sonnet-5-5","note":"The delta fixes the prior near-resonance accuracy failure and all 201 Maxwell assertions pass, but its real-part conversion silently collapses independent vectors at repeated eigenvalues; 16 targeted independence assertions fail and focused instrumentation confirms the cause."} Head link: 62fe966 🤖 Posted by an AI agent — harness: codex-cli 0.164.0 · model: gpt-6.1-sol |
A real shifted operator can return a complex-conjugate pair inside a repeated real eigenspace; taking the real part of each vector made them one vector, so fewer independent modes than requested came back without a warning (the first two modes of a (2,2,2) cube were identical). Per cluster of equal eigenvalues the real and imaginary parts are now orthonormalised in the mass form with a relative rank test, and as many independent real vectors as the cluster has replace them. Agent-Harness: Claude Code 2.1.322 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
PR: #76 Reviewed head: 26f468e Risk assessment
Review reportVERDICT: CHANGES Riskmedium-low (ML7: additive, documented Maxwell public API; existing package entry points and defaults are unchanged). Blocking findings
Non-blocking findingsNone. What I ran
What I did not verify
AUTHOR_GRADE: {"task":"bugfix","score":2,"difficulty":4,"rounds":9,"author_harness":"Claude Code 2.1.322","author_model":"claude-sonnet-5-5","note":"All 213 Maxwell assertions pass and exact prior examples improve, but the 112-case delta probe has 10 failures and one exception: nearly repeated modes still lose independent directions and requested frequencies, refinement introduces InexactError, and helper perturbation tests show roundoff amplification after residual checks."} Head link: 26f468e 🤖 Posted by an AI agent — harness: codex-cli 0.164.0 · model: gpt-6.1-sol |
…ector found The per-vector refinement, real-part conversion and per-cluster patches on a single Krylov chain left nearly repeated modes dependent, threw on a complex lossless Rayleigh quotient and could amplify imaginary roundoff. The modes are now the Ritz pairs of the pencil on the M-orthonormalised span of the real and imaginary parts of all candidates (a real symmetric small problem for lossless data, the complex symmetric pair for lossy), so they are real, independent and M-orthonormal by construction; pairs above the residual tolerance get shift-invert powers of their vectors added and then a warning, restarts deflate against the basis, and the shifted solve must be accurate to 1e-11. The deflator, the cluster basis and the inverse-iteration refinement are removed. Agent-Harness: Claude Code 2.1.322 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
PR: #76 Reviewed head: ae83adc Risk assessment
Review reportVERDICT: MERGE Riskmedium-low (ML7: additive, documented Maxwell public API; existing package entry points and defaults are unchanged). Blocking findings
None. The three prior blockers are resolved in the exercised cases: nearly repeated modes remain independent and match the nearest dense-reference frequencies; tight-tolerance lossless calls return successfully; final Ritz pairs meet the residual checks. Non-blocking findingsNone. What I ran
What I did not verifyOther test groups, QA, documentation build, supported Julia versions other than 1.13.2, dependency lower bounds, or performance. CI and deferred-issue state were not queried; “CI is not green” is supplied by the assignment. MERGE is the code-review recommendation, not confirmation that CI or merge-policy gates are satisfied. AUTHOR_GRADE: {"task":"bugfix","score":5,"difficulty":4,"rounds":10,"author_harness":"Claude Code 2.1.322","author_model":"claude-sonnet-5-5","note":"The joint Ritz extraction resolves all three reproduced prior blockers. All 221 Maxwell assertions, 180 end-to-end probe assertions and 18 corrected helper assertions pass; the previous source reproduces four failures and one exception. CI and performance remain unverified."} Head link: ae83adc 🤖 Posted by an AI agent — harness: codex-cli 0.164.0 · model: gpt-6.1-sol |
Depends on #74 (this PR targets its branch, so the diff shows only this layer; it will be retargeted to
masteronce #74 merges).Adds
maxwell_eigenmodes(model; nev, target_frequency), which returns the resonant modes of aMaxwellModelnearest a target frequency.Method
Kc u = λ (Mε' + i Mε'') uwithλ = ω² μ0 ε0 L²on the dofs off the PEC facets. The PEC dofs are eliminated, not constrained withapply!, so no artificial diagonal enters the spectrum.Kc − σ Mε(real when lossless, complex when lossy), then KrylovKit'seigsolveonu ↦ (Kc − σMε) \ (Mε u). Small problems, where the Krylov space would reach the number of free dofs, use a denseeigeninstead.ω = 0gradient null space of the edge elements is deflated: every Krylov vector is projected along the discrete gradients of the nodal hat functions, so any positive target works, including one below the lowest mode. One potential per connected PEC-free part of the mesh is dropped, which keeps the projection nonsingular without PEC; a mesh with no free potentials uses the identity. Gradient modes are recognised by their eigenvectors (the projection annihilates them), with|λ| < nullspace_tol·σas a backstop.|ω − ω_t|(the nearest frequency when lossless); enough candidates are computed to contain thenevnearest, using|λ − σ| ≤ scale·d·(2ω_t + d).(; frequency, Q, omega, modes), withQ = Re(ω) / (2 Im(ω))under theexp(+iωt)convention. The modes areMaxwellSolutions usable withfield_values.add_term!make the problem nonlinear in ω and are rejected; degenerate inputs (no free dofs,nevlarger than the physical space, non-finite target) raiseArgumentErrors.Dependency
KrylovKit is a weak dependency (
ext/FiniteElementMethodKrylovKitExt.jl, compat0.10; 0.9 cannot resolve next to LinearSolve's KrylovKit compat at the package's dependency floors). Without it, the function throws an error saying to runusing KrylovKit.Tests (Maxwell group)
PEC box 1 × 0.5 × 0.75 with c = 1: the first 15 analytic TE/TM modes, with multiplicities, match to 0.15% on the finest mesh (39k dofs), with observed rates 1.8–2.0 (O(h²)) over three meshes.
No spurious modes below the first physical mode.
A uniform ε_r = 2.2 fill scales the frequencies by 1/√2.2; with tan δ = 1e-3, Q = 1/tan δ within 1%.
An SI 100 × 50 × 75 mm box has its first mode at 2.498 GHz.
Eigenvectors satisfy the PEC trace and the residual of A(ω)u, and
field_valuesshows the TE101 profile.No-PEC meshes, fully constrained meshes, nearest-frequency selection, strong loss, a target on a resonance, and dense-versus-Krylov agreement.
QA (Aqua, JET) passes with the extension.
Docs: a short "Resonant modes" section in
docs/src/maxwell.md.Review pointers
Kc G = 0holding exactly on the free dofs; G is built per cell by a rounded least-squares fit of the Lagrange gradients onto the Nédélec basis, which is exact on affine tetrahedra with Ferrite's edge orientation.nullspace_tolbackstop catches those (untested).🤖 Posted by an AI agent · harness: Claude Code 2.1.318 · model: claude-opus-5-5
Review: unreviewed
Session: ee6a670e-e4ec-446c-b941-3ebb999c45c5