Skip to main content

A Python package for BOOZ_XFORM output to GKV input

Project description

BZX - Boozer to GKV Coordinate Transformations


BZX is a Python package that transforms BOOZ_XFORM Boozer coordinate metrics into GKV field-aligned coordinates, enabling gyrokinetic analysis of VMEC equilibria.

Installation

To install from PyPI:

pip install bzx

Or install the latest development version from GitHub:

pip install git+https://github.com/GKV-developers/bzx.git

If 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.

Usage

(i) Basic usage: Convert to GKV input file using BZX

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).

(ii) Example of workflow: From VMEC to GKV via BOOZ_XFORM and BZX

The script examples/run_vmecpp_boozxform_bzx.ipynb demonstrats how to use BZX, starting from generating an equilibrium.

(iii) As a command line tool

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 --help

Dependencies

BZX requires the following Python packages:

  • numpy, scipy, xarray
  • (Optional) matplotlib for visualization in examples/
  • (Optional) booz_xform for examples/run_vmecpp_boozxform_bzx.py
  • (Optional) vmecpp for examples/run_vmecpp_boozxform_bzx.py

License

This project is licensed under the MIT License. See the LICENSE file for details.

Author

Developed by Shinya Maeyama (maeyama.shinya@nifs.ac.jp)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bzx-0.1.2.tar.gz (20.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bzx-0.1.2-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file bzx-0.1.2.tar.gz.

File metadata

  • Download URL: bzx-0.1.2.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bzx-0.1.2.tar.gz
Algorithm Hash digest
SHA256 77782d0959b7e7ea5403ec34911b7b466a54e081702d107cea0b81b035a84beb
MD5 19bd334e5ec47479ede798cec1c3ea81
BLAKE2b-256 a6fd967811ed44f7d52d5e6ba8bc0cd10bd9884220b49cc5d7fd7bde41201f17

See more details on using hashes here.

Provenance

The following attestation bundles were made for bzx-0.1.2.tar.gz:

Publisher: publish-to-pypi.yml on GKV-developers/bzx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bzx-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: bzx-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 17.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bzx-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 be6e06075db37b5f685bc18a1a4aab38c82c0b53522f3f5f177287394c2dcdd6
MD5 91b61f1965e3cc1ba0a016d5d7cf286b
BLAKE2b-256 0e791033a0681c8113e6d22d282cdaab1ce68a626269bbdfbdbc184d64fdf927

See more details on using hashes here.

Provenance

The following attestation bundles were made for bzx-0.1.2-py3-none-any.whl:

Publisher: publish-to-pypi.yml on GKV-developers/bzx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page