This project aims to standardise gyrokinetic analysis.
A general pyro object can be loaded either from simulation/experimental data or from an existing gyrokinetics file.
In general pyrokinetics can do the following
- Read data in from:
- Gyrokinetic input files
- Simulations outputs
- Write input files for various GK codes
- Generate N-D pyro object for scans
- Read in gyrokinetic outputs
- WIP: Standardise analysis of gk outputs
At a minimum pyrokinetics needs the local geometry and species data. Example scripts can be found in the examples folder
Documentation can be found at readthedocs.
Pyrokinetics requires a minimum Python version of 3.8. It may be necessary to upgrade
pip
to install:
$ pip install --upgrade pip
To install the latest release:
$ pip install pyrokinetics
Otherwise, to install from source:
$ git clone https://github.com/pyro-kinetics/pyrokinetics.git
$ cd pyrokinetics
$ pip install .
If you are planning on developing pyrokinetics use the following instead to install:
$ pip install -e .[docs,tests]
To run the tests:
$ pip install -e .[tests]
$ pytest --cov .
The simplest action in Pyrokinetics is to convert a gyrokinetics input file for code
'X' into an equivalent input file for code 'Y'. The easiest way to achieve this is to
use a Pyro
object, which manages the various other classes in the API. For example,
to convert a GS2 input file to a CGYRO input file:
>>> from pyrokinetics import Pyro
>>> pyro = Pyro(gk_file="my_gs2_file.in") # file type is automatically inferred
>>> pyro.write_gk_file("input.cgyro", gk_code="CGYRO")
There are many other features in Pyrokinetics, such as methods for building gyrokinetics input files using global plasma equilibria and/or kinetics profiles. There are also methods for analysing and comparing the results from gyrokinetics code runs. Please read the docs for more information.
After installing, simple pyrokinetics operations can be performed on the command line using either of the following methods:
$ python3 -m pyrokinetics {args...}
$ pyro {args...}
For example, to convert a GS2 input file to CGYRO:
$ pyro convert CGYRO "my_gs2_file.in" -o "input.cgyro"
You can get help on how to use the command line interface or any of its subcommands
by providing -h
or --help
:
$ pyro --help
$ pyro convert --help
Pyro object comprised of
- Equilibrium
- LocalGeometry
- Miller
- Fourier (to be added)
- LocalGeometry
- Kinetics
- LocalSpecies
- Numerics
- GKCodes
- GKOutput
- For nonlinear simulations
- Fields (field, kx, ky, theta, time)
- Fluxes (field, species, moment, ky, theta, time)
- For linear simulations
- Fields (field, kx, ky, theta, time)
- Fluxes (field, species, moment, ky, theta, time)
- Eigenfunctions (field, ky, theta, time)
- Eigenvalues - growth rate and mode freq (ky, time)
- For nonlinear simulations
There also exists the PyroScan object which allows you to make a N-D parameter scan of Pyro objects
pyrokinetics currently supports
Future formats to be added are
- CHEASE
Sources of kinetic profile data currently supported are
- SCENE
- JETTO
- TRANSP
Future codes to be add
- SimDB
- OMFIT
The following gk codes are supported in pyrokinetics
- CGYRO
- GS2
- GENE
- TGLF
Codes to be added in the future
- Stella
- GX
The pyro object uses standardised reference values to normalise the results. It will automatically handle converting to a GK codes standard units.
Note any scans/parameter changes made will be in standard pyro units so please account for this.
Reference values
It is possible to change the reference units but proceed with caution
This project is used by the following institutions
- CCFE
- University of York