Repository navigation
DESC and near-axis fields; full orbits in toroidal fields - #149
Closed
rogeriojorge wants to merge 1 commit into
Closed
rogeriojorge wants to merge 1 commit into
rogeriojorge wants to merge 1 commit into
Conversation
DescField evaluates a DESC equilibrium as DESC writes it: Fourier-Zernike series for R, Z and lambda (Jacobi recurrence), iota tabulated on 1025 radii with cubic Hermite interpolation, and B^theta, B^phi from the toroidal flux, lambda and iota. On precise QA it matches DESC's own B to 4e-13 (2e-9 at 2.5% beta). from_desc reads a DESC Equilibrium or file, or the .npz that save writes, which needs no DESC install. NearAxisField traces a pyQSC_JAX near-axis field in its Boozer coordinates with the expansion's own components, |B| and Jacobian; to_xyz is first order like the field. Full orbits move in Cartesian space, so Tracing now traces full-orbit models in a toroidal field through field.cartesian() (B at Cartesian points), from the Cartesian position of each guiding center. Before, the Lorentz force read (s, theta, phi) as (x, y, z). The minor radius from the boundary cross-sections moves to ToroidalField, shared by MRXField and DescField.
Member
Author
|
Split into focused PRs, each reviewable on its own:
|
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.
Stacked on #146. It adds DESC and near-axis fields, and full orbits in toroidal fields, so every ESSOS model runs on coils, permanent magnets, VMEX/VMEC, MRX and DESC.
DescField(ToroidalField)A DESC equilibrium, evaluated as DESC writes it:
B^theta = Psi (iota - d_phi lambda) / (2 pi sqrt(g))andB^phi = Psi (1 + d_theta lambda) / (2 pi sqrt(g)).The field is exact on the axis.
DescField.from_desctakes a DESCEquilibrium, a DESC output file, or the.npzthatsavewrites. Reading the.npzneeds no DESC install, which helps because DESC pinsjax < 0.10.Against DESC's own
computeat 500 random points:NearAxisField(MagneticField)A first-order pyQSC_JAX near-axis field in its Boozer coordinates (r, theta, varphi). It uses the expansion's own covariant and contravariant components, |B| and Jacobian.
to_xyzmaps through the axis's Frenet frame and is first order like the field:|e_i B^i| / |B| - 1is 1% at r = 0.01 and 7% at r = 0.1.(r, theta) is singular on the axis, so orbits must stay off it. Full orbits are refused with a clear error, because the field has no inverse map to Cartesian points.
Full orbits in toroidal fields
Before this PR,
FullOrbit*models with a VMEC field read (s, theta, phi) as (x, y, z). Now, for aToroidalField:Tracingmaps each guiding-center start throughto_xyz;field.cartesian(), a Cartesian view built onB_xyz;Every model on every field
Run on Landreman-Paul QA where available. Settings:
PointDipoleField)B_i B^idiffers from|B|^2by 1.4% at r = 0.04. With random pitch, one of the 8 orbits reached the axis and the error grew to 0.34.Tests
tests/test_fields.py:DescField: covariant and contravariant consistency, zero divergence, Hermite iota, the.npzround trip;The DESC comparisons against DESC itself ran in a DESC environment.