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.0.tar.gz (18.9 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.0-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for bzx-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8b9a4b34cdcfb06af72456a8ac0343d33c7f347f44d307e6aa2c56e384eb1536
MD5 1bc725149f849c2a5956ee6ee13eed86
BLAKE2b-256 087bd5e6217a6f3a05d557374d28351acc6602077cf42d6f5c2415134224ecf8

See more details on using hashes here.

Provenance

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

File metadata

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

File hashes

Hashes for bzx-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 48d2de4a835b9449b5dfa0e5a1e3419b95bbb55b7abd90330e242923560c7e0e
MD5 bec0f61d1c66e70b557eee68f6b41b8b
BLAKE2b-256 51151bbb6d908286fa0df30ce2eb750dafc864179c33f3ea3963a91cb4438f38

See more details on using hashes here.

Provenance

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