Skip to main content

Python solvers for adsorption isotherm fitting, mixture prediction, breakthrough simulation, Crank diffusion, and ZLC modelling.

Project description

pysorb

pysorb is a Python library for adsorption modelling across equilibrium and dynamic kinetic workflows. It connects reusable numerical solvers for scripted scientific computing with GUI-facing adsorption workflows.

The current package supports pure-component isotherm fitting, multicomponent mixture prediction, fixed-bed breakthrough simulation, Crank diffusion uptake analysis, and zero length column (ZLC) modelling. The numerical routines use NumPy and SciPy, with Numba-compatible kernels used in the mixture and breakthrough solvers for repeated numerical evaluation.

The package contains five solver areas:

  • pysorb.mix for multicomponent equilibrium calculations.
  • pysorb.bt for fixed-bed breakthrough simulations.
  • pysorb.fit for adsorption isotherm fitting.
  • pysorb.crank for Crank diffusion uptake calculations.
  • pysorb.zlc for zero length column simulations.

The current package release is 0.2.2; version 0.1.0 was used as an initial PyPI test release.

Citation

Citation metadata is provided in CITATION.cff.

Archived release DOI: 10.5281/zenodo.20478633

Installation

pip install pysorb

For local development from this repository:

pip install -e .

Basic Usage

from pysorb.crank import crank_uptake, fit_D_R2
from pysorb.zlc import linmodel
from pysorb.mix import parse, unary, ext, iast
from pysorb.fit import fit_isotherm
from pysorb.bt import run_simulation

Crank diffusion

from pysorb.crank import crank_uptake

q_over_qinf = crank_uptake([0, 1, 2], D_R2=0.001)

ZLC

from pysorb.zlc import linmodel

t, c, c_preload, q, q_preload, sigsum = linmodel(
    Lsat=20,
    DR2=6.4e-3,
    gamma=0.001,
    tsat=50,
    t_end=80,
    NN="auto",
)

Mixture equilibrium

from pysorb.mix import parse, iast

components = [
    {"MoleculeName": "A", "isotherms": [["Langmuir", 1.0, 0.5]]},
    {"MoleculeName": "B", "isotherms": [["Langmuir", 2.0, 0.2]]},
]

parsed = parse(components)
result = iast([1.0, 0.5], parsed=parsed)

Isotherm fitting

import numpy as np
from pysorb.fit import fit_isotherm

P = np.array([0.1, 0.3, 0.7, 1.2, 2.0])
T = np.full_like(P, 298.15)
q = 1.5 * 0.8 * P / (1 + 0.8 * P)

fit = fit_isotherm(P, q, T, "Langmuir", mode="single")
print(fit.parameters)

Breakthrough

from pysorb.bt import run_simulation

# Pass the same input dictionary shape used by the existing BT solver.
result = run_simulation(inputs)

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

pysorb-0.2.2.tar.gz (48.6 kB view details)

Uploaded Source

Built Distribution

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

pysorb-0.2.2-py3-none-any.whl (49.9 kB view details)

Uploaded Python 3

File details

Details for the file pysorb-0.2.2.tar.gz.

File metadata

  • Download URL: pysorb-0.2.2.tar.gz
  • Upload date:
  • Size: 48.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for pysorb-0.2.2.tar.gz
Algorithm Hash digest
SHA256 bb2a734b7b76d6340743e183e655d97cc3bc774fa4a2cef1840fbb4918f3acf2
MD5 c2416aa30b50cbce2ca3e25be877f69f
BLAKE2b-256 3f2b87b4b5f9e9c77de44bf46daf37c26011685823a70e839093ee429d34ee13

See more details on using hashes here.

File details

Details for the file pysorb-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: pysorb-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 49.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for pysorb-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 49a3595a0f34f93fa3e5032ae5dae2ebf6f78f30599269b40ba6f44a5f2dbb5c
MD5 377d4b1ae934b3af55a52b3359d17b5f
BLAKE2b-256 da60bcb28bfb5730943f4ba4296e25c543405173fcc8d81aee51384a6ee5a921

See more details on using hashes here.

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