Skip to content

Zeff profile support - #296

Merged
matt-pharr merged 4 commits into
developfrom
Zeff_profile_support
Oct 15, 2026
Merged

matt-pharr merged 4 commits into
developfrom
Zeff_profile_support

Conversation

@StuartBenjamin

@StuartBenjamin StuartBenjamin commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Lets RDCON's modified Rutherford equation (MRE) terms use a radial Zeff profile. Before, mufrac used one scalar Zeff on every surface.

Contains #295 (vacuum matrix in the plasma's Fourier frame), which should be merged first.

Changes

  • &RDCON_CONTROL takes Zeff and psi_N_Zeff as arrays of up to 999 points. The new read_var_len (equil/local.f) copies the given entries into allocatable arrays.
  • With MRE_flag, mercier.f splines Zeff(ψ_N) and evaluates it on each surface for mufrac.
  • Without psi_N_Zeff, a single Zeff value, or no Zeff (then 1.52, the old default), gives a flat profile, so existing inputs run as before.
  • Zeff and psi_N_Zeff must have equal lengths and at least 4 points (the "extrap" spline end condition). Shorter tables used to give NaN and now stop with a message.
  • The rdcon netCDF stores Zeff and psi_N_Zeff as global attributes when MRE_flag is set. Without MRE_flag it no longer writes a Zeff attribute.
  • docs/examples/DIIID_resistive_example/rdcon.in sets MRE_flag and geom_flag to f.

Tests

RDCON with MRE_flag = t on a 513-surface TokaMaker i-file, compared with develop:

rdcon.in Result
no Zeff mufrac, Dnc match develop to 3e-9 (develop's default 1.52 was a single-precision literal)
Zeff = 2.0 match develop to 1e-16
Zeff = 2.0 ×4, psi_N_Zeff = 0, 0.3, 0.7, 1 same as Zeff = 2.0 to 3e-16
2-point table stops with "Zeff, psi_N_Zeff: equal sizes, >= 4" (was NaN)

The GPEC build and the install tests pass, apart from the known a5_tearing STRIDE failure, which this PR does not cause.


🤖 Generated with Claude Code

…fore

With MRE_flag, a run whose rdcon.in has no psi_N_Zeff stopped ("Provide Zeff profile values"),
where develop used the scalar Zeff (default 1.52). One Zeff value, or none, without psi_N_Zeff
now gives a flat profile at that value, matching develop (mufrac to 1e-16 with Zeff = 2.0; 1e-9
with the default, which develop held in single precision). The profile spline's "extrap" end
condition needs 4 nodes, so shorter tables, which gave NaN, now stop with a message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@StuartBenjamin

StuartBenjamin commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator Author

New commit 6eda483e: MRE runs without a Zeff table use a flat Zeff, as before.

With MRE_flag = t, an rdcon.in that gives no psi_N_Zeff used to stop with "Provide Zeff profile values". On develop the same input ran with the scalar Zeff (default 1.52), so older input files broke.

  • One Zeff value without psi_N_Zeff, or no Zeff at all (then 1.52), now gives a flat profile at that value.
  • The profile spline's "extrap" end condition reads 4 nodes. Tables with fewer points used to give NaN in mufrac and Dnc without any error, so they now stop with "Zeff, psi_N_Zeff: equal sizes, >= 4". The separate pchip PR fits the Zeff table with pchip, which handles 2 or more points, and relaxes this check to 2.

Tests (RDCON on a 513-surface TokaMaker i-file, MRE_flag = t):

rdcon.in Result
no Zeff runs; mufrac, Dnc match develop to 1e-9 (develop's default 1.52 was a single-precision literal)
Zeff = 2.0 runs; mufrac, Dnc match develop to 1e-16
Zeff = 2.0 ×4, psi_N_Zeff = 0, 0.3, 0.7, 1 identical to Zeff = 2.0
2-point table stops with the message above (was NaN)

🤖 Generated with Claude Code

@matt-pharr matt-pharr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I made the few tweaks here that are relevant.

@matt-pharr
matt-pharr merged commit a07f42e into develop Oct 15, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants