Skip to main content

MANTIS Logo A Python framework to solve stiff reaction-transport systems in seconds using a Monolithic Assembly of Nonlinear Transport Interactions Solver (MANTIS)

Build Status Type Checking Documentation Status PyPI Version Python Versions License: AGPL-3.0-or-later

Reaction-transport systems involving fast precipitation/dissolution reactions are often extremely stiff. This poses a particular challenge in the geosciences, where the spatial extent of the reaction zone often requires centuries to kiloyears to reach equilibrium, whereas the reaction time scales are often on timescales of seconds. Operator splitting schemes that solve the fast reactions independently of transport are still time-step limited, as larger time steps result in mass imbalances. Here I present a Python framework that uses a fully coupled monolithic equation system that uses the Newton-Raphson scheme with a Block Thomas Algorithm that can be solved at almost arbitrary large time steps and often within a single iteration. This allows Mantis to solve stiff non-linear reaction networks within seconds, and in cases where a single iteration is sufficient, milliseconds. Mantis uses a finite volume framework paired with an intuitive template system to define species properties, kinetic constants, and reaction networks, including native support for kinetic and equilibrium isotope effects.

How is MANTIS Different from Other RTM Packages?

Many geochemical reactive-transport modeling packages rely on operator splitting (such as Sequential Non-Iterative Approach [SNIA] or Sequential Iterative Approach [SIA]) or decoupled Picard (Gauss-Seidel) iterations:

  1. Monolithic Coupling vs. Operator Splitting:

    • Operator splitting alternates between solving pure transport and pure batch chemistry over a time step. While simple, it introduces splitting errors and often requires tiny time steps ($\Delta t$ on the order of seconds or hours) to avoid artificial oscillations or numerical divergence when reactions are fast and stiff.
    • Picard iterations solve each chemical species sequentially, lagging cross-species couplings from the previous iteration. At sharp reaction fronts (e.g., where sulfide meets oxygen or ferric iron), this decoupling frequently causes severe numerical lag oscillations.
    • MANTIS solves the entire system monolithically: Transport and reactions for all species are assembled into a single unified block-tridiagonal linear system at each Newton step. This achieves true simultaneous coupling and quadratic Newton convergence.
  2. Unconditional Numerical Stability:

    • Thanks to its fully implicit monolithic formulation, MANTIS does not suffer from Courant-Friedrichs-Lewy (CFL) or diffusion time step stability restrictions, enabling long-term simulations (centuries to millennia) with large time steps.

Current Limitations

While MANTIS provides robust and unconditionally stable solutions for stiff reactive transport, the current release has the following limitations:

  1. Time-Invariant Spatial Mesh:
    • The spatial grid $z$ is static throughout the simulation. Dynamic grid adaptation, moving boundaries, or expanding domains (e.g., physical sediment column growth over time) are not currently supported.
  2. Time-Invariant Porosity:
    • The porosity profile $\phi(z)$ is stationary in time (steady-state compaction). Transient sediment compaction or compaction-driven dynamic fluid expulsion over time is not currently modeled.
  3. Time-Invariant Temperature:
    • The temperature profile of $T(z)$ is steady-state. Dynamic thermal evolution and time-dependent diffusion coefficients or rate constants driven by non-isothermal thermal transients are not currently supported.

Installation & Documentation

Please refer to https://mantis-rtm.readthedocs.io/en/latest

License

This project is licensed under the GPL-3.0 License. See the LICENSE file for details.

Metadata

Release files for mantis-rtm 0.7.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mantis-rtm 0.7.6
File Size Uploaded Provenance Actions
mantis_rtm-0.7.6.tar.gz 3.5 MB With provenance Details for mantis_rtm-0.7.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mantis-rtm 0.7.6
File Interpreter ABI Platform Actions
mantis_rtm-0.7.6-py3-none-any.whl Python 3 none any Details for mantis_rtm-0.7.6-py3-none-any.whl

Total release size: 3.6 MB

Release files / mantis_rtm-0.7.6.tar.gz

Download URL mantis_rtm-0.7.6.tar.gz
Size 3.5 MB
Tags Source
SHA-256 checksum
How to use checksums
44a81d86c7f9ddbc714d0d85002f27f954460c811771dad7b0b9c545fec30542
BLAKE2b-256 checksum
How to use checksums
83d9cb55e48b2cec149375cfd7f59c7fcab49e4aa42748ebde87e8c9b228ec4c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Release files / mantis_rtm-0.7.6-py3-none-any.whl

Download URL mantis_rtm-0.7.6-py3-none-any.whl
Size 172.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0636131392c6be6c23c4579e0b4c4c32213de181ae9b67fb8f91171edd349b2b
BLAKE2b-256 checksum
How to use checksums
7c36ac0433b2678027c17970d200ebde07869725a3ec4e1d4dfb5a0c44db9a95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Security for mantis-rtm 0.7.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mantis_rtm-0.7.6.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page