Skip to main content

Fluidsimfoam

PyPI Documentation Status

Python framework for OpenFOAM

OpenFOAM is a very popular open-source C++ CFD framework. With Fluidsimfoam, we try to design and propose a new workflow for OpenFOAM based on Python. However, experienced OpenFOAM users won't be lost because Fluidsimfoam produces in the end standard OpenFOAM cases and it's always possible to come back to the standard OpenFOAM workflow.

Fluidsimfoam can be seen as a workflow manager for OpenFOAM or a Python wrapper around OpenFOAM. It only uses OpenFOAM commands on the background and is thus NOT a rewrite of OpenFOAM!

Fluidsimfoam should be especially useful for:

  • automatisation of simulation launching for example for parametric studies or optimization,
  • programmatic generation of complex and parametrized input files (for example blockMeshDict) and initial conditions,
  • programmatic control of a simulation at runtime (an example here).

However, Fluidsimfoam is not restricted to these usages and should be convenient, especially for people knowing Python, for any OpenFOAM usages for which C++ programming is not needed.

Working with OpenFOAM implies writting and modifying a lot of input files describing a simulation. The method described in the official OpenFOAM documentations is to copy an existing simulation directory and to modify the input files by hand.

With Fluidsimfoam, we introduce the possibility to describe not only one case (as shown in the OpenFOAM tutorials), but sets of similar simulations. The description of one set of simulations is done in Python (and possibly with Jinja templates) in a small Python package that we call a "Fluidsim solver".

"[Fluidsim] solver" and "OpenFOAM solvers" are very different things. A
Fluidsim solver is a small Python package describing a set of simulations.
Fluidsimfoam allows one to write Fluidsim solvers based for the simulations
on OpenFOAM.

As shown in our tutorials, with a Fluidsimfoam solver, it becomes very easy to

  • launch/restart simulations with Python scripts and terminal commands,
  • load simulations, read the associated parameters/data and produce nice figures/movies.

There are open-source solvers (some of them are included in our main repository) and it is not be difficult to write your own solver based on your OpenFOAM cases. For example, to produce a solver from an existing case, one can run

fluidsimfoam-initiate-solver cylinder -c $FOAM_TUTORIALS/basic/potentialFoam/cylinder

This command creates a solver fluidsimfoam-cylinder that can be used to run the simulation described in the Flow around a cylinder tutorial. But this solver can very easily be improved to be parametrized and to produce some input files programmatically. For example, the mesh of this tutorial is produced with the blockMesh OpenFOAM utility and the blockMeshDict is quite complex and contains a #codeStream directive (which implies writting C++ and compilations). With Fluidsimfoam, you can avoid this step and produce the blockMeshDict programmatically with a nice Python API and a nice mechanism to add and store parameters.

The best way to use Fluidsimfoam is to write or use a solver adapted for your particular use case. However, one can also use Python functions and classes provided by Fluidsimfoam for some common tasks, like parsing/writting input files, modifying field files, writting blockMeshDict files, etc.

Fluidsimfoam is now usable but still in quite early development. There are still very low hangling fruits not yet implemented (for example, restart utilities, production of figures and movies, etc.) and our documentation does not reflect what people can and will be able to do with this tool. One goal is to get the equivalent of Snek5000, our Fluidsim framework for the CFD code Nek5000. Looking at the Snek5000 tutorials should give a good idea of what Fluidsimfoam will soon allow.

This project is young and we need any kind of feedback and [contributions].
Don't be afraid that the project is not hosted on Github. If you think that
this project is interesting please *star* [our repository on
Heptapod](https://foss.heptapod.net/fluiddyn/fluidsimfoam) and/or [open
issues](https://foss.heptapod.net/fluiddyn/fluidsimfoam/-/issues) with
feedback, feature requests or bug reports. Moreover, we would be very happy to
welcome new core developers, so if you like OpenFOAM and Python, do not
hesitate!

For our examples, we currently target OpenFOAM v2206 but it should be possible to write Fluidsimfoam solvers targeting any recent OpenFOAM versions.

See more in Fluidsimfoam documentation.

Install

Currently, it still makes sense to install Fluidsimfoam like we, the fluidsimfoam developers, install it, i.e. in a dedicated controlled virtual environment created by PDM. After installing PDM (for example with something like pipx install pdm), the following commands should install and activate the virtual environment:

hg clone https://foss.heptapod.net/fluiddyn/fluidsimfoam
cd fluidsimfoam
pdm install
pdm venv activate

Related projects

Metadata

Release files for fluidsimfoam 0.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fluidsimfoam 0.0.8
File Size Uploaded Provenance Actions
fluidsimfoam-0.0.8.tar.gz 78.3 kB Without provenance Details for fluidsimfoam-0.0.8.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fluidsimfoam 0.0.8
File Interpreter ABI Platform Actions
fluidsimfoam-0.0.8-py3-none-any.whl Python 3 none any Details for fluidsimfoam-0.0.8-py3-none-any.whl

Total release size: 142.2 kB

Release files / fluidsimfoam-0.0.8.tar.gz

Download URL fluidsimfoam-0.0.8.tar.gz
Size 78.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e43936bf8d467ea361a56ed58fb936bf3bf9a715bf356a0e91a826498e5602f8
BLAKE2b-256 checksum
How to use checksums
2bcd5c06765a8ea920c793c7142963fee9b4f1444a9bad6fd314a4c55a8c42a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via pdm/2.22.3 CPython/3.9.2 Linux/5.10.0-33-amd64

Release files / fluidsimfoam-0.0.8-py3-none-any.whl

Download URL fluidsimfoam-0.0.8-py3-none-any.whl
Size 63.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
42a685357f49a726db346fcf35dabd1b0041903f0696ebaa487ac6300cad9bce
BLAKE2b-256 checksum
How to use checksums
2e9899500b7a9254478aedbb4e351a59334c0b6a6d6bc989f2cf304822354edf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via pdm/2.22.3 CPython/3.9.2 Linux/5.10.0-33-amd64

Security for fluidsimfoam 0.0.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page