bzx 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bzx-0.1.0/LICENSE +21 -0
- bzx-0.1.0/PKG-INFO +103 -0
- bzx-0.1.0/README.md +87 -0
- bzx-0.1.0/pyproject.toml +32 -0
- bzx-0.1.0/setup.cfg +4 -0
- bzx-0.1.0/src/bzx/__init__.py +3 -0
- bzx-0.1.0/src/bzx/__main__.py +2 -0
- bzx-0.1.0/src/bzx/bzx.py +1929 -0
- bzx-0.1.0/src/bzx.egg-info/PKG-INFO +103 -0
- bzx-0.1.0/src/bzx.egg-info/SOURCES.txt +12 -0
- bzx-0.1.0/src/bzx.egg-info/dependency_links.txt +1 -0
- bzx-0.1.0/src/bzx.egg-info/requires.txt +7 -0
- bzx-0.1.0/src/bzx.egg-info/top_level.txt +1 -0
- bzx-0.1.0/tests/test_bzx.py +54 -0
bzx-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Shinya Maeyama
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
bzx-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: bzx
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A Python package for BOOZ_XFORM output to GKV input
|
|
5
|
+
Author-email: Shinya Maeyama <maeyama.shinya@nifs.ac.jp>
|
|
6
|
+
License: MIT License
|
|
7
|
+
Requires-Python: >=3.7
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: numpy>=1.23
|
|
11
|
+
Requires-Dist: scipy>=1.15
|
|
12
|
+
Requires-Dist: xarray>=2022.3
|
|
13
|
+
Provides-Extra: examples
|
|
14
|
+
Requires-Dist: matplotlib>=3.5; extra == "examples"
|
|
15
|
+
Requires-Dist: booz_xform>=0.0.8; extra == "examples"
|
|
16
|
+
|
|
17
|
+
# BZX - Boozer to GKV Coordinate Transformations
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
**BZX** is a Python package that transforms **BOOZ_XFORM** Boozer coordinate metrics into **GKV** field-aligned coordinates, enabling gyrokinetic analysis of **VMEC** equilibria.
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
To install from PyPI:
|
|
26
|
+
```bash
|
|
27
|
+
pip install bzx
|
|
28
|
+
```
|
|
29
|
+
Or install the latest development version from GitHub:
|
|
30
|
+
```bash
|
|
31
|
+
pip install git+https://github.com/GKV-developers/bzx.git
|
|
32
|
+
```
|
|
33
|
+
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.
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
#### **(i) Basic usage: Convert to GKV input file using BZX**
|
|
38
|
+
Prepare **VMEC** equilibrium output (e.g. `wout.nc`) and its **BOOZ_XFORM** output (e.g. `boozmn.nc`).
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
from bzx import bzx
|
|
42
|
+
|
|
43
|
+
# Define transformation parameters
|
|
44
|
+
Ntheta_gkv = 1 # N_theta value in GKV
|
|
45
|
+
nrho = 11 # Radial grid points
|
|
46
|
+
ntht = 64 # Poloidal grid points
|
|
47
|
+
nzeta = 0 # Toroidal grid points (nzeta=0 corresponds to output GKV field-aligned coordinates)
|
|
48
|
+
alpha_fix = 0.0 # Field-line label: alpha = zeta - q*theta (not used for nzeta > 0)
|
|
49
|
+
|
|
50
|
+
# Run BZX transformation
|
|
51
|
+
bzx(Ntheta_gkv, nrho, ntht, nzeta, alpha_fix,
|
|
52
|
+
fname_boozmn="boozmn.nc", fname_wout="wout.nc",
|
|
53
|
+
output_file="./metric_boozer.bin.dat")
|
|
54
|
+
```
|
|
55
|
+
- Reads **VMEC output file (`wout.nc`)** and **BOOZ_XFORM output file (`boozmn.nc`)**. NetCDF format is recommended, but Binary format is also acceptable.
|
|
56
|
+
- Converts them into field-aligned data and saves the result as **GKV input binary file (`metric_boozer.bin.dat`)**.
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
#### **(ii) Example of workflow: From VMEC to GKV via BOOZ_XFORM and BZX**
|
|
60
|
+
The script [`examples/run_vmecpp_boozxform_bzx.ipynb`](examples/run_vmecpp_boozxform_bzx.ipynb) demonstrats how to use **BZX**, starting from generating an equilibrium.
|
|
61
|
+
|
|
62
|
+
- Step 1: Compute a MHD equilibrium using **VMEC++**
|
|
63
|
+
- About **VMEC++** :
|
|
64
|
+
- [Proxima Fusion - VMEC++](https://www.proximafusion.com/press-news/introducing-vmecpp-open-source-software-for-fusion-research)
|
|
65
|
+
- [GitHub - vmecpp](https://github.com/proximafusion/vmecpp)
|
|
66
|
+
|
|
67
|
+
- Step 2: Convert the **VMEC** output to Boozer coordinates using **BOOZ_XFORM**
|
|
68
|
+
- About **BOOZ_XFORM** :
|
|
69
|
+
- [BOOZ_XFORM Documentation](https://hiddensymmetries.github.io/booz_xform/)
|
|
70
|
+
- [GitHub - BOOZ_XFORM](https://github.com/hiddenSymmetries/booz_xform)
|
|
71
|
+
- [BOOZ_XFORM - STELLOPT](https://princetonuniversity.github.io/STELLOPT/BOOZ_XFORM)
|
|
72
|
+
- Step 3: Convert the **BOOZ_XFORM** output to GKV coordinates using **BZX**
|
|
73
|
+
- This project.
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
#### **(iii) As a command line tool**
|
|
77
|
+
After installation, you can use **BZX** directly as a CLI tool in a terminal, e.g.,
|
|
78
|
+
```sh
|
|
79
|
+
python -m bzx --Ntheta_gkv 1 --nrho 11 --ntht 64 \
|
|
80
|
+
--nzeta 0 --alpha_fix 0.0 \
|
|
81
|
+
--fname_boozmn "boozmn.nc" --fname_wout "wout.nc" \
|
|
82
|
+
--output_file "./metric_boozer.bin.dat"
|
|
83
|
+
```
|
|
84
|
+
All arguments of `bzx` function is specified by keyword arguments. See also help.
|
|
85
|
+
```sh
|
|
86
|
+
python -m bzx --help
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Dependencies
|
|
90
|
+
|
|
91
|
+
BZX requires the following Python packages:
|
|
92
|
+
- `numpy`, `scipy`, `xarray`
|
|
93
|
+
- (Optional) `matplotlib` for visualization in `examples/`
|
|
94
|
+
- (Optional) `booz_xform` for `examples/run_vmecpp_boozxform_bzx.py`
|
|
95
|
+
- (Optional) `vmecpp` for `examples/run_vmecpp_boozxform_bzx.py`
|
|
96
|
+
|
|
97
|
+
## License
|
|
98
|
+
|
|
99
|
+
This project is licensed under the MIT License. See the [`LICENSE`](LICENSE) file for details.
|
|
100
|
+
|
|
101
|
+
## Author
|
|
102
|
+
|
|
103
|
+
Developed by Shinya Maeyama (maeyama.shinya@nifs.ac.jp)
|
bzx-0.1.0/README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# BZX - Boozer to GKV Coordinate Transformations
|
|
2
|
+
---
|
|
3
|
+
|
|
4
|
+
**BZX** is a Python package that transforms **BOOZ_XFORM** Boozer coordinate metrics into **GKV** field-aligned coordinates, enabling gyrokinetic analysis of **VMEC** equilibria.
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
To install from PyPI:
|
|
10
|
+
```bash
|
|
11
|
+
pip install bzx
|
|
12
|
+
```
|
|
13
|
+
Or install the latest development version from GitHub:
|
|
14
|
+
```bash
|
|
15
|
+
pip install git+https://github.com/GKV-developers/bzx.git
|
|
16
|
+
```
|
|
17
|
+
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.
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
#### **(i) Basic usage: Convert to GKV input file using BZX**
|
|
22
|
+
Prepare **VMEC** equilibrium output (e.g. `wout.nc`) and its **BOOZ_XFORM** output (e.g. `boozmn.nc`).
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
from bzx import bzx
|
|
26
|
+
|
|
27
|
+
# Define transformation parameters
|
|
28
|
+
Ntheta_gkv = 1 # N_theta value in GKV
|
|
29
|
+
nrho = 11 # Radial grid points
|
|
30
|
+
ntht = 64 # Poloidal grid points
|
|
31
|
+
nzeta = 0 # Toroidal grid points (nzeta=0 corresponds to output GKV field-aligned coordinates)
|
|
32
|
+
alpha_fix = 0.0 # Field-line label: alpha = zeta - q*theta (not used for nzeta > 0)
|
|
33
|
+
|
|
34
|
+
# Run BZX transformation
|
|
35
|
+
bzx(Ntheta_gkv, nrho, ntht, nzeta, alpha_fix,
|
|
36
|
+
fname_boozmn="boozmn.nc", fname_wout="wout.nc",
|
|
37
|
+
output_file="./metric_boozer.bin.dat")
|
|
38
|
+
```
|
|
39
|
+
- Reads **VMEC output file (`wout.nc`)** and **BOOZ_XFORM output file (`boozmn.nc`)**. NetCDF format is recommended, but Binary format is also acceptable.
|
|
40
|
+
- Converts them into field-aligned data and saves the result as **GKV input binary file (`metric_boozer.bin.dat`)**.
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
#### **(ii) Example of workflow: From VMEC to GKV via BOOZ_XFORM and BZX**
|
|
44
|
+
The script [`examples/run_vmecpp_boozxform_bzx.ipynb`](examples/run_vmecpp_boozxform_bzx.ipynb) demonstrats how to use **BZX**, starting from generating an equilibrium.
|
|
45
|
+
|
|
46
|
+
- Step 1: Compute a MHD equilibrium using **VMEC++**
|
|
47
|
+
- About **VMEC++** :
|
|
48
|
+
- [Proxima Fusion - VMEC++](https://www.proximafusion.com/press-news/introducing-vmecpp-open-source-software-for-fusion-research)
|
|
49
|
+
- [GitHub - vmecpp](https://github.com/proximafusion/vmecpp)
|
|
50
|
+
|
|
51
|
+
- Step 2: Convert the **VMEC** output to Boozer coordinates using **BOOZ_XFORM**
|
|
52
|
+
- About **BOOZ_XFORM** :
|
|
53
|
+
- [BOOZ_XFORM Documentation](https://hiddensymmetries.github.io/booz_xform/)
|
|
54
|
+
- [GitHub - BOOZ_XFORM](https://github.com/hiddenSymmetries/booz_xform)
|
|
55
|
+
- [BOOZ_XFORM - STELLOPT](https://princetonuniversity.github.io/STELLOPT/BOOZ_XFORM)
|
|
56
|
+
- Step 3: Convert the **BOOZ_XFORM** output to GKV coordinates using **BZX**
|
|
57
|
+
- This project.
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
#### **(iii) As a command line tool**
|
|
61
|
+
After installation, you can use **BZX** directly as a CLI tool in a terminal, e.g.,
|
|
62
|
+
```sh
|
|
63
|
+
python -m bzx --Ntheta_gkv 1 --nrho 11 --ntht 64 \
|
|
64
|
+
--nzeta 0 --alpha_fix 0.0 \
|
|
65
|
+
--fname_boozmn "boozmn.nc" --fname_wout "wout.nc" \
|
|
66
|
+
--output_file "./metric_boozer.bin.dat"
|
|
67
|
+
```
|
|
68
|
+
All arguments of `bzx` function is specified by keyword arguments. See also help.
|
|
69
|
+
```sh
|
|
70
|
+
python -m bzx --help
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Dependencies
|
|
74
|
+
|
|
75
|
+
BZX requires the following Python packages:
|
|
76
|
+
- `numpy`, `scipy`, `xarray`
|
|
77
|
+
- (Optional) `matplotlib` for visualization in `examples/`
|
|
78
|
+
- (Optional) `booz_xform` for `examples/run_vmecpp_boozxform_bzx.py`
|
|
79
|
+
- (Optional) `vmecpp` for `examples/run_vmecpp_boozxform_bzx.py`
|
|
80
|
+
|
|
81
|
+
## License
|
|
82
|
+
|
|
83
|
+
This project is licensed under the MIT License. See the [`LICENSE`](LICENSE) file for details.
|
|
84
|
+
|
|
85
|
+
## Author
|
|
86
|
+
|
|
87
|
+
Developed by Shinya Maeyama (maeyama.shinya@nifs.ac.jp)
|
bzx-0.1.0/pyproject.toml
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "bzx"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A Python package for BOOZ_XFORM output to GKV input"
|
|
9
|
+
authors = [
|
|
10
|
+
{ name = "Shinya Maeyama", email = "maeyama.shinya@nifs.ac.jp" }
|
|
11
|
+
]
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
license = {text = "MIT License"}
|
|
14
|
+
requires-python = ">=3.7"
|
|
15
|
+
|
|
16
|
+
dependencies = [
|
|
17
|
+
"numpy>=1.23",
|
|
18
|
+
"scipy>=1.15",
|
|
19
|
+
"xarray>=2022.3",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
[project.optional-dependencies]
|
|
23
|
+
examples = [
|
|
24
|
+
"matplotlib>=3.5",
|
|
25
|
+
"booz_xform>=0.0.8",
|
|
26
|
+
#vmecpp @ git+https://github.com/proximafusion/vmecpp.git",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[tool.setuptools]
|
|
30
|
+
packages = ["bzx"]
|
|
31
|
+
package-dir = {"" = "src"}
|
|
32
|
+
|
bzx-0.1.0/setup.cfg
ADDED