Skip to content
FORGExhaustPublic

About

A Python tool for optimising tokamak divertor magnetic geometries via simulated annealing

Topics

Resources

Stars

9 stars

Watchers

1 watching

Forks

Repository files navigation

FORGE

FORGE logo

FORGE Optimises Reactor Geometries to improve Exhaust

License: LGPL v3 Python 3.10+ Docs CI


FORGE is a Python tool for optimising the magnetic geometry of tokamak divertors. Given a GEQDSK equilibrium and a description of the poloidal-field coils, it tunes coil currents using a simulated annealing optimisation algorithm to reshape the magnetic geometry of the divertor region(s) — improving strike-point placement, connection length, and detachment conditions — whilst leaving the core plasma unchanged. In this way, FORGE enables a decoupling of the production of a suitable free-boundary equilibrium that captures the geometry of the core plasma from the design of the divertor geometry, eliminating the need for the repeated usage of a free-boundary solver. FORGE comes with a GUI to help the user setup their optimisation problem in a visual and intuitive way.

MAST-U initial vs optimised geometry

FORGE GUI

Community

FORGE is device-agnostic — whilst the bundled examples use a MAST-U geometry, it can be applied to any tokamak for which you have a GEQDSK equilibrium and a PF coil description. If you are interested in using FORGE, have questions, or would like to contribute to its development, please join the discussion on the FORGE Discord server.

Documentation

Full documentation is available at https://forgexhaust.readthedocs.io, including:

To build the docs locally:

pip install -e ".[docs]"
cd docs
make html
# open build/html/index.html

Installation

From source

git clone https://github.com/FORGExhaust/FORGE.git
cd forge
pip install .

Editable (development) install

git clone https://github.com/FORGExhaust/FORGE.git
cd forge
pip install -e ".[test,docs,gui]"

Dependencies

Package Minimum version
NumPy 2.0.0
Matplotlib 3.7.5
SciPy 1.11.4 (< 1.18)
Shapely 2.0.1
freeqdsk 0.4.0

Contributing

Contributions are welcome! If you would like to contribute:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/my-feature)
  3. Commit your changes (git commit -m "Add my feature")
  4. Push to the branch (git push origin feature/my-feature)
  5. Open a Pull Request into the dev branch.

Please ensure new code includes appropriate tests, docstrings and updated documentation where relevant.

Citation

If you use FORGE in your research, please cite:

@software{forge,
  author  = {Marsden, Chris},
  title   = {{FORGE}: {F}ORGE {O}ptimises {R}eactor {G}eometries to improve {E}xhaust},
  url     = {https://github.com/FORGExhaust/FORGE},
  version = {1.1.0},
  year    = {2026}
}

Authors and Acknowledgements

  • Chris Marsden — Former Tokamak Energy scientist. Project lead and primary developer.
  • Sebastien Shaw — Student at Imperial College London. Performed foundational work during a UKAEA FOSTER summer placement (2025).
  • Nathan Welch — SCOPE project lead; guidance on the simulated annealing approach.

FORGE builds on several routines from FreeGS (Ben Dudson et al.), which are used under the terms of the LGPL-3.0 licence. See the individual source files for details.

FORGE was initially developed at Tokamak Energy.

The FORGE GUI is built with Panel and Bokeh:

Panel    Bokeh

License

FORGE is released under the GNU Lesser General Public License v3.0. See LICENSE for the full text.

The bundled MAST-U example data is provided under CC BY-NC-SA 4.0. See the documentation licence page for details.

Note: The MAST-U machine configuration represented by the bundled data corresponds to the MAST-U device as operated during the period 2020–2025. Any subsequent modifications to the machine are not reflected in these data.

About

A Python tool for optimising tokamak divertor magnetic geometries via simulated annealing

Topics

Resources

Stars

9 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages