foamlib: A modern Python interface for interacting with OpenFOAM

Autores/as

  • Gabriel S. Gerlero Centro de Investigación de Métodos Computacionales (CIMEC-CONICET/UNL). Santa Fe, Argentina. & Universidad Nacional de Rafaela. Rafaela, Prov. de Santa Fe, Argentina.
  • Pablo A. Kler Centro de Investigación de Métodos Computacionales (CIMEC-CONICET/UNL) & Universidad Tecnológica Nacional, Facultad Regional Santa Fe, Departamento de Ingeniería en Sistemas de Información. Santa Fe, Argentina.

Palabras clave:

OpenFOAM, Python, testing, Slurm

Resumen

We introduce foamlib, an open-source Python library developed for the purpose of interacting with OpenFOAM. foamlib provides an object-oriented interface for pre-processing, executing, and post-processing OpenFOAM cases, with capabilities for accessing and editing their related files. foamlib is mainly targeted towards testing and optimization runs, which commonly require executing a large number of different cases and analyzing their results programmatically. It has the capability to autodetect the steps needed to run a case, and will automatically arrange tasks so that multiple cases can run simultaneously without oversubscribing the available CPUs. It can even orchestrate runs across computing nodes in a Slurm-based cluster environment. foamlib includes its own custom parser and serializer for OpenFOAM files, which allows reading and writing these files even on systems without an OpenFOAM installation.In comparison with other related libraries also available, foamlib supports Python versions from 3.7 up to the latest release, and allows users to take advantage of modern Python features such as type checking and asynchronous programming. It can also read and write fields stored in files using OpenFOAM's optional mixed text/binary format. foamlib is distributed under a GPLv3 license as a registered Python package, as well as in the form of Docker images. It is compatible with the two major distributions of OpenFOAM.

Descargas

Publicado

2025-03-30

Número

Sección

Resúmenes del MECOM 2024