Skip to main content

SCPN Fusion Core - Tokamak Plasma Physics Simulation and Neuro-Symbolic Control Suite

Project description

SCPN Fusion Core

CI License: AGPL v3 Python 3.9+ Rust DOI Docs

A comprehensive tokamak plasma physics simulation and control suite with neuro-symbolic compilation. SCPN Fusion Core models the full lifecycle of a fusion reactor — from Grad-Shafranov equilibrium and MHD stability through transport, heating, neutronics, and real-time disruption prediction — with optional Rust acceleration via PyO3 and an optional bridge to SC-NeuroCore spiking neural networks.

Architecture

scpn-fusion-core/
├── src/scpn_fusion/           # Python package (46 modules)
│   ├── core/                  # Plasma physics engines
│   │   ├── fusion_kernel.py           Grad-Shafranov + transport solver
│   │   ├── compact_reactor_optimizer  MVR-0.96 compact reactor search
│   │   ├── mhd_sawtooth.py           MHD sawtooth crash simulator
│   │   ├── rf_heating.py             ICRH/ECRH/LHCD heating models
│   │   ├── divertor_thermal_sim.py   Divertor heat-flux solver
│   │   ├── hall_mhd_discovery.py     Hall-MHD two-fluid effects
│   │   ├── sandpile_fusion_reactor   SOC criticality model
│   │   ├── neural_equilibrium.py     Neural-network equilibrium solver
│   │   ├── fno_turbulence_suppressor Fourier Neural Operator turbulence model
│   │   ├── turbulence_oracle.py      ITG/TEM turbulence predictor
│   │   ├── wdm_engine.py             Warm dense matter EOS
│   │   ├── geometry_3d.py            3D flux-surface geometry
│   │   ├── global_design_scanner.py  Multi-objective design space explorer
│   │   └── integrated_transport      Coupled transport solver
│   ├── control/               # Reactor control & AI
│   │   ├── tokamak_flight_sim.py     Real-time flight simulator
│   │   ├── tokamak_digital_twin.py   Digital twin with live telemetry
│   │   ├── fusion_optimal_control    Model-predictive controller
│   │   ├── fusion_sota_mpc.py        State-of-the-art MPC
│   │   ├── disruption_predictor.py   ML disruption early-warning
│   │   ├── spi_mitigation.py         Shattered pellet injection
│   │   ├── fusion_control_room.py    Integrated control room sim
│   │   ├── neuro_cybernetic_controller  SNN-based feedback controller
│   │   └── advanced_soc_fusion_learning Self-organized criticality RL
│   ├── nuclear/               # Nuclear engineering
│   │   ├── blanket_neutronics.py     Tritium breeding ratio solver
│   │   ├── nuclear_wall_interaction  PMI / first-wall damage
│   │   ├── pwi_erosion.py            Plasma-wall erosion model
│   │   └── temhd_peltier.py          Thermoelectric MHD effects
│   ├── diagnostics/           # Synthetic diagnostics
│   │   ├── synthetic_sensors.py      Virtual instrument suite
│   │   └── tomography.py             Soft X-ray tomographic inversion
│   ├── engineering/           # Balance of plant
│   │   └── balance_of_plant.py       Thermal cycle, turbine, cryo
│   ├── scpn/                  # Neuro-symbolic compiler
│   │   ├── compiler.py               Petri nets → stochastic neurons
│   │   ├── controller.py             SNN-driven plasma control
│   │   ├── structure.py              Petri net data structures
│   │   ├── contracts.py              Formal verification contracts
│   │   └── artifact.py               Compilation artifact storage
│   ├── hpc/                   # High-performance computing
│   │   └── hpc_bridge.py             C++/Rust FFI bridge
│   └── ui/                    # Dashboard
│       └── app.py                    Streamlit real-time dashboard
├── scpn-fusion-rs/            # Rust workspace (10 crates)
│   ├── crates/
│   │   ├── fusion-types/      # Shared data types
│   │   ├── fusion-math/       # Linear algebra, FFT, interpolation
│   │   ├── fusion-core/       # Grad-Shafranov, transport in Rust
│   │   ├── fusion-physics/    # MHD, heating, turbulence
│   │   ├── fusion-nuclear/    # Neutronics, wall erosion
│   │   ├── fusion-engineering/ # Balance of plant
│   │   ├── fusion-control/    # PID, MPC, disruption predictor
│   │   ├── fusion-diagnostics/ # Sensor models
│   │   ├── fusion-ml/         # Inference engine
│   │   └── fusion-python/     # PyO3 bindings → scpn_fusion_rs.pyd
│   └── Cargo.toml             # Workspace manifest
├── tests/                     # Python test suite
├── docs/                      # Technical documentation
├── validation/                # ITER validation configurations
├── calibration/               # Optimization tools
└── schemas/                   # JSON schemas

