tpt-process

Rust

Open-source, MIT-licensed pure-Rust computational engine for chemical & process engineering — thermodynamics, fluid flow, heat transfer, separations, reaction engineering, and flowsheet simulation, with WASM support.

0 stars0 forks0 watchersApache License 2.0

Languages

Rust99.3%Liquid0.7%
README

tpt-process

CI License check Crates.io docs.rs License MSRV

A fully open-source, MIT-licensed computational engine for chemical and process engineering: thermodynamics, fluid flow, heat transfer, separations, and reaction engineering.

100% Open Source. Chemical & Process Engineering Without Vendor Lock-in. No GPL Traps. No Desktop Monopolies.

5-Minute Quickstart

Create a project and depend on the suite (published to crates.io at the next release; until then use the git dependency):

# Cargo.toml
[dependencies]
tpt-proc-core = { git = "https://github.com/tpt-solutions/tpt-process" }
tpt-proc-thermo-core = { git = "https://github.com/tpt-solutions/tpt-process" }
tpt-proc-thermo-database = { git = "https://github.com/tpt-solutions/tpt-process" }
tpt-proc-thermo-eos = { git = "https://github.com/tpt-solutions/tpt-process" }
tpt-proc-thermo-phase = { git = "https://github.com/tpt-solutions/tpt-process" }

Paste this into src/main.rs — a Peng-Robinson flash of a 50/50 water/methanol feed at 350 K, 1 atm:

use std::sync::Arc;

use tpt_proc_core::Composition;
use tpt_proc_thermo_core::PropertyPackage;
use tpt_proc_thermo_database::ChemicalDatabase;
use tpt_proc_thermo_eos::CubicEos;
use tpt_proc_thermo_phase::FlashSolver;

fn main() {
    let db = ChemicalDatabase::builtin();
    let components = db.components_for(&["water", "methanol"]).unwrap();
    let eos = CubicEos::peng_robinson(components.clone());
    let package = PropertyPackage::new(components).unwrap().with_eos(Arc::new(eos));
    let flash = FlashSolver::new(package);

    let feed = Composition::from_mole_fractions(&[0.5, 0.5]).unwrap();
    let result = flash.pt_flash(&feed, 350.0, 101_325.0).unwrap();

    println!("Vapor fraction: {}", result.vapor_fraction);
    println!("Vapor composition: {:?}", result.vapor_composition.as_slice());
}
cargo run
# Vapor fraction: 0.55…

Prefer no Rust at all? The tpt-proc CLI runs a TOML-described flowsheet — mixers, splitters, flash drums, heaters, valves, pumps with recycles — see crates/cli/tpt-proc. Worked Rust examples live in examples/:

git clone https://github.com/tpt-solutions/tpt-process
cd tpt-process
cargo run --release -p example-flash-calculation

Why?

Commercial process simulators (Aspen HYSYS, Aspen Plus, ChemCAD, PRO/II, gPROMS) cost $30k–$100k+ per seat, are closed-source, and lock your property data behind recurring license fees. tpt-process breaks all three locks:

  • Pure Rust — fast enough for real-time control, safe enough for long dynamic simulations, deterministic enough for auditable designs.
  • Open databank — a built-in chemical database that is a public good, not a ransom.
  • WebAssembly — flash calculations, heat exchanger ratings, and distillation shortcuts run in the browser or on edge controllers.
  • Strict permissive license chain — MIT OR Apache-2.0 end to end, with cargo deny enforcement so no copyleft dependency can ever enter the tree.

Crates

