Metadata-Version: 2.4
Name: pathsim-fusion
Version: 0.2.0
Summary: Fusion fuel cycle and balance-of-plant blocks for PathSim
Author: PathSim Contributors
License: MIT
Project-URL: Homepage, https://pathsim.org
Project-URL: Documentation, https://docs.pathsim.org/fusion
Project-URL: Repository, https://github.com/pathsim/pathsim-fusion
Project-URL: Issues, https://github.com/pathsim/pathsim-fusion/issues
Keywords: simulation,pathsim,block diagram,fusion,tritium,fuel cycle,balance of plant
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pathsim>=0.30.3
Requires-Dist: numpy>=1.15
Requires-Dist: scipy>=1.2
Provides-Extra: test
Requires-Dist: pytest>=7.0; extra == "test"
Requires-Dist: pytest-cov>=4.0; extra == "test"
Provides-Extra: lint
Requires-Dist: ruff==0.17.3; extra == "lint"
Dynamic: license-file

<p align="center">
  <img src="https://raw.githubusercontent.com/pathsim/pathsim-fusion/master/docs/source/logos/fusion_logo.png" width="300" alt="PathSim-Fusion Logo" />
</p>

<p align="center">
  <strong>Fusion fuel cycle and balance-of-plant blocks for PathSim</strong>
</p>

<p align="center">
  <a href="https://pypi.org/project/pathsim-fusion/"><img src="https://img.shields.io/pypi/v/pathsim-fusion" alt="PyPI"></a>
  <img src="https://img.shields.io/github/license/pathsim/pathsim-fusion" alt="License">
</p>

<p align="center">
  <a href="https://pathsim.org">Homepage</a> &bull;
  <a href="https://docs.pathsim.org/fusion">Documentation</a> &bull;
  <a href="https://github.com/pathsim/pathsim-fusion">GitHub</a>
</p>

---

PathSim-Fusion extends the [PathSim](https://github.com/pathsim/pathsim)
simulation framework with specialized blocks. All blocks follow the standard
PathSim block interface and can be connected into simulation diagrams.

## Blocks

| Block | Description | Key Parameters |
|-------|-------------|----------------|
| `IonisationChamber` | Flow-through tritium ionisation chamber (signal = ε(c)·c, flux passes through) | `detection_efficiency`, `func_efficiency`, `detection_threshold` |
| `Bubbler4` | Four-vial tritium sampling bubbler (soluble + insoluble chains, catalytic conversion, scheduled vial replacement) | `conversion_efficiency`, `vial_efficiency`, `replacement_times` |
| `GLC` | Counter-current bubble-column gas–liquid contactor for tritium extraction from LiPb (Malara 1995, on `BVP1D`) | `P_in`, `L`, `D`, `T`, `BCs` |
| `FuelCycleComponent` | Lumped fuel cycle component with a residence time (dI/dt = inflows + S − (1+ε)·I/τ − λ·I; outputs inventory, outflow, loss) | `tau`, `loss_fraction`, `decay_constant`, `source_term`, `initial_value` |
| `BreedingBlanket` | Breeding blanket, residence time model (outputs inventory, outflow, loss) | `tau` |
| `PlasmaFacingComponent` | First wall or divertor, residence time model | `tau` |
| `TokamakExhaustProcessing` | Exhaust processing (fuel cleanup), residence time model | `tau` |
| `DetritiationSystem` | Detritiation system, residence time model | `tau` |
| `TritiumExtractionSystem` | Tritium extraction, residence time model with an extraction efficiency (outlets `extracted`, `residual`) | `tau`, `efficiency` |
| `HeatExchangerPermeation` | Heat exchanger tritium holdup with a permeated fraction (outlets `permeated`, `returned`) | `tau`, `permeation_fraction` |
| `FusionChamberPump` | Fusion chamber vacuum pump with direct internal recycling (outlets `recycled`, `exhaust`) | `tau`, `dir_fraction` |
| `IsotopeSeparationSystem` | Isotope separation, residence time model with a waste fraction (outlets `product`, `waste`) | `tau`, `waste_fraction` |
| `StorageAndManagement` | Fuel storage: accumulates its inflows, withdrawals are negative inflows, decays | `decay_constant`, `initial_value` |
| `Plasma` | Plasma fuel holdup, residence time model | `tau` |
| `FuellingSystem` | Fuelling system, residence time model | `tau` |
| `DirectInternalRecycling` | Direct internal recycling loop, residence time model | `tau` |
| `IsotopeAdjustmentSystem` | Isotope adjustment system, residence time model | `tau` |
| `SecondaryPump` | Backing and roughing pumps, residence time model | `tau` |
| `CoolantPurification` | Coolant purification system, residence time model | `tau` |
| `WaterDetritiationSystem` | Water detritiation system, residence time model | `tau` |
| `GasDetritiationSystem` | Gas detritiation system, residence time model | `tau` |
| `AirDetritiationSystem` | Air detritiation system, residence time model | `tau` |
| `Stack` | Stack: accumulates the tritium released to the environment | `decay_constant`, `initial_value` |

## Install

```bash
pip install pathsim-fusion
```

## Quick Example

```python
from pathsim import Simulation, Connection
from pathsim.blocks import Constant, Source, Scope
from pathsim_fusion import IonisationChamber

flux = Source(lambda t: 1e-3 * float(t > 1))  # tritium flux, step at t = 1
flow = Constant(0.5)  # carrier gas flow rate
ic = IonisationChamber(detection_efficiency=0.9)
sco = Scope(labels=["flux", "signal"])

sim = Simulation(
    blocks=[flux, flow, ic, sco],
    connections=[
        Connection(flux, ic["flux_in"], sco[0]),
        Connection(flow, ic["flow_rate"]),
        Connection(ic["signal"], sco[1]),
    ],
    dt=0.01,
)
sim.run(5)
sco.plot()
```

## Development

```bash
pip install -e ".[test,lint]" mypy
ruff check .                # lint
ruff format .               # format
mypy src/pathsim_fusion    # type check
pytest tests/ -v            # run tests
```

## License

MIT
