Skip to main content

A Python interface to parse and plot OpenFOAM residuals

Project description

CI GitHub Tag

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 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.

Installation

This project uses uv for dependency management.

  1. Install uv (if not already installed):

    curl -LsSf https://astral.sh/uv/install.sh | sh
    
  2. Clone the repository:

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

    uv sync
    

Usage

You can run the tool directly using uv run:

Single File

Plot residuals for a specific file:

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

Linting and Formatting

uv run ruff check
uv run ruff format

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.2.0.tar.gz (858.1 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.2.0-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: openfoam_residuals-0.2.0.tar.gz
  • Upload date:
  • Size: 858.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.14 {"installer":{"name":"uv","version":"0.9.14","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.2.0.tar.gz
Algorithm Hash digest
SHA256 2a750d54423b6257ea2b8bdf5e1ceae21e2cc280446e326790599dc965a3e6f7
MD5 21edd4687469fd3472898099fdd0d145
BLAKE2b-256 4fa5917b11f8446dc6a9a0e4a9d2b94a0f250a5a7eea0c9f57b327eda1a13f5c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: openfoam_residuals-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 18.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.14 {"installer":{"name":"uv","version":"0.9.14","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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7a831f70b20ac936f4fccf3d4629f1ea7d4c26a49c6c73fe1bd004b01bf0ad31
MD5 db19ed2576f2b3aa2f7ef49a21601406
BLAKE2b-256 64b74bbea0697cfae52db94840d334e1efec89fcb9a64133fcd895ce132d79a8

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