Status tiers reflect real coverage, not aspiration: ✅ Stable = the implemented physics is textbook-benchmarked and the API is settled; 🧪 Beta = solid for pre-design but model coverage is narrower than the domain (see each crate's README "Scope and limitations"); 🚧 Alpha = under active development; 🔗 Integration = bridges into the other TPT substrate repositories, workspace-only (git dependency, never on crates.io).

CrateDescriptionStatus
tpt-proc-coreCore stream and unit types✅ Stable
tpt-proc-topologyPFD graph analysis, recycles, tear streams✅ Stable
tpt-proc-unitsUnit operation scaffolding, mixer/splitter✅ Stable
tpt-proc-thermo-coreProperty package framework✅ Stable
tpt-proc-thermo-eosPeng-Robinson, SRK equations of state✅ Stable
tpt-proc-thermo-activityWilson, NRTL, UNIQUAC, UNIFAC✅ Stable
tpt-proc-thermo-phaseFlash calculations, VLE, bubble/dew point✅ Stable
tpt-proc-thermo-databaseBuilt-in chemical database (51 components, sourced + gated)✅ Stable
tpt-proc-fluidPipe flow, Darcy-Weisbach, Colebrook-White✅ Stable
tpt-proc-pumpsPump curves, operating point, affinity laws✅ Stable
tpt-proc-compressorsIsentropic/polytropic compression✅ Stable
tpt-proc-valvesCv/Kv sizing, inherent characteristics✅ Stable
tpt-proc-networkHardy Cross, Newton-Raphson, Linear Theory✅ Stable
tpt-proc-heat-transferConvection correlations, Nusselt number✅ Stable
tpt-proc-heat-exchangersLMTD, NTU-effectiveness, rating/sizing✅ Stable
tpt-proc-heat-networkPinch analysis, composite curves, HEN✅ Stable
tpt-proc-fired-equipmentFurnaces and fired heaters✅ Stable
tpt-proc-distillationMcCabe-Thiele, FUG, rigorous MESH✅ Stable
tpt-proc-absorptionKremser absorption/stripping✅ Stable
tpt-proc-reactionKinetics: Arrhenius, power law, LHHW, Michaelis-Menten✅ Stable
tpt-proc-mass-balanceBalances and data reconciliation✅ Stable
tpt-proc-optimizationGolden section, Nelder-Mead, gradient✅ Stable
tpt-proc-hvacPsychrometrics and air systems✅ Stable
tpt-proc-economicsCAPEX/OPEX, NPV/IRR, levelized cost✅ Stable
tpt-proc-databaseGeneral process data store✅ Stable
tpt-proc-extractionLiquid-liquid extraction🧪 Beta
tpt-proc-membranesSolution-diffusion membrane separations🧪 Beta
tpt-proc-crystallizationCooling crystallization, MSMPR🧪 Beta
tpt-proc-reactorsSteady-state CSTR and PFR🧪 Beta
tpt-proc-catalysisEffectiveness factor, deactivation🧪 Beta
tpt-proc-flowsheetSequential-modular solver, tear streams + Wegstein🧪 Beta
tpt-proc-energy-balanceEnergy accounting and utility summary🧪 Beta
tpt-proc-waterWater treatment train simulation🧪 Beta
tpt-proc-pharmaPharmaceutical batch processes🧪 Beta
tpt-proc-refiningRefining stream characterization🧪 Beta
tpt-proc-hydrogenElectrolysis, SMR, ATR🧪 Beta
tpt-proc-dynamicsDynamic simulation, FOPDT, integrators🧪 Beta
tpt-proc-controlPID control and tuning🧪 Beta
tpt-proc-pfdPFD representation and export (SVG/DOT/Mermaid)🧪 Beta
tpt-proc (CLI)Config-driven flowsheet runner (TOML → JSON)🧪 Beta
tpt-proc-wasmWebAssembly bindings🚧 Alpha
tpt-proc-energyPinch targets → tpt-energy system models🔗 Integration
tpt-proc-materialsStreams → tpt-materials compositions🔗 Integration
tpt-proc-constructionPFD → tpt-construction site/project🔗 Integration

Every crate has its own README.md (with scope-and-limitations) and CHANGELOG.md alongside its sources under crates/.

Governance

  • License: MIT OR Apache-2.0 (dual). Contributions are DCO-signed and CLA-free.
  • Releases: SemVer, 6-week cadence.
  • Decisions: Benevolent Dictator + public RFC process for new unit operations and thermodynamic models.
  • Security: see SECURITY.md for private disclosure.

The Process Connector

tpt-process is the flowsheet brain of the TPT ecosystem. Live integration crates (in crates/integration/, pinned to the substrate repositories) connect the domains today:

  • tpt-proc-energy → tpt-energy: pinch utility targets become electrical loads and CHP capacity on an EnergySystem power-flow model.
  • tpt-proc-materials → tpt-materials: species mixtures translate to elemental Compositions, with an NMC hydroxide precursor process design feeding battery work.
  • tpt-proc-construction → tpt-construction: PFD units export as deterministic Site/Element records for plant layout.
  • tpt-medical ← pharmaceutical batch processes — planned; awaiting code in the counterpart repository.

Validation

Solver results are checked against golden reference files in test-data/golden/ and against public benchmarks (DIPPR, NIST, AIChE, API, ASHRAE). See CONTRIBUTING.md for the verification & validation policy.

License

Licensed under either of

at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.