Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
604d179
Map out reactix code structure and workflow
aysunrhn Jun 15, 2026
ac75bd5
Turn the System class into MixedSystem and TransportSystem classes to…
aysunrhn Jun 18, 2026
dc395df
Remove TransportClass and MixedClass from the transport.py file
aysunrhn Jun 24, 2026
83b944d
Move TransportSystem and MixedSystem to a separate systems.py file
aysunrhn Jun 24, 2026
e6abdff
Update imports in the init file
aysunrhn Jun 24, 2026
54561ad
Update mixed_rhs in systems.py
aysunrhn Jun 25, 2026
823c97d
Add inflow outflow calculation to mixed_rhs
aysunrhn Jun 25, 2026
a926f2a
Update test_tranport.py to be consistent with the new TransportSystem…
aysunrhn Jun 25, 2026
162db5c
Add initial tests for the MixedSystem in test_systems.py
aysunrhn Jun 25, 2026
bd0e0cc
Update transport.py to change System to TransportSystem typing
aysunrhn Jun 25, 2026
9df05c9
Move rhs definition for each system to the respective class
astoeriko Jun 30, 2026
8b1d99e
Add missing decorator in MixedSystem class
astoeriko Jun 30, 2026
7f45b76
Ensure correct behavior for different argument types in MixedSystem
astoeriko Jun 30, 2026
1ed15fb
Add notebook with mixed reactor example
astoeriko Jun 30, 2026
9b73ae2
Add tests for MixedSystem class
astoeriko Jun 30, 2026
93e48f4
Update transport-model.ipynb to use new TransportModel class
astoeriko Jun 30, 2026
1470780
Add logo to the repository
astoeriko Jul 2, 2026
a8cada2
Convert font to path in SVG logo file
astoeriko Jul 2, 2026
c761250
Update pathogen-model.ipynb to rename System class
aysunrhn Jul 2, 2026
9e1dc89
Move solve_fn_dense outside of the solve_pt function to avoid redefin…
aysunrhn Jul 3, 2026
5eeb70e
Move the solve_fn_dense function back inside the solve_pt method
aysunrhn Jul 6, 2026
fdee950
Merge pull request #54 from astoeriko/system-class
aysunrhn Jul 6, 2026
2c97edf
Merge pull request #58 from astoeriko/logo
astoeriko Jul 20, 2026
e80b2f1
Remove pixi.lock and pixi.toml
edvinskis Jul 20, 2026
1d4f960
Merge pull request #68 from astoeriko/develop
edvinskis Jul 20, 2026
cf5da87
Add CI, PyPI and docs badges to README
edvinskis Jul 20, 2026
37401a9
Generate and commit coverage badge
edvinskis Jul 20, 2026
72ca6d2
Replace admonition with inline note
edvinskis Jul 21, 2026
cd1d0f9
Create .gitignore
edvinskis Jul 21, 2026
9f7d618
Update transport-model.qmd
edvinskis Jul 21, 2026
cc07a66
Restructure API docs and update descriptions following script updates
edvinskis Jul 21, 2026
4e9c5b8
Update quickstart.qmd
edvinskis Jul 21, 2026
5277464
Update API reference
edvinskis Jul 21, 2026
105ffaa
Add images to the docs folder
edvinskis Jul 21, 2026
62374b4
Add logo to the site
edvinskis Jul 21, 2026
78eb902
Add logo to README
edvinskis Jul 21, 2026
7d9d0de
Merge pull request #67 from astoeriko/66-remove-pixi-files
edvinskis Jul 21, 2026
444352b
Merge pull request #69 from astoeriko/36-add-badges
astoeriko Jul 23, 2026
223c8f9
Merge pull request #70 from astoeriko/50-update-documentation-after-r…
astoeriko Jul 23, 2026
acec359
CI: adjust coverage workflow checkout & push
edvinskis Jul 23, 2026
4fc7afd
Merge pull request #71 from astoeriko/adjust-ci-covetage
edvinskis Jul 23, 2026
c1284a2
Use Codecov and remove badge commit step
edvinskis Jul 23, 2026
123ce1d
Replace coverage badge with Codecov badge
edvinskis Jul 23, 2026
4b28aa3
Add explaining text to the pathogen transport example
astoeriko Jun 8, 2026
c103e1f
Update parameter values and plots in pathogen transport example
astoeriko Jul 2, 2026
93d3b6e
Start document the PyMC example notebook
astoeriko Jul 9, 2026
514caaa
Finish tidying the notebook with the PyMC example
astoeriko Jul 23, 2026
6fa275d
Merge pull request #73 from astoeriko/adjust-ci-covetage
edvinskis Jul 23, 2026
c50382a
Delete .gitattributes
edvinskis Jul 23, 2026
f38a2bc
Merge pull request #74 from astoeriko/delete-gitattributes
edvinskis Jul 23, 2026
320b805
Merge pull request #62 from astoeriko/polish-examples
astoeriko Jul 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .gitattributes

