Skip to content

Tearing - FEATURE - Add critical resonant field calculations to the tearing workflow - #415

Open
ebursch wants to merge 10 commits into
developfrom
feature/b_crit_calculation
Open

Tearing - FEATURE - Add critical resonant field calculations to the tearing workflow#415
ebursch wants to merge 10 commits into
developfrom
feature/b_crit_calculation

Conversation

@ebursch

@ebursch ebursch commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Release note

  • Audience: users
  • Numerical impact: none (harness @ c42d558)
  • Migration: none

Allows users to calculate the critical resonant field required for tearing at a rational surface. The model is based on the simple torque balance model in Cole and Fitzpatrick PoP 2006. Resolves issue #371. Main user input not already present in a Tearing.jl run is supplying viscosity information. This can be done either as angular momentum diffusivity or a direct magnetic Prandtl number. Other improvements in progress: #416

Regression report

================================================================
Case: diiid_n1 — DIII-D-like equilibrium, n=1, ideal + perturbed equilibrium

Regression Report: diiid_n1

Ref 1: develop @ c42d558 (2026-08-20)
env: julia 1.12.6, arm64-apple-darwin24.0.0, manifest 42ffd010 (pinned), 5 threads/5 BLAS
Ref 2: local @ local (2026-08-20)
env: julia 1.12.6, arm64-apple-darwin24.0.0, manifest 42ffd010 (pinned), 5 threads/5 BLAS

Quantity develop local Diff Status

total energy Re(et[1]) 8.013943e-01 8.013943e-01 0.0e+00 OK
total energy Im(et[1]) 1.233500e-04 1.233500e-04 0.0e+00 OK
plasma energy Re(ep[1]) -1.348114e+00 -1.348114e+00 0.0e+00 OK
vacuum energy Re(ev[1]) 2.149508e+00 2.149508e+00 0.0e+00 OK
vacuum matrix min eigenvalue 1.873975e-01 1.873975e-01 0.0e+00 OK
plasma energy (all) [35 elem] [35 elem] 0.0e+00 OK
vacuum energy (all) [35 elem] [35 elem] 0.0e+00 OK
total energy (all) [35 elem] [35 elem] 0.0e+00 OK
ODE steps (saved) 2655 2655 0.0e+00 OK
ODE steps (total) 4738 4738 0.0e+00 OK
q0 1.204212e+00 1.204212e+00 0.0e+00 OK
q95 4.781723e+00 4.781723e+00 0.0e+00 OK
beta_t 1.327024e-02 1.327024e-02 0.0e+00 OK
beta_n 1.372511e+00 1.372511e+00 0.0e+00 OK
internal inductance li1 8.842230e-01 8.842230e-01 0.0e+00 OK
internal inductance li2 7.080727e-01 7.080727e-01 0.0e+00 OK
internal inductance li3 7.304309e-01 7.304309e-01 0.0e+00 OK
poloidal beta betap1 6.680738e-01 6.680738e-01 0.0e+00 OK
poloidal beta betap2 5.349836e-01 5.349836e-01 0.0e+00 OK
poloidal beta betap3 5.518763e-01 5.518763e-01 0.0e+00 OK

singular surfaces 5 5 0.0e+00 OK

singular psi locations [5 elem] [5 elem] 0.0e+00 OK
singular q values [5 elem] [5 elem] 0.0e+00 OK
current beta betaj 4.236479e-01 4.236479e-01 0.0e+00 OK
plasma volume 1.829472e+01 1.829472e+01 0.0e+00 OK
plasma current 1.152130e+00 1.152130e+00 0.0e+00 OK
mpert 35 35 0.0e+00 OK
npert 1 1 0.0e+00 OK
toroidal field bt0 2.006573e+00 2.006573e+00 0.0e+00 OK
wall field bwall 3.880145e-01 3.880145e-01 0.0e+00 OK
aspect ratio 2.845746e+00 2.845746e+00 0.0e+00 OK
elongation kappa 1.708322e+00 1.708322e+00 0.0e+00 OK
q profile (checksum) ed7c21fd61df... ed7c21fd61df... identical OK
pressure profile (checksum) e15550827bf1... e15550827bf1... identical OK
Mercier D_I profile (checksum) 5a6fcb1c3a97... 5a6fcb1c3a97... identical OK
resistive interchange D_R profile (checksum) 6284a4c9a75a... 6284a4c9a75a... identical OK
ballooning Delta' profile (checksum) 44bf968c25d5... 44bf968c25d5... identical OK
island half-widths [5 elem] [5 elem] 0.0e+00 OK
Chirikov parameter [5 elem] [5 elem] 0.0e+00 OK
||resonant area-weighted field|| 5.207739e-04 5.207739e-04 0.0e+00 OK
PE plasma energy 3.422586e+00 3.422586e+00 0.0e+00 OK
PE vacuum energy 3.174509e+00 3.174509e+00 0.0e+00 OK
PE surface energy 5.841099e+00 5.841099e+00 0.0e+00 OK
PE toroidal torque -5.062793e-02 -5.062793e-02 0.0e+00 OK
NTV torque FGAR [N·m] 5.587060e-01 5.587060e-01 0.0e+00 OK
NTV kinetic energy dW FGAR [J] 6.903492e-02 6.903492e-02 0.0e+00 OK
Runtime (s) 242.4s 357.4s --
resonant area-weighted field b^r [5 elem] [5 elem] 0.0e+00 OK

Summary: 47 unchanged

Julia Torque Balance Output
image
Similar Fortran Torque Balance Output
image


@ebursch
ebursch requested review from d-burg and logan-nc August 20, 2026 18:50
@ebursch
ebursch enabled auto-merge (squash) August 20, 2026 18:53
@ebursch ebursch changed the title TEARING - NEW FEATURE - Add critical resonant field calculations to the tearing workflow TEARING - FEATURE - Add critical resonant field calculations to the tearing workflow Aug 20, 2026
@github-actions github-actions Bot added the feature New capability label Aug 20, 2026
@ebursch ebursch changed the title TEARING - FEATURE - Add critical resonant field calculations to the tearing workflow Tearing - Feature - Add critical resonant field calculations to the tearing workflow Aug 20, 2026
@ebursch ebursch changed the title Tearing - Feature - Add critical resonant field calculations to the tearing workflow Tearing - FEATURE - Add critical resonant field calculations to the tearing workflow Aug 20, 2026
@logan-nc

logan-nc commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Currently takes either an array or a scalar for all surfaces but will easily be updated to a true profile once I have angular momentum diffusivity profile data on hand to test with.

Sounds like this should be marked draft until this is done

This should perform as well as or better than the Fortran implementation.

"Should" is scary - benchmark it! There is a benchmark script for comparing to fortran - modify that for your needs (using scratch scripts - no need to commit run scripts)

Other improvements to the model and the numerical methods are in progress, but I wanted to have a working version available to users.

Mark this as draft until the IO and benchmarks are done then ping us for reviews. You can make a "Task" type issue describing future plans (and assign yourself) so we have it on record as work in progress.

@ebursch
ebursch marked this pull request as draft August 20, 2026 19:14
auto-merge was automatically disabled August 20, 2026 19:14

Pull request was converted to draft

@ebursch
ebursch marked this pull request as ready for review August 21, 2026 14:59
@ebursch

ebursch commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

@logan-nc @d-burg Should be ready for review now. Added profile inputs and a Fortran comparison plot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New capability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants