From 937a345fef7a7fbddb7c6b9d31690128c81489d1 Mon Sep 17 00:00:00 2001 From: Christopher Albert Date: Fri, 12 Jun 2026 21:54:53 +0200 Subject: [PATCH 1/2] Add export_boozer_chartmap app Restores a standalone entry point for boozer_converter's export_boozer_chartmap, which survived as a library routine but lost its CLI driver when the test-suite chartmap tooling was reorganized. As an app (not a test): reads field config from simple.in, builds the internal Boozer field via init_field exactly as a tracing run does, and writes the chartmap in the current rho+s schema (A_phi on the s abscissa). Enables a direct field-level comparison of SIMPLE's VMEC->Boozer transform against an external booz_xform chartmap. Usage: export_boozer_chartmap.x [config.in] --- CMakeLists.txt | 14 +++++++++ app/export_boozer_chartmap.f90 | 57 ++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 app/export_boozer_chartmap.f90 diff --git a/CMakeLists.txt b/CMakeLists.txt index 408aff29..583d2d8b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -468,6 +468,20 @@ set_target_properties(diag_albert.x PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_ set_target_properties(diag_newton.x PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) set_target_properties(diag_orbit.x PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) +# Boozer chartmap export tool +add_executable(export_boozer_chartmap.x + app/export_boozer_chartmap.f90 +) +target_compile_options(export_boozer_chartmap.x PRIVATE ${SIMPLE_COMPILE_OPTIONS}) +if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") + target_compile_options(export_boozer_chartmap.x PRIVATE + $<$:-Wtrampolines> + $<$:-Werror=trampolines> + ) +endif() +target_link_libraries(export_boozer_chartmap.x PRIVATE simple) +set_target_properties(export_boozer_chartmap.x PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) + # Ensure fortplot is built before diagnostics (when available) if(NOT CMAKE_Fortran_COMPILER_ID STREQUAL "NVHPC") add_dependencies(diag_meiss.x fortplot) diff --git a/app/export_boozer_chartmap.f90 b/app/export_boozer_chartmap.f90 new file mode 100644 index 00000000..81c32adc --- /dev/null +++ b/app/export_boozer_chartmap.f90 @@ -0,0 +1,57 @@ +program export_boozer_chartmap_app +!> Export SIMPLE's VMEC->Boozer transform as a Boozer chartmap NetCDF. +!> +!> Reads field configuration from simple.in (netcdffile, ns_s, ns_tp, +!> multharm, axis healing), builds the internal Boozer field exactly as a +!> tracing run does, and writes the chartmap in the current schema (rho and +!> s coordinates, A_phi on the s abscissa, B_theta/B_phi on rho, Bmod on the +!> rho/theta/zeta grid). Lets SIMPLE's own field be compared against an +!> external booz_xform chartmap on equal footing. +!> +!> Usage: export_boozer_chartmap.x [config.in] (default simple.in) + +use params, only: read_config, netcdffile, ns_s, ns_tp, multharm, & + integmode, params_init, isw_field_type +use simple, only: tracer_t +use simple_main, only: init_field +use boozer_sub, only: export_boozer_chartmap +use timing, only: init_timer, print_phase_time + +implicit none + +integer, parameter :: BOOZER_FIELD_TYPE = 2 +character(1024) :: out_file +character(256) :: config_file +type(tracer_t) :: norb + +call init_timer() + +if (command_argument_count() < 1) then + write(*, '(A)') 'Usage: export_boozer_chartmap.x [config.in]' + error stop 'missing output file argument' +end if +call get_command_argument(1, out_file) +if (command_argument_count() >= 2) then + call get_command_argument(2, config_file) +else + config_file = 'simple.in' +end if + +call read_config(config_file) +call print_phase_time('Configuration reading completed') + +if (isw_field_type /= BOOZER_FIELD_TYPE) then + write(*, '(A,I0)') 'ERROR: export_boozer_chartmap needs isw_field_type = 2 & + &(Boozer); got ', isw_field_type + error stop 'incorrect field type for Boozer chartmap export' +end if + +call init_field(norb, netcdffile, ns_s, ns_tp, multharm, integmode) +call params_init +call print_phase_time('Field initialization completed') + +call export_boozer_chartmap(out_file) +call print_phase_time('Chartmap export completed') +write(*, '(A)') 'Written '//trim(out_file) + +end program export_boozer_chartmap_app From d445674e882fac3f062e8b281d479e07371e4783 Mon Sep 17 00:00:00 2001 From: Christopher Albert Date: Sat, 13 Jun 2026 00:15:38 +0200 Subject: [PATCH 2/2] Expose axis_healing_power_law in the config namelist Forward the new libneo near-axis flags (axis_healing_power_law, rho_axis_heal) from new_vmec_stuff_mod into the /config/ namelist so a run can select the rho^|m| VMEC-harmonic regularization from simple.in. Depends on itpplasma/libneo#306. --- src/params.f90 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/params.f90 b/src/params.f90 index 00b9afa0..5e553963 100644 --- a/src/params.f90 +++ b/src/params.f90 @@ -3,6 +3,7 @@ module params use util, only: pi, c, e_charge, p_mass, ev use parmot_mod, only: ro0, rmu use new_vmec_stuff_mod, only: old_axis_healing, old_axis_healing_boundary, & + axis_healing_power_law, rho_axis_heal, & netcdffile, ns_s, ns_tp, multharm, vmec_B_scale, & vmec_RZ_scale use velo_mod, only: isw_field_type @@ -112,7 +113,8 @@ module params special_ants_file, integmode, relerr, tcut, nturns, debug, & class_plot, cut_in_per, fast_class, vmec_B_scale, & vmec_RZ_scale, swcoll, deterministic, old_axis_healing, & - old_axis_healing_boundary, am1, am2, Z1, Z2, & + old_axis_healing_boundary, axis_healing_power_law, rho_axis_heal, & + am1, am2, Z1, Z2, & densi1, densi2, tempi1, tempi2, tempe, & batch_size, ran_seed, reuse_batch, field_input, coord_input, & wall_input, wall_units, integ_coords, output_results_netcdf, &