Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
gerlero committed Mar 5, 2025
1 parent 9627c72 commit 1395702
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
**foamlib** provides a simple, modern, ergonomic and fast Python interface for interacting with [OpenFOAM](https://www.openfoam.com).

<p align="center">
<img alt="benchmark" src="https://github.com/gerlero/foamlib/raw/main/benchmark.png" height="250">
<img alt="benchmark" src="https://github.com/gerlero/foamlib/raw/main/benchmark/benchmark.png" height="250">
<br>
<i>Parsing a </i>volVectorField<i> with 200k cells.</i>
<i>Parsing a </i>volVectorField<i> with 200k cells. [^benchmark]</i>
</p>

## 👋 Basics
Expand Down Expand Up @@ -154,3 +154,6 @@ case.run()
## 📘 Documentation
For more information, check out the [documentation](https://foamlib.readthedocs.io/).
[^benchmark]: foamlib 0.8.1 vs PyFoam 2023.7 on a MacBook Air (2020, M1) with 8 GB of RAM. [Benchmark script](benchmark/benchmark.py).
File renamed without changes
11 changes: 11 additions & 0 deletions benchmark/benchmark.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env python3

Check failure on line 1 in benchmark/benchmark.py

View workflow job for this annotation

GitHub Actions / lint

Ruff (EXE001)

benchmark/benchmark.py:1:1: EXE001 Shebang is present but file is not executable

Check failure on line 1 in benchmark/benchmark.py

View workflow job for this annotation

GitHub Actions / lint

Ruff (D100)

benchmark/benchmark.py:1:1: D100 Missing docstring in public module

import timeit

from foamlib import FoamFieldFile
from PyFoam.RunDictionary.ParsedParameterFile import ParsedParameterFile

Check failure on line 6 in benchmark/benchmark.py

View workflow job for this annotation

GitHub Actions / lint

Ruff (I001)

benchmark/benchmark.py:3:1: I001 Import block is un-sorted or un-formatted

FoamFieldFile("U").internal_field = [[0.0, 0.0, 0.0]] * 200_000

print(f"foamlib: {min(timeit.repeat(lambda: FoamFieldFile("U").internal_field, number=1))} s")

Check failure on line 10 in benchmark/benchmark.py

View workflow job for this annotation

GitHub Actions / lint

Ruff (T201)

benchmark/benchmark.py:10:1: T201 `print` found
print(f"PyFoam: {min(timeit.repeat(lambda: ParsedParameterFile("U")["internalField"], number=1))} s")

Check failure on line 11 in benchmark/benchmark.py

View workflow job for this annotation

GitHub Actions / lint

Ruff (T201)

benchmark/benchmark.py:11:1: T201 `print` found
2 changes: 2 additions & 0 deletions benchmark/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
foamlib==0.8.1
PyFoam==2023.7

0 comments on commit 1395702

Please sign in to comment.