Skip to content

POTATO: link libneo instead of symlinking a sibling checkout - #161

Draft
krystophny wants to merge 11 commits into
mainfrom
feature-backup
Draft

POTATO: link libneo instead of symlinking a sibling checkout#161
krystophny wants to merge 11 commits into
mainfrom
feature-backup

Conversation

@krystophny

Copy link
Copy Markdown
Member

This draft PR publishes the existing committed state of feature-backup so the local branch/worktree can be retired after review.

Checks were not run in this cleanup operation; the branch-specific CI should provide validation.

krystophny and others added 11 commits June 22, 2026 16:59
Add the orbit-side support for guiding-center bananas whose tips cross the
last closed flux surface, complementing the libneo field_eq_mod::allow_sol
flag.

- potato.in gains edge_extension (default .false.); tt.f90 sets allow_sol
  from it, so orbits may enter the scrape-off layer in the extended
  equilibrium field.
- New itest_type=4 single-orbit trace: starts one guiding-center orbit from
  (orbit_Rstart, orbit_Zstart) with pitch orbit_lambda and integrates it over
  one bounce via find_bounce with write_orb, writing the trajectory to fort.100.
  This is the minimal check that an edge banana now closes (ierr=0).
- CMakeLists: drop the global -std=f2008/-Wfatal-errors, which leaked into the
  fetched fortplot (needs F2018 assumed-rank) and vode (legacy DO termination),
  breaking the build. The deps now compile with the default standard; POTATO
  sources are unaffected.
Scan freq_n midplane start radii from freq_Rmin to freq_Rmax at fixed pitch
orbit_lambda; at each, trace one bounce via find_bounce and record the bounce
frequency omega_b = 2 pi v0 / taub and toroidal precession omega_phi =
delphi v0 / taub against the flux label rho_pol (from psi at the start point).
Writes freq_scan.dat. With edge_extension the scan extends across the
separatrix into the near-SOL where banana tips still turn.

This is the POTATO side of the rung-2 frequency benchmark against thin-orbit
NEO-RT.
test_freq_scan loops the flux surface s, calling neort init at each, and writes
the bounce frequency Om_th and toroidal precession Om_ph at fixed pitch
(eta = (1-lambda^2)/Bmin, i.e. v_par/v=0.4 at the midplane) and fixed energy
(10 keV D) to freq_scan_neort.dat, with E x B set to zero. This is the
thin-orbit reference curve compared against POTATO itest_type=5.
Emit iota per surface so the rho_pol map can be built from NEO-RT's own
q (q = 1/iota) instead of a gfile q-profile, and densify the scan to 60
flux surfaces for a smoother edge curve.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…OTATO resonance work

# Conflicts:
#	POTATO/CMakeLists.txt
#	POTATO/SRC/CMakeLists.txt
Root m*Omega_b + n*Omega_phi = 0 instead of the equivalent Delta_phi_b + 2pi m/n
= 0.  Same roots (loss-free), but Omega_b = 2pi/tau_b and Omega_phi = Delta_phi_b
/tau_b stay finite at the trapped-passing separatrix where tau_b, Delta_phi_b
diverge, so the interpolation grid converges instead of exploding.  Foundation
for the log-factored spline that removes the residual infinite-slope cost.
Mark non-closing orbits Omega_b=0 and clip the class endpoint to the closing
boundary x_sep (bisection, only X-point classes whose endpoint does not close).
Removes the closing->non-closing discontinuity that made the adaptive grid
refine without end, keeping all closing orbits (low-v and high-m alike, no
tau cap).  Correct (0 fake roots) but the boundary search integrates the slow
near-X-point orbits to the cap -- a follow-up will detect the grazing
geometrically from the banana-tip flux instead of by integration.
POTATO/SRC carried relative symlinks (../../../libneo/src/...) into a
sibling libneo working copy for its field, magfie, spline and
kinds/constants sources, tying the build to a machine-specific path and
an unpinned, ad-hoc libneo state.

Replace them with find_or_fetch(libneo); link LIBNEO::magfie (pulls in
the neo core) plus mc_efit for chamb_divB0. binsrc and plag_coeff stay
local: POTATO calls them as bare external subroutines, whereas libneo
wraps them in *_sub modules.

Scope -std=f2018, -Wfatal-errors and -cpp to POTATO's own targets so the
fetched libneo, fortplot and fortnum build under their own standards;
-cpp in particular makes CMake mis-parse libneo's free-form .f90. Keep
-O3 -march=native global so libneo's field hot path stays optimized.

All four executables build and link; potato.x classifies orbits and
computes bounce frequencies, matching the prior output to ~1e-5 (libneo's
-ffast-math vs POTATO's plain -O3).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant