Examples¶
The examples/ directory contains short scripts demonstrating typical tasks:
python_api.py: run VMEC++ from Python using a provided input file.python_api_input.py: build aVmecInputobject directly in Python.normal_run_and_hot_restart.py: perform a standard run and then hot restart.freeboundary_run_and_hot_restart.py: demonstrate free-boundary runs with hot restart.hot_restart_scaling.py: illustrate how boundary perturbations affect hot-restart iteration counts.compare_vmecpp_to_parvmec.py: compare VMEC++ results to a PARVMEC reference solution.plot_plasma_boundary.py: plot the outer plasma boundary withmatplotlib.visualize_magnetic_field.py: calculate the magnetic field and current density, and visualize withpyvista.mpi_finite_difference.py: compute finite-difference derivatives in parallel using MPI.simsopt_integration.py: minimal integration with SIMSOPT.simsopt_qh_fixed_resolution.py: reproduce SIMSOPT’s QH fixed resolution example.sample_hot_restarts_with_random_perturbations.py: explore restart sensitivity to small boundary perturbations.force_residual_convergence.py: plot convergence of force residuals during VMEC++ runs.fourier_resolution_increase.py: reach a high Fourier resolution by continuation, in fewer iterations than a fixed-resolution solve.watch_solve.py: draw the flux surfaces and the force residuals while VMEC++ converges, through the iteration callback ofvmecpp.run.self_consistent_bootstrap_current.py: make the enclosed current equal to SIMSOPT’s Redl bootstrap current during the solve, by changingstate.curr_hin the iteration callback ofvmecpp.run.w7x_lbsubs_current_density.py: compare the toroidal current density of W7-X withlbsubsoff and on.force_balance_spectrum.py: visualize force-residual Fourier coefficients and their real-space contributions.