Quick Start

# Clone
git clone https://github.com/anulum/scpn-fusion-core.git
cd scpn-fusion-core

# Install (Python)
pip install -e .

# Run a simulation
python run_fusion_suite.py kernel       # Grad-Shafranov equilibrium
python run_fusion_suite.py optimizer    # Compact reactor search (MVR-0.96)
python run_fusion_suite.py flight       # Tokamak flight simulator
python run_fusion_suite.py neural       # Neural equilibrium solver

# Run tests
pytest tests/ -v

Rust Acceleration (Optional)

cd scpn-fusion-rs
cargo build --release
cargo test

# Build Python bindings (requires maturin)
pip install maturin
cd crates/fusion-python
maturin develop --release

The Python package auto-detects the Rust extension and falls back to NumPy if unavailable.

Testing

# Python unit + property-based tests
pip install -e ".[dev]"
pytest tests/ -v

# Rust unit + property-based tests
cd scpn-fusion-rs
cargo test --all-features

# Rust benchmarks
cargo bench

The test suites include property-based tests powered by Hypothesis (Python) and proptest (Rust), covering numerical invariants, topology preservation, and solver convergence properties.

Tutorial Notebooks

Notebook Description
01_compact_reactor_search MVR-0.96 compact reactor optimizer walkthrough
02_neuro_symbolic_compiler Petri net → stochastic neuron compilation pipeline
03_grad_shafranov_equilibrium Free-boundary equilibrium solver tutorial
04_divertor_and_neutronics Divertor heat flux & tritium breeding ratio

26 Simulation Modes

Mode Description
kernel Grad-Shafranov equilibrium + coupled transport
flight Real-time tokamak flight simulator
optimal Model-predictive optimal control
learning Self-organized criticality reinforcement learning
digital-twin Live digital twin with telemetry
control-room Integrated control room simulation
sandpile SOC sandpile criticality model
nuclear Plasma-wall interaction & first-wall damage
breeding Tritium breeding blanket neutronics
safety ML disruption predictor + early warning
optimizer Compact reactor design search (MVR-0.96)
divertor Divertor thermal load simulation
diagnostics Synthetic diagnostic instrument suite
sawtooth MHD sawtooth crash dynamics
neural Neural-network equilibrium solver
geometry 3D flux-surface geometry
spi Shattered pellet injection mitigation
scanner Multi-objective global design scanner
heating RF heating (ICRH / ECRH / LHCD)
wdm Warm dense matter equation of state
quantum Quantum computing bridge
q-control Quantum control agent
neuro-control SNN-based cybernetic controller
neuro-quantum Neuro-quantum hybrid controller
lazarus Lazarus protocol bridge
director Director AI interface
vibrana Vibrana resonance bridge

Minimum Viable Reactor (MVR-0.96)

The compact reactor optimizer (python run_fusion_suite.py optimizer) performs multi-objective design-space exploration to find the smallest tokamak configuration that achieves Q >= 10 ignition. The "0.96" refers to the normalized minor radius target. Key parameters explored:

  • Major/minor radius, elongation, triangularity
  • Magnetic field strength, plasma current
  • Heating power allocation (NBI, ICRH, ECRH)
  • Tritium breeding ratio constraints
  • Divertor heat-flux limits

