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.1.tar.gz (19.8 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.1-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bzx-0.1.1.tar.gz
  • Upload date:
  • Size: 19.8 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.1.tar.gz
Algorithm Hash digest
SHA256 cdde6dc2b4d47b7d9b0e3156bf538dd5acb3ec1fe5212e80a6c1529e0ed5c537
MD5 7f63c541d5c6dee723cf6e62344b2d64
BLAKE2b-256 5033ed33efb7c09f34eb8f94ff98054dace4dc815f9792b801f115ca8c291a53

See more details on using hashes here.

Provenance

The following attestation bundles were made for bzx-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: bzx-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.9 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2f00313e07debcc7e4208577b3b60595a922a908eaf8466dc05c6fec52e628bc
MD5 a61b7db67383fe45bf6829e1a0950af0
BLAKE2b-256 ea5ce09d02cd2e82208efc67ab3a173d827df47395ffd97e1ee35382cab7bbc0

See more details on using hashes here.

Provenance

The following attestation bundles were made for bzx-0.1.1-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