Skip to main content

DipolEq equilibrium solver python bindings.

Project description

DipolEq

Documentation Status Actions Status codecov PyPI version PyPI platforms Contributor Covenant Ruff

Dipole equilibrium design code

Based on "TokaMac v2.0" by L. Bai and M. Mauel at Columbia University.

Can be used to show high beta equilibria in a dipole confined plasma. In other words, solve the Grad-Shafranov equation in a machine with an "first closed flux surface" and no toroidal field.

The code is licensed under the MIT license. (Except for the ClibPDF code, which no longer is available but was licensed for free use in academic use. This code is not linked into the python package version of this code.)

If you use this code, please reference this paper as source.

D. T. Garnier, J. Kesner, and M. E. Mauel, “Magnetohydrodynamic stability in a levitated dipole,” Phys. Plasmas, vol. 6, no. 9, pp. 3431–3434, Jan. 1999, doi: 10.1063/1.873601.

C Code - Command Line Version

Compilation

The original code is written in C (and some C++) and gives a command line interface, that outputs a PDF, HDF5 and other output files. The code can be compiled with cmake. There are example codes for how to process hdf5 files (into, for example an EFIT gfile) in the postprocess directory.

Dependencies

Ubuntu

The recommended build is for hdf5, zlib and libjpeg libraries to be installed:

sudo apt install cmake gcc zlib1g-dev libjpeg-dev libhdf5-dev

macOS

cmake and hdf5 can be installed with macports or homebrew and should be enough to compile the code.

brew install cmake hdf5

or

sudo port install cmake hdf5

Build and Install

The code can be configured and compiled with cmake. The recommended way to compile is to create a build directory and run cmake from there:

cd dipoleq
mkdir build
cd build
cmake ..
cmake --build .
sudo cmake --install .

Usage

The code can be run from the command line with the following command:

dipoleq -f <input_file>

See the Testing directories for examples of input files [*.in].

There is a second command line tool that can be used to generate a EFIT gfile from the output hdf5 file:

dipoleq_geqdsk <output.h5>

Python Module Interface

A python version of the code is now available. This relies on the pybind11 library to wrap the C code into a python module. This wraps the main features of the code into a python module, although the outer loop of the code is now in python. The python module is not yet fully documented, but the main features are available, and regularly tested against the original C code. For packaging, the "scikit-build-core" package is used to build the code using a standard pyproject.toml file.

Complilation

The python module can be compiled with the following command: pip install . This may install in your user directory or in a virtual environment. It will also install the dipoleq and dipoleq_geqdsk command line tools as well, though these are actually calls to the python / pybind11 version of the code and no longer include ClibPDF or HDF5 directly. This may become the preferred way to install the code in the future.

Usage

Python usage is still in development. More on this soon.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dipoleq-0.9.3.tar.gz (1.3 MB view hashes)

Uploaded Source

Built Distributions

dipoleq-0.9.3-cp312-cp312-win_amd64.whl (258.6 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

dipoleq-0.9.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (345.7 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

dipoleq-0.9.3-cp312-cp312-macosx_11_0_arm64.whl (282.2 kB view hashes)

Uploaded CPython 3.12 macOS 11.0+ ARM64

dipoleq-0.9.3-cp312-cp312-macosx_10_15_x86_64.whl (317.4 kB view hashes)

Uploaded CPython 3.12 macOS 10.15+ x86-64

dipoleq-0.9.3-cp311-cp311-win_amd64.whl (259.5 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

dipoleq-0.9.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (345.8 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

dipoleq-0.9.3-cp311-cp311-macosx_11_0_arm64.whl (281.1 kB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

dipoleq-0.9.3-cp311-cp311-macosx_10_15_x86_64.whl (314.6 kB view hashes)

Uploaded CPython 3.11 macOS 10.15+ x86-64

dipoleq-0.9.3-cp310-cp310-win_amd64.whl (258.4 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

dipoleq-0.9.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (345.2 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

dipoleq-0.9.3-cp310-cp310-macosx_11_0_arm64.whl (280.1 kB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

dipoleq-0.9.3-cp310-cp310-macosx_10_15_x86_64.whl (313.4 kB view hashes)

Uploaded CPython 3.10 macOS 10.15+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page