Skip to main content

A Python interface to parse and plot OpenFOAM residuals

Project description

CI PyPI

OpenFOAM-Residuals

A Python tool to parse and plot residual data from OpenFOAM case directories. This tool is designed to work with output from Eddy3D, an airflow and microclimate simulation plugin for Rhino and Grasshopper, but can be used with standard OpenFOAM residual files as well.

Features

  • Automatic Detection: Recursively finds residuals*.dat and OpenFOAM log.* files in case directories.
  • Batch Processing: Handle multiple case directories or single files.
  • Plotting: Generates high-quality PNG plots of residuals vs. iterations.
  • Data Export: Exports cleaned data for further analysis.
  • Smart Scaling: Automatically adjusts plot scales based on residual magnitude.

Requirements

  • Python 3.10 or later

Installation

Install from PyPI:

pip install openfoam-residuals

or with uv:

uv add openfoam-residuals

Development Setup

  1. Clone the repository:

    git clone https://github.com/Eddy3D-Dev/OpenFOAM-Residuals.git
    cd OpenFOAM-Residuals
    
  2. Install dependencies:

    uv sync
    

Usage

You can run the tool directly using uv run:

Single File

Plot residuals for a specific file (residuals*.dat or log.*):

uv run python -m openfoam_residuals.main -f /path/to/residuals.dat

Case Directory

Automatically find and plot all residual files in a directory (recursive):

uv run python -m openfoam_residuals.main -w /path/to/case/dir

Multiple Directories

Process multiple case directories at once:

uv run python -m openfoam_residuals.main -w case1 -w case2

Options

  • -o, --out: Specify output directory (default: exports).
  • --no-plots: Skip plot generation and only export data.
  • -v, --verbose: Increase logging verbosity (e.g., -vv).

Development

Running Tests

uv run pytest

License

GNU General Public License v3 (GPLv3)

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

openfoam_residuals-0.3.1.tar.gz (519.6 kB view details)

Uploaded Source

Built Distribution

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

openfoam_residuals-0.3.1-py3-none-any.whl (24.4 kB view details)

Uploaded Python 3

File details

Details for the file openfoam_residuals-0.3.1.tar.gz.

File metadata

  • Download URL: openfoam_residuals-0.3.1.tar.gz
  • Upload date:
  • Size: 519.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for openfoam_residuals-0.3.1.tar.gz
Algorithm Hash digest
SHA256 1b20333e6dd6ed46a98602e611ceaa684bf000b8c267505f68653e66129e3a84
MD5 cbae53b27b00326afa13b6afed33cc1d
BLAKE2b-256 a3975f13c1625285eedfad806bc40b3fcc4d584e07510704a3d5100d56caa0ef

See more details on using hashes here.

File details

Details for the file openfoam_residuals-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: openfoam_residuals-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 24.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for openfoam_residuals-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 877142e8a4eaa291d551bac0ab5c6c4c22b32f434907715435748183f9fe5d04
MD5 5e7b464060dc5440e9af174f6c7b894f
BLAKE2b-256 2f3cc17cf829dfed39b772dfd66080684339592c4b55f87a3270c735cd3be9cd

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