BZX is a Python package that transforms BOOZ_XFORM Boozer coordinate metrics into GKV field-aligned coordinates, enabling gyrokinetic analysis of VMEC equilibria.
To install from PyPI:
pip install bzxOr install the latest development version from GitHub:
pip install git+https://github.com/GKV-developers/bzx.gitIf your environment has any problems with installation, you can copy the single source script file bzx.py from the src/bzx/ directory and use it.
Prepare VMEC equilibrium output (e.g. wout.nc) and its BOOZ_XFORM output (e.g. boozmn.nc).
from bzx import bzx
# Define transformation parameters
Ntheta_gkv = 1 # N_theta value in GKV
nrho = 11 # Radial grid points
ntht = 64 # Poloidal grid points
nzeta = 0 # Toroidal grid points (nzeta=0 corresponds to output GKV field-aligned coordinates)
alpha_fix = 0.0 # Field-line label: alpha = zeta - q*theta (not used for nzeta > 0)
# Run BZX transformation
bzx(Ntheta_gkv, nrho, ntht, nzeta, alpha_fix,
fname_boozmn="boozmn.nc", fname_wout="wout.nc",
output_file="./metric_boozer.bin.dat")- Reads VMEC output file (
wout.nc) and BOOZ_XFORM output file (boozmn.nc). NetCDF format is recommended, but Binary format is also acceptable. - Converts them into field-aligned data and saves the result as GKV input binary file (
metric_boozer.bin.dat).
The script examples/run_vmecpp_boozxform_bzx.ipynb demonstrats how to use BZX, starting from generating an equilibrium.
-
Step 1: Compute a MHD equilibrium using VMEC++
- About VMEC++ :
-
Step 2: Convert the VMEC output to Boozer coordinates using BOOZ_XFORM
- About BOOZ_XFORM :
-
Step 3: Convert the BOOZ_XFORM output to GKV coordinates using BZX
- This project.
After installation, you can use BZX directly as a CLI tool in a terminal, e.g.,
python -m bzx --Ntheta_gkv 1 --nrho 11 --ntht 64 \
--nzeta 0 --alpha_fix 0.0 \
--fname_boozmn "boozmn.nc" --fname_wout "wout.nc" \
--output_file "./metric_boozer.bin.dat"All arguments of bzx function is specified by keyword arguments. See also help.
python -m bzx --helpBZX requires the following Python packages:
numpy,scipy,xarray- (Optional)
matplotlibfor visualization inexamples/ - (Optional)
booz_xformforexamples/run_vmecpp_boozxform_bzx.py - (Optional)
vmecppforexamples/run_vmecpp_boozxform_bzx.py
This project is licensed under the MIT License. See the LICENSE file for details.
Developed by Shinya Maeyama (maeyama.shinya@nifs.ac.jp)