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.3.0.tar.gz (762.4 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.0-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: openfoam_residuals-0.3.0.tar.gz
  • Upload date:
  • Size: 762.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","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.0.tar.gz
Algorithm Hash digest
SHA256 e15725d42ab77d0a306b2eeb403ee06c759bb9a14cf11e8d355e8e1ebe9cced4
MD5 ce600a72bc30658698f29ca867dc9d47
BLAKE2b-256 3c3f4b438fa77ad436a0144530afe68263ca258dc6bb1a253dee995493c3ab93

See more details on using hashes here.

File details

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

File metadata

  • Download URL: openfoam_residuals-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 19.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b1c5291329665d4dd603bf84b15e3b5c3327fc5b74e9e2600ca17943f27f3e7d
MD5 869e1d44196fc87703d9bdd8b0335e0b
BLAKE2b-256 57ee9488d801908dcf9418e888d9c304e57a72728c658d92914d604b2037d72a

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