The repository serves as a storage for often used magnetic field coefficients for Feltor simulations. Furthermore it provides uniform access to these coefficients through a python interface. Together with the simplesimdb module this interface can then be used to setup and run Feltor simulations that require geometry coefficients on input.
We do not (yet) have an uploaded version on pypi. Install directly from github:
pip install git+https://github.com/feltor-dev/magneticfielddbOR clone the repository and then use the package manager pip.
git clone https://github.com/feltor-dev/magneticfielddb
cd magneticfielddb
pip install . # local installation of the module
pip install .[test] # Install pytest
pytest --capture=tee-sys . # run the unittestsIn order to locally run the included jupyter-notebooks you can use
pip install .[jupyter] # Install all necessary dependencies
jupyter-lab # run notebooksHere is an example of how we iterate over all files in the data repository open them into a python dictionaries and display them on stdout.
### example.py ###
import magneticfielddb as mag
# list all files in the data repository
for f in mag.files() :
# read each file into a dictionary
coefficients = mag.select( f)
# print to stdout
print( coefficients)- each file contains at least the "equilibrium", "R_0" and "description" fields
- "R_0" is given in units of meter
- "PP" and "PI" are 1 by default
- Files may contain a field "comment" that contains human readable information string
polynomial_field.ipynbis an example notebook of how to fit polynomial coefficients to given equilibrium. Read the doxygen documentation ondg::geo::createMagneticFieldto find out about valid fields in yourjsonfilenormalize_params.cppis a C++ program that should be used on geometry input files (all files with X-points must be normalized such that the X-point closest to the O-point lies on the Psip=0 surface). Compile withmakeand run with./normalize_params your-params.json your-params.jsonto update parameters in-place.OneSizeFitsAllEquilbrium.nbis a Mathematica notebook that generates solovev coefficientsq-profiles.ipynbis a jupyter notebook that plots q-profiles and flux surfaces for all equilibria in the database usingpath/to/feltor/src/geometry_diag/geometry_diag.cppandsimplesimdbgeometry_diag.ipynbis a jupyter notebook that shows how newly made parameters behave in Feltor and how wall and sheath parameters should be setup for a 3d simulation usingpath/to/feltor/src/geometry_diag/geometry_diag.cppandsimplesimdb
Contributions are welcome.
Matthias Wiesenberger and Markus Held