Neuro-Symbolic Compiler

The scpn/ subpackage implements a Petri net → stochastic neuron compiler:

  1. Petri Net Definition — plasma control logic expressed as place/transition nets with formal contracts
  2. Compilation — Petri net transitions mapped to stochastic LIF neurons (using SC-NeuroCore when available, NumPy fallback otherwise)
  3. Execution — SNN-driven real-time plasma control with sub-millisecond latency
  4. Verification — formal contract checking on compiled artifacts

SC-NeuroCore Integration

SCPN Fusion Core has an optional dependency on sc-neurocore. When installed, the neuro-symbolic compiler uses hardware-accurate stochastic LIF neurons and Bernoulli bitstream encoding. Without it, all paths fall back to NumPy float computation:

try:
    from sc_neurocore import StochasticLIFNeuron, generate_bernoulli_bitstream
    _HAS_SC_NEUROCORE = True
except ImportError:
    _HAS_SC_NEUROCORE = False  # NumPy float-path fallback

Rust Workspace

The scpn-fusion-rs/ directory contains a 10-crate Rust workspace that mirrors the Python package structure. Key features:

  • Performance: opt-level = 3, fat LTO, single codegen unit for maximum optimization
  • FFI: fusion-python crate provides PyO3 bindings producing scpn_fusion_rs.so/.pyd
  • Dependencies: ndarray, nalgebra, rayon (parallelism), rustfft, serde
  • No external runtime: pure Rust with no C/Fortran dependencies

Documentation

Citation

If you use SCPN Fusion Core in your research, please cite using the CITATION.cff file or:

@software{scpn_fusion_core,
  title   = {SCPN Fusion Core: Tokamak Plasma Physics Simulation and Neuro-Symbolic Control Suite},
  author  = {Sotek, Miroslav and Reiprich, Michal},
  year    = {2026},
  url     = {https://github.com/anulum/scpn-fusion-core},
  version = {1.0.0}
}

This software is archived on Zenodo (DOI pending first release deposit) and published on Academia.edu.

Authors

  • Miroslav Sotek — ANULUM CH & LI — ORCID
  • Michal Reiprich — ANULUM CH & LI

License

GNU Affero General Public License v3.0 — see LICENSE.

For commercial licensing inquiries, contact: protoscience@anulum.li

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

scpn_fusion-1.0.1.tar.gz (125.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scpn_fusion-1.0.1-py3-none-any.whl (148.0 kB view details)

Uploaded Python 3

File details

Details for the file scpn_fusion-1.0.1.tar.gz.

File metadata

  • Download URL: scpn_fusion-1.0.1.tar.gz
  • Upload date:
  • Size: 125.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for scpn_fusion-1.0.1.tar.gz
Algorithm Hash digest
SHA256 ab2314e01b7928e1caf86c37aaa507a1ffa22f350d5256190e0961b642a88995
MD5 f08f696c33a37020dbc3115eab64f353
BLAKE2b-256 30474237b86ad700ed16e43289f009cd74cacda9b422ee5d91e5c9586bc0dbde

See more details on using hashes here.

Provenance

The following attestation bundles were made for scpn_fusion-1.0.1.tar.gz:

Publisher: publish.yml on anulum/scpn-fusion-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scpn_fusion-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: scpn_fusion-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 148.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for scpn_fusion-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6dd4d70c610d5ffc84703cbb0c8517240cd39dce8216a20123105de04a26db2a
MD5 46e8d573987b2ce838e74a5434415f98
BLAKE2b-256 cd88934fb802d9cfcd89bf93be8d1656982872eec7db838cbb8b998a958fcf66

See more details on using hashes here.

Provenance

The following attestation bundles were made for scpn_fusion-1.0.1-py3-none-any.whl:

Publisher: publish.yml on anulum/scpn-fusion-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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