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.
-
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.
(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)
matplotlibfor visualization inexamples/ - (Optional)
booz_xformforexamples/run_vmecpp_boozxform_bzx.py - (Optional)
vmecppforexamples/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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b9a4b34cdcfb06af72456a8ac0343d33c7f347f44d307e6aa2c56e384eb1536
|
|
| MD5 |
1bc725149f849c2a5956ee6ee13eed86
|
|
| BLAKE2b-256 |
087bd5e6217a6f3a05d557374d28351acc6602077cf42d6f5c2415134224ecf8
|
Provenance
The following attestation bundles were made for bzx-0.1.0.tar.gz:
Publisher:
publish-to-pypi.yml on GKV-developers/bzx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bzx-0.1.0.tar.gz -
Subject digest:
8b9a4b34cdcfb06af72456a8ac0343d33c7f347f44d307e6aa2c56e384eb1536 - Sigstore transparency entry: 184101518
- Sigstore integration time:
-
Permalink:
GKV-developers/bzx@fdcd1ba1917e0904244f12fa558606832821873d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/GKV-developers
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@fdcd1ba1917e0904244f12fa558606832821873d -
Trigger Event:
workflow_dispatch
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48d2de4a835b9449b5dfa0e5a1e3419b95bbb55b7abd90330e242923560c7e0e
|
|
| MD5 |
bec0f61d1c66e70b557eee68f6b41b8b
|
|
| BLAKE2b-256 |
51151bbb6d908286fa0df30ce2eb750dafc864179c33f3ea3963a91cb4438f38
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bzx-0.1.0-py3-none-any.whl -
Subject digest:
48d2de4a835b9449b5dfa0e5a1e3419b95bbb55b7abd90330e242923560c7e0e - Sigstore transparency entry: 184101519
- Sigstore integration time:
-
Permalink:
GKV-developers/bzx@fdcd1ba1917e0904244f12fa558606832821873d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/GKV-developers
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@fdcd1ba1917e0904244f12fa558606832821873d -
Trigger Event:
workflow_dispatch
-
Statement type: