Package: pyrokinetics
PyrokineticsThis 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 followingRead data in from:Gyrokinetic input filesSimulations outputsWrite input files for various GK codesGenerate N-D pyro object for scansRead in gyrokinetic outputsStandardise analysis of gk outputsAt a minimum pyrokinetics needs the local geometry and species data. Example scripts can be found in the examples folderDocumentationDocumentation can be found atreadthedocs.InstallationPyrokinetics requires a minimum Python version of 3.8. It may be necessary to upgradepipto install:$pipinstall--upgradepipTo install the latest release:$pipinstallpyrokineticsOtherwise, to install from source:$gitclonehttps://github.com/pyro-kinetics/pyrokinetics.git
$cdpyrokinetics
$pipinstall.If you are planning on developing pyrokinetics use the following instead to install:$pipinstall-e.[docs,tests]Note that currently the installation of pyrokinetics requires an available Fortran compilerTestingTo run the tests:$pipinstall-e.[tests]$pytest--cov.Basic UsageThe 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 aPyroobject, which manages the various other classes in the API. For example,
to convert a GS2 input file to a CGYRO input file:>>>frompyrokineticsimportPyro>>>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. Pleaseread the docsfor more information.Command Line InterfaceAfter installing, simple pyrokinetics operations can be performed on the command line
using either of the following methods:$python3-mpyrokinetics{args...}$pyro{args...}For example, to convert a GS2 input file to CGYRO:$pyroconvertCGYRO"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-hor--help:$pyro--help
$pyroconvert--helpDockerPyrokinetics provides aDockerfilefrom which you can build and run Docker containers.
To do so, you must haveDockerinstalled on
your system. To build a local container:$dockerbuild.-tpyrokineticsIt can then be run using:$dockerrun-it--rm-v./path/to/local:/mymountpyrokineticswhere:-itruns an interactive shell.--rmdeletes the Docker instance after use.-v ./path/to/local:/mymountmounts the local directory./path/to/localto the
directory/mymountwithin the Docker container.The container runs an IPython interpreter, with Pyrokinetics already installed. Note
that you will need toimportPyrokinetics before it can be used.Code structurePyro object comprised ofEquilibriumLocalGeometryMillerFourier (to be added)KineticsLocalSpeciesNumericsGKCodesGKOutputFor nonlinear simulationsFields (field, kx, ky, theta, time)Fluxes (field, species, moment, ky, theta, time)For linear simulationsFields (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)There also exists the PyroScan object which allows you to make a N-D parameter scan of Pyro objectsSupports sources of Equilibrium datapyrokinetics currently supportsGEQDSKTRANSPFuture formats to be added areCHEASESupported sources of Kinetic dataSources of kinetic profile data currently supported areSCENEJETTOTRANSPFuture codes to be addSimDBOMFITSupported GK codesThe following gk codes are supported in pyrokineticsCGYROGS2GENETGLFCodes to be added in the futureStellaGXNote on unitsThe 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$T_{ref} = T_e$ Electron temperature at flux surface$n_{ref} = n_e$ Electron density at flux surface$m_{ref} = m_D$ Deuterium mass$v_{ref} = c_s = \sqrt{T_e/m_D}$ Ion sound speed at flux surface$B_{ref} = B_0$ Toroidal field at centre of the flux surface$L_{ref} = a$ Minor radius of the last closed flux surface$t_{ref} = a/c_s$ Ion sound time at flux surface$\rho_{ref} = \frac{c_s}{eB_0/m_D}$ Ion Larmor radius at flux surfaceIt is possible to change the reference units but proceed with cautionUsed ByThis project is used by the following institutionsCCFEUniversity of YorkCopyright owned by UKAEA. Pyrokinetics is licensed under LGPL-3.0, and is free to use, modify, and distribute.