Skip to main content

A Python-based process simulation framework for chemical engineering applications.

Project description

Process Forge

A Python-based process simulation framework for chemical process engineering applications.

Table of Contents

Features

Core Capabilities

  • Steady-state and dynamic process simulations
  • Thermodynamic property calculations using CoolProp
  • Multiple unit operations for hydraulic and thermal systems
  • Flowsheet modeling and solving with closed-loop (recycle) support

Recycle Loop Support

  • Automatic tear stream detection using graph analysis
  • Wegstein convergence acceleration for faster solving
  • Validation requirements ensure stability (Tank units required in loops)
  • Configurable convergence tolerance and iteration limits

Results & Visualization

  • Export formats: CSV and JSON for easy data analysis
  • Automatic plotting: temperature profiles and composition charts
  • Graphviz flowsheet diagrams (PNG and SVG)
  • Timeseries visualization for dynamic simulations

Validation & Quality

  • JSON schema validation for flowsheet configurations
  • Connectivity checks (inlet sources, unused outlets, unreachable units)
  • Comprehensive logging for debugging

Available Unit Operations

Unit Type Mode Description Key Parameters
Pump Steady-state Adds pressure rise with efficiency losses deltaP, efficiency
Valve Steady-state Isenthalpic pressure reduction pressure_ratio
Strainer Steady-state Fixed pressure drop element deltaP
Pipes Steady-state & Dynamic Laminar flow with friction losses delta_p, diameter
Tank Steady-state & Dynamic Well-mixed molar tank inlet, outlet_flow, initial_n, initial_T, P, duty
Flash Steady-state Isothermal flash separator P
Heater Steady-state Temperature control unit duty, flowrate

Installation

From PyPI

pip install processforge

From source (development)

  1. Clone the repository:

    git clone https://github.com/urjanova/processforge.git
    cd processforge
    
  2. Install the package:

    pip install -e ".[dev]"
    

    Or using uv:

    uv sync
    

Usage

Command Line Interface

ProcessForge provides a CLI with three subcommands:

# Run a simulation
processforge run flowsheets/closed-loop-chain.json

# Validate a flowsheet configuration
processforge validate flowsheets/closed-loop-chain.json

# Generate a flowsheet diagram
processforge diagram flowsheets/closed-loop-chain.json
processforge diagram flowsheets/closed-loop-chain.json --format svg --output-dir diagrams/

Running a simulation generates output files in the outputs/ directory:

  • *_results.json - Simulation results in JSON format
  • *_timeseries.json - Time-series data for dynamic simulations
  • *_timeseries.csv - Tabular results with component compositions
  • *_validation.xlsx - Validation report

As a Python Module

from processforge import Flowsheet, Pump, Tank, Pipes, validate_flowsheet

# Load and validate a flowsheet
config = validate_flowsheet("flowsheets/closed-loop-chain.json")

# Run simulation
fs = Flowsheet(config)
results = fs.run()

# Use individual unit operations
pump = Pump("my_pump", deltaP=1e5, efficiency=0.8)
outlet = pump.run({"T": 300, "P": 101325, "flowrate": 10, "z": {"Water": 1.0}})

Quick Start Examples

Run a simulation

processforge run flowsheets/closed-loop-chain.json

Validate a flowsheet

processforge validate flowsheets/closed-loop-chain.json

Generate a flowsheet diagram

processforge diagram flowsheets/closed-loop-chain.json

Project Structure

processforge/
├── src/processforge/              # Core package
│   ├── __init__.py               # Public API
│   ├── flowsheet.py              # Flowsheet modeling with closed-loop handling
│   ├── thermo.py                 # Thermodynamic calculations via CoolProp
│   ├── result.py                 # Results export (CSV, JSON, Excel, plotting)
│   ├── simulate.py               # CLI entry point with subcommands
│   ├── solver.py                 # Solver interface
│   ├── validate.py               # Simple schema validation
│   ├── _schema.py                # Schema loader (importlib.resources)
│   ├── units/                    # Unit operations
│   │   ├── pump.py               # Pump with efficiency
│   │   ├── valve.py              # Pressure-reducing valve
│   │   ├── strainer.py           # Pressure drop element
│   │   ├── pipes.py              # Pipe with friction losses
│   │   ├── tank.py               # Well-mixed tank (steady & dynamic)
│   │   ├── flash.py              # Isothermal flash separator
│   │   └── heater.py             # Temperature control heater
│   ├── utils/                    # Utilities
│   │   ├── validate_flowsheet.py # Schema + connectivity validation
│   │   └── flowsheet_diagram.py  # Graphviz visualization
│   └── schemas/                  # Bundled JSON schemas
│       └── flowsheet_schema.json
├── flowsheets/                    # Example flowsheet configurations
│   ├── closed-loop-chain.json    # Main example with recycle
│   └── archive/                  # Additional examples
├── pyproject.toml                # Project configuration
└── MANIFEST.in                   # Source distribution manifest

Dependencies

Core dependencies:

  • numpy - Numerical computing
  • scipy - Scientific computing and ODE solvers
  • coolprop - Thermodynamic property calculations
  • matplotlib - Plotting and visualization
  • loguru - Logging
  • jsonschema - Configuration validation
  • graphviz - Flowsheet diagram generation
  • pandas - Data manipulation
  • openpyxl - Excel report generation

License

This project is licensed under the BSD 3-Clause License. See the LICENSE file for details.

For licensing inquiries, please contact the development team.

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

processforge-0.1.0.tar.gz (37.4 kB view details)

Uploaded Source

Built Distribution

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

processforge-0.1.0-py3-none-any.whl (39.8 kB view details)

Uploaded Python 3

File details

Details for the file processforge-0.1.0.tar.gz.

File metadata

  • Download URL: processforge-0.1.0.tar.gz
  • Upload date:
  • Size: 37.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for processforge-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4db24ee4cc5512eba5e0cf34bca6bd4a59a3a2769622000c4c00959dbf4540d6
MD5 2aa7f75068bb4d4ae5d2668c711e111a
BLAKE2b-256 189a7c734bb7658c17e25924a5266fd14e1882ed71e0f9251ddf1c1a26a6fc7e

See more details on using hashes here.

File details

Details for the file processforge-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: processforge-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 39.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for processforge-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f9bf0a57959183e5739a092d31dadb1ab7fe429c4978d869b6d9a3484c89edd5
MD5 721ea5152a0ee2d744c72d2421e9700d
BLAKE2b-256 c7cb5fc57797bdbaded42d578f120e97e8288bd6c0911856eec1950de68ee336

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