Repository navigation
Conversation
…(eq_type = "cerfon") Adds a diverted generalization of the Solovev analytic model: the Solov'ev source Δ*ψ̂ = (1−A)x² + A is solved with a particular solution plus the twelve-term homogeneous basis, and point-wise conditions on the ψ̂ = 0 surface place a magnetic null on the plasma boundary. Because |∇ψ| vanishes at that null, q diverges logarithmically as ψ_N → 1, so no choice of psihigh converges — the equilibrium exists to expose truncation sensitivity that the limited Solovev fixture (finite q_edge) cannot. The existing "sol" model is the A = 0, no-null member of the same family. Topologies: "lsn" (lower single null) imposes ε, κ and δ exactly; "dn" (double null) has two nulls on the boundary and its q climbs about twice as fast. Measured end to end through the field-line integration at q0 = 1.1: q_edge rises 0.232 per decade of (1 − psihigh) for the single null and 0.448 for the double null. No snowflake topology is offered. An exact second-order null additionally forces the Grad-Shafranov source to vanish at the null, pinning it to the surface where the toroidal current density reverses sign; the closed flux surfaces then detach from it entirely. A snowflake-minus does solve and shapes well, but its near-separatrix surfaces are not star-shaped about the axis and the ray-Newton tracer in direct_fieldline_int fails on them. Both findings are recorded in the cerfon_solve_coeffs docstring. Includes examples/Cerfon_diverted_example, a regression-harness case, and tests covering Δ*ψᵢ = 0 for the basis, every hand-coded derivative against finite differences, the boundary conditions on the solved coefficients, and the q divergence law. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…ion F(psi) `cerfon_run` tabulated F² = F_edge² − 2APψ/R₀² where matching Δ*ψ = −μ₀R²p′ − FF′ against the Solov'ev source gives F² = F_edge² − 2CAψ/R₀² with C = −P, i.e. **+**2APψ/R₀². The two halves of the module disagreed: `cerfon_flux_scale` derives the flux scale from the correct form, while the profile table used the opposite sign. The flux map, plasma shape, null placement and q divergence were all unaffected — which is why nothing caught it. What was wrong is that the tabulated F did not reproduce the source of the flux map it was paired with, leaving a 19-46% Grad-Shafranov residual, and the sign of the diamagnetic correction was inverted (the equilibrium read as paramagnetic for A < 0). Fixing it also removes a 3% offset in the realized on-axis q that had been attributed to spline error: q0 now lands at 1.1000 against a requested 1.1, where it previously came out 1.1337 (LSN) and 1.1309 (DN). q at the truncation surface is unchanged, since F → F_edge there regardless of the sign, so the divergence rates of 0.232 and 0.448 per decade stand. Adds the Grad-Shafranov residual test that catches this class of error directly — the flux map and the profiles tabulated alongside it must satisfy the same equation. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
B0 is a pure similarity scaling at fixed q0: psi and j_phi scale with B0, p scales with B0², and beta_t, beta_N and the whole q profile are invariant (verified across B0 = 1, 2, 4 T, where I_p/(a·B0) = 2.0413 identically). So this moves the absolute scale of the example into a more device-like range without touching any normalized result or the truncation behaviour the deck exists to exercise. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…d operating point The deck previously sat at q0 = 1.1, which is n=1 unstable both with and without a wall (dW = -11.03 no wall, -2.32 with the conformal wall at a = 0.25). q0 = 1.5 is stable with the wall and unstable without it (dW = -5.98 plasma, +9.89 vacuum, +3.92 total), so the shipped fixture now exercises wall stabilization with real margin rather than sitting on the unstable branch. A scan of the wall gap puts the ideal-wall limit at a ~ 0.46, so the deck's a = 0.25 is at roughly half the critical gap. The verdict is robust to truncation over psihigh = 0.99 to 0.9999, unlike the with-wall stability threshold in q0 itself, which moves with psihigh because it tracks when the q = 3 surface crosses inside. That sensitivity is the fixture working as intended; picking an operating point well away from the threshold keeps the regression signal clean. Also corrects the header's "q at the edge" to "q at the truncation surface". On this equilibrium q at psi_N = 1 is infinite by construction and never reached, so the old wording invited exactly the wrong reading of every number the deck produces. The quoted divergence rate is updated to the measured q0 = 1.5 values: +0.314 per decade for the single null and +0.607 for the double null. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…e cerfon_run's profile table The previous residual test retyped the mu0*p' and FF' formulas inside the test and never called cerfon_run, so it could not catch a sign error in the tabulated F^2. The test now builds the equilibrium with cerfon_run, differentiates the F and mu0*p columns of its sq_in table in psi_N, and checks Delta*psi (evaluated analytically from cerfon_grad and cerfon_hessian) against -mu0 R^2 p' - FF' at four interior points, each asserted to lie inside the plasma (0 < psi_N < 1). The relative bound is unchanged at 1e-5. Also asserts that the realized on-axis q matches the requested q0 (rtol 1e-3, the bound runtests_tj_analytic.jl uses) for both lsn and dn, replaces the tautological null-point check with a sign check on the null's height, uses the config's A instead of a hardcoded -0.155, and drops the unused Printf import. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s-search controls - One cerfon_null_point returns (1 - xsep*delta*eps, +/-xsep*kappa*eps) with the sign set by the null type; cerfon_shape_points no longer carries a second copy whose ynull was positive even for the lower single null. The null x is now computed directly rather than through cos(pi/2 + asin(delta)), so it can differ in the last bit. - Names the axis-search and conditioning literals (scan size, Newton cap and step tolerance, Hessian floor, condition-number warning) without changing their values; the Newton step cap is derived from the scan size instead of a separate /80. - cerfon_solve_coeffs validates the null type itself and asserts all 12 rows are set. - cerfon_psihat evaluates the basis once per call instead of once per term. - Fills sq_in column 4 with sqrt(psi_N), as the DirectRunInput docstring specifies. - Shortens the snowflake note to one sentence, corrects the F^2 comment in cerfon_run, and documents the box_margin limitation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…se an ill-conditioned boundary-condition solve The CERFON_INPUT key a_solovev is Cerfon & Freidberg's A (the FF' fraction of the Solov'ev source), not a minor radius; it is now A in CerfonConfig, the example deck and the tests. Clean break: the old key is rejected. A boundary-condition matrix with cond > CERFON_BC_COND_MAX (1e12, unchanged) is now an error instead of a warning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
This pull request is missing a reviewer. If you are not ready to name them, mark this pull request as a draft. |
…idberg-equilibrium
… Cerfon direct input DirectRunInput gained ip_sign after this branch was written, so cerfon_run's positional call was one argument short once merged with develop. Analytic equilibria use +1 for both signs, as the Solovev model does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tity Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Release note
eq_type. (harness @ e65792b)Adds the Cerfon-Freidberg diverted analytic equilibrium,
eq_type = "cerfon", a generalization of the Solovev model with a magnetic null on the plasma boundary (lower single null or double null). Because q diverges logarithmically as ψ_N → 1, nopsihighconverges, which makes it a fixture for truncation sensitivity that the limited Solovev case cannot provide.Regression report
regress --cases cerfon_lsn_n1,diiid_n1,solovev_n1 --refs cb18e386e,e65792bb1 --forceon feynman (SLURM, 8 threads; current develop vs head after merging develop, both fresh, manifest pinned).diiid_n1: 53 unchanged.solovev_n1: 22 unchanged.cerfon_lsn_n1(new in this PR): runs on the branch and extracts its 20 quantities. It has no develop baseline, because develop has noexamples/Cerfon_diverted_example.test/runtests_cerfon.jl: 365/365.diiid_n1solovev_n1Notes for reviewers
CERFON_INPUTkey for Cerfon & Freidberg's A isA. An ill-conditioned boundary-condition solve is an error.EQUILarea; they will be retagged at squash.465216bfa).DirectRunInputhad gained a plasma-current sign field since the branch was written;cerfon_runnow passes+1, as the Solovev model does.NO MERGE WITHOUT HUMAN REVIEW. This PR is a draft and needs a named human reviewer before it can be considered for merge.
🤖 Generated with Claude Code