This file was deleted.

14 changes: 5 additions & 9 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
pytest tests/ -v --tb=short \
--cov=src/reactix \
--cov-report=term-missing \
--cov-report=
--cov-report=xml:reports/coverage/coverage.xml

- name: Add coverage to job summary
run: |
Expand All @@ -50,11 +50,7 @@ jobs:
coverage report --show-missing >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY

# If uploading the coverage report to Codecov:
# uncomment the following lines and make sure you have a Codecov token set in your repository secrets.
# More information: https://docs.codecov.com/docs/quick-start
#
# - name: Upload coverage reports to Codecov with GitHub Action
# uses: codecov/codecov-action@v5
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# Reactix – Simulating 1-D reactive transport with differentiable models in JAX
![](https://raw.githubusercontent.com/astoeriko/reactix/refs/heads/develop/img/logo.svg)
# Simulating 1-D reactive transport with differentiable models in JAX

[![PyPI](https://img.shields.io/pypi/v/reactix)](https://pypi.org/project/reactix/)
[![Python](https://img.shields.io/pypi/pyversions/reactix)](https://pypi.org/project/reactix/)
[![PyTest](https://github.com/astoeriko/reactix/actions/workflows/pytest.yml/badge.svg)](https://github.com/astoeriko/reactix/actions/workflows/pytest.yml)
[![codecov](https://codecov.io/gh/astoeriko/reactix/branch/develop/graph/badge.svg)](https://codecov.io/gh/astoeriko/reactix)
[![License](https://img.shields.io/github/license/astoeriko/reactix)](LICENSE)
[![Docs](https://img.shields.io/badge/docs-latest-blue)](https://astoeriko.github.io/reactix/)

Reactix is a Python package for simulating reactive transport of chemical species suitable for one-dimensional systems with **advection, dispersion and kinetic reactions**.

Expand Down Expand Up @@ -55,8 +63,7 @@ reactix-env\Scripts\activate # Windows

Activate the environment before installing the package.

> [!NOTE]
> If you don't have `uv` installed, you can get it with:
> **Note:** If you don't have `uv` installed, you can get it with:

```bash
# Linux/macOS
Expand Down
Binary file added diagrams/class-diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions diagrams/class-diagram.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added diagrams/model-workflow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions diagrams/model-workflow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.quarto/
18 changes: 12 additions & 6 deletions docs/_quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ website:
back-to-top-navigation: true

navbar:
logo: img/logo_without_text.svg
left:
- href: index.qmd
text: Home
Expand Down Expand Up @@ -42,17 +43,17 @@ website:
- index.qmd
- installation.qmd
- quickstart.qmd

- text: "---"
- section: Examples
contents:
- examples/index.qmd
- examples/transport-model.qmd
- text: "---"

- text: "---"
- href: api/index.qmd
text: API reference

- text: "---"
- section: Development
contents:
Expand All @@ -69,13 +70,18 @@ quartodoc:
title: "API reference"
sections:
- title: Transport
desc: Core 1D reactive transport system objects and solver helpers.
desc: Spatial discretization, advection/dispersion schemes, and boundary conditions.
contents:
- System
- Cells
- Advection
- Dispersion
- FixedConcentrationBoundary

- title: Systems
desc: Reactive transport and system containers, and solver helpers.
contents:
- TransportSystem
- MixedSystem
- make_solver
- user_system_parameters

Expand Down
2 changes: 1 addition & 1 deletion docs/api/Advection.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Compute the advection rate for mobile species.
|--------|-----------------|---------------------------------|------------|
| time | jax.Array | Current simulation time. | _required_ |
| state | AbstractSpecies | Current species concentrations. | _required_ |
| system | System | The reactive transport system. | _required_ |
| system | TransportSystem | The reactive transport system. | _required_ |

#### Returns {.doc-section .doc-section-returns}

Expand Down
10 changes: 5 additions & 5 deletions docs/api/Dispersion.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ Compute dispersion coefficients for each species.

#### Parameters {.doc-section .doc-section-parameters}

| Name | Type | Description | Default |
|--------|-----------|--------------------------------|------------|
| time | jax.Array | Current simulation time. | _required_ |
| system | System | The reactive transport system. | _required_ |
| Name | Type | Description | Default |
|--------|-----------------|--------------------------------|------------|
| time | jax.Array | Current simulation time. | _required_ |
| system | TransportSystem | The reactive transport system. | _required_ |

#### Returns {.doc-section .doc-section-returns}

Expand All @@ -87,7 +87,7 @@ Compute the dispersion contribution to the species rate of change.
|--------|-----------------|---------------------------------|------------|
| time | jax.Array | Current simulation time. | _required_ |
| state | AbstractSpecies | Current species concentrations. | _required_ |
| system | System | The reactive transport system. | _required_ |
| system | TransportSystem | The reactive transport system. | _required_ |

#### Returns {.doc-section .doc-section-returns}

Expand Down
22 changes: 11 additions & 11 deletions docs/api/FixedConcentrationBoundary.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ unphysical behavior.

## Parameters {.doc-section .doc-section-parameters}

| Name | Type | Description | Default |
|---------------------|-----------------------------------------------|---------------------------------------------------------------------------------------------|-------------------------------------|
| fixed_concentration | float or Callable\[\[jax.Array\], jax.Array\] | The fixed concentration value, either constant or time-dependent. | _required_ |
| is_active | Callable\[\[jax.Array, System\], jax.Array\] | Function determining if the boundary condition is active. Inherited from BoundaryCondition. | `lambda t, system: jnp.array(True)` |
| species_selector | Callable | Function to select which species this applies to. Inherited from BoundaryCondition. | _required_ |
| boundary | Literal\[\'left\', \'right\'\] | Which boundary this applies to. Inherited from BoundaryCondition. | _required_ |
| Name | Type | Description | Default |
|---------------------|-------------------------------------------------------|---------------------------------------------------------------------------------------------|-------------------------------------|
| fixed_concentration | float or Callable\[\[jax.Array\], jax.Array\] | The fixed concentration value, either constant or time-dependent. | _required_ |
| is_active | Callable\[\[jax.Array, TransportSystem\], jax.Array\] | Function determining if the boundary condition is active. Inherited from BoundaryCondition. | `lambda t, system: jnp.array(True)` |
| species_selector | Callable | Function to select which species this applies to. Inherited from BoundaryCondition. | _required_ |
| boundary | Literal\[\'left\', \'right\'\] | Which boundary this applies to. Inherited from BoundaryCondition. | _required_ |

## Notes {.doc-section .doc-section-notes}

Expand All @@ -46,11 +46,11 @@ Compute the advective and dispersive flux at the boundary.

#### Parameters {.doc-section .doc-section-parameters}

| Name | Type | Description | Default |
|---------------------|-----------|-------------------------------------|------------|
| time | jax.Array | Current simulation time. | _required_ |
| system | System | The reactive transport system. | _required_ |
| boundary_cell_state | jax.Array | Concentration in the boundary cell. | _required_ |
| Name | Type | Description | Default |
|---------------------|-----------------|-------------------------------------|------------|
| time | jax.Array | Current simulation time. | _required_ |
| system | TransportSystem | The reactive transport system. | _required_ |
| boundary_cell_state | jax.Array | Concentration in the boundary cell. | _required_ |

#### Returns {.doc-section .doc-section-returns}

Expand Down
88 changes: 88 additions & 0 deletions docs/api/MixedSystem.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# MixedSystem { #reactix.MixedSystem }

```python
MixedSystem(
reactions=list(),
discharge,
inflow_concentration,
volume,
parameters=None,
)
```

Represents a mixed (batch) reactor system without spatial transport.

This class models a well-mixed reactor where species concentrations are
uniform throughout the volume. It supports kinetic reactions, inflow/outflow,
and user-defined parameters.

## Parameters {.doc-section .doc-section-parameters}

| Name | Type | Description | Default |
|----------------------|---------------------------------------------------|----------------------------------------------------------------------------------------------------|------------|
| reactions | list\[KineticReaction\] | List of kinetic reactions. Default is empty list. | `list()` |
| discharge | Callable\[\[jax.Array\], jax.Array\] or jax.Array | Function that computes discharge (volumetric flow rate) given time, or a constant discharge value. | _required_ |
| inflow_concentration | AbstractSpecies | Concentration of species in the inflow. | _required_ |
| volume | jax.Array | Volume of the mixed reactor. | _required_ |
| parameters | Any | Additional system parameters. Default is None. | `None` |

## Methods

| Name | Description |
| --- | --- |
| [build](#reactix.MixedSystem.build) | Build a configured mixed reactor system. |
| [compute_inflow_outflow](#reactix.MixedSystem.compute_inflow_outflow) | Compute the inflow/outflow contribution to the rate of change of concentrations. |

### build { #reactix.MixedSystem.build }

```python
MixedSystem.build(
reactions=None,
discharge,
inflow_concentration,
volume,
parameters=None,
)
```

Build a configured mixed reactor system.

This convenience constructor validates input shapes and
normalizes scalar inputs before creating a MixedSystem instance.

#### Parameters {.doc-section .doc-section-parameters}

| Name | Type | Description | Default |
|----------------------|---------------------------------------------------|------------------------------------------------|------------|
| reactions | list\[KineticReaction\] or None | List of kinetic reactions. Default is None. | `None` |
| discharge | Callable\[\[jax.Array\], jax.Array\] or jax.Array | Discharge function or scalar discharge value. | _required_ |
| inflow_concentration | AbstractSpecies | Concentration of species in the inflow. | _required_ |
| volume | jax.Array | Volume of the mixed reactor. | _required_ |
| parameters | Any or None | Additional system parameters. Default is None. | `None` |

#### Returns {.doc-section .doc-section-returns}

| Name | Type | Description |
|--------|-------------|----------------------------------|
| | MixedSystem | Configured mixed reactor system. |

### compute_inflow_outflow { #reactix.MixedSystem.compute_inflow_outflow }

```python
MixedSystem.compute_inflow_outflow(time, state)
```

Compute the inflow/outflow contribution to the rate of change of concentrations.

#### Parameters {.doc-section .doc-section-parameters}

| Name | Type | Description | Default |
|--------|-----------------|---------------------------------|------------|
| time | jax.Array | Current simulation time. | _required_ |
| state | AbstractSpecies | Current species concentrations. | _required_ |

#### Returns {.doc-section .doc-section-returns}

| Name | Type | Description |
|--------|-----------------|-----------------------------------------------|
| | AbstractSpecies | Rate of change due to inflow/outflow (dc/dt). |
26 changes: 13 additions & 13 deletions docs/api/System.qmd → docs/api/TransportSystem.qmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# System { #reactix.System }
# TransportSystem { #reactix.TransportSystem }

```python
System(
TransportSystem(
porosity,
discharge,
cells,
Expand Down Expand Up @@ -38,13 +38,13 @@ species mobility, reactions, and boundary conditions.

| Name | Description |
| --- | --- |
| [build](#reactix.System.build) | Build a configured reactive transport system. |
| [cell_velocity](#reactix.System.cell_velocity) | Compute the pore-water velocity in each cell. |
| [build](#reactix.TransportSystem.build) | Build a configured reactive transport system. |
| [cell_velocity](#reactix.TransportSystem.cell_velocity) | Compute the pore-water velocity in each cell. |

### build { #reactix.System.build }
### build { #reactix.TransportSystem.build }

```python
System.build(
TransportSystem.build(
cells,
advection,
dispersion,
Expand All @@ -60,7 +60,7 @@ System.build(
Build a configured reactive transport system.

This convenience constructor validates input shapes and
normalizes scalar inputs before creating a System instance.
normalizes scalar inputs before creating a TransportSystem instance.

#### Parameters {.doc-section .doc-section-parameters}

Expand All @@ -71,27 +71,27 @@ normalizes scalar inputs before creating a System instance.
| dispersion | Dispersion | Dispersion scheme parameters. | _required_ |
| bcs | list\[BoundaryCondition\] or None | List of boundary conditions. Default is None. | `None` |
| species_is_mobile | AbstractSpecies | Species mobility information. | _required_ |
| reactions | list\[BoundaryCondition\] or None | List of kinetic reactions. Default is None. | `None` |
| reactions | list\[KineticReaction\] or None | List of kinetic reactions. Default is None. | `None` |
| discharge | Callable\[\[jax.Array\], jax.Array\] or jax.Array | Discharge function or scalar discharge value. | _required_ |
| porosity | jax.Array | Porosity of the medium, either scalar or per cell. | _required_ |
| parameters | Any or None | Additional system parameters. Default is None. Must be created with @user_system_parameters for spatial operations. | `None` |

#### Returns {.doc-section .doc-section-returns}

| Name | Type | Description |
|--------|--------|---------------------------------------|
| | System | Configured reactive transport system. |
| Name | Type | Description |
|--------|-----------------|---------------------------------------|
| | TransportSystem | Configured reactive transport system. |

#### Raises {.doc-section .doc-section-raises}

| Name | Type | Description |
|--------|------------|-----------------------------------------------------------------------------------------------------|
| | ValueError | If porosity has an invalid shape or a boundary condition is incompatible with the selected species. |

### cell_velocity { #reactix.System.cell_velocity }
### cell_velocity { #reactix.TransportSystem.cell_velocity }

```python
System.cell_velocity(t)
TransportSystem.cell_velocity(t)
```

Compute the pore-water velocity in each cell.
Expand Down
7 changes: 5 additions & 2 deletions docs/api/_sidebar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ website:
- contents:
- api/index.qmd
- contents:
- api/System.qmd
- api/Cells.qmd
- api/Advection.qmd
- api/Dispersion.qmd
- api/FixedConcentrationBoundary.qmd
section: Transport
- contents:
- api/TransportSystem.qmd
- api/MixedSystem.qmd
- api/make_solver.qmd
- api/user_system_parameters.qmd
section: Transport
section: Systems
- contents:
- api/declare_species.qmd
section: Species
Expand Down
14 changes: 11 additions & 3 deletions docs/api/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,24 @@

## Transport

Core 1D reactive transport system objects and solver helpers.
Spatial discretization, advection/dispersion schemes, and boundary conditions.

| | |
| --- | --- |
| [System](System.qmd#reactix.System) | Represents a 1D reactive transport system. |
| [Cells](Cells.qmd#reactix.Cells) | Represents the spatial discretization of a 1D domain into cells. |
| [Advection](Advection.qmd#reactix.Advection) | Handles advection terms in the 1D transport equation using TVD schemes. |
| [Dispersion](Dispersion.qmd#reactix.Dispersion) | Handles dispersion and diffusion terms in the transport equation. |
| [FixedConcentrationBoundary](FixedConcentrationBoundary.qmd#reactix.FixedConcentrationBoundary) | Boundary condition with fixed concentration at the domain boundary. |
| [make_solver](make_solver.qmd#reactix.make_solver) | Create a JIT-compiled solver function for reactive transport simulations. |

## Systems

Reactive transport and system containers, and solver helpers.

| | |
| --- | --- |
| [TransportSystem](TransportSystem.qmd#reactix.TransportSystem) | Represents a 1D reactive transport system. |
| [MixedSystem](MixedSystem.qmd#reactix.MixedSystem) | Represents a mixed (batch) reactor system without spatial transport. |
| [make_solver](make_solver.qmd#reactix.make_solver) | Create a JIT-compiled solver function for reactix simulations. |
| [user_system_parameters](user_system_parameters.qmd#reactix.user_system_parameters) | Decorate system parameter classes with spatial awareness. |

## Species
Expand Down
Loading
Loading