Skip to content

Commit 351fd58

Browse files
authored
Merge pull request #9 from daavid00/dev
Performance improvements
2 parents 2e668f2 + 415195c commit 351fd58

38 files changed

Lines changed: 294 additions & 762 deletions

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ Creation of [_OpenFOAM_](https://www.openfoam.com) simulation models from given
1313

1414
## Installation
1515
You will first need to install
16-
* OpenFOAM (https://www.openfoam.com) (tested with OpenFOAM-12)
17-
* Gmsh (https://gmsh.info) (tested with Gmsh 4.13.1)
16+
* OpenFOAM (https://www.openfoam.com) (tested with OpenFOAM-13)
17+
* Gmsh (https://gmsh.info) (tested with Gmsh 4.14.0)
1818

1919
To install the _pymm_ executable from the development version:
2020

@@ -43,7 +43,7 @@ pip install -e .
4343
pip install -r dev-requirements.txt
4444
```
4545

46-
See the [_OpenFOAM page_](https://openfoam.org/download/12-ubuntu/), where from OpenFOAM-12 the simulator is available via apt get.
46+
See the [_OpenFOAM page_](https://openfoam.org/download/13-ubuntu/), where from OpenFOAM-12 the simulator is available via apt get.
4747

4848
## Running pymm
4949
You can run _pymm_ as a single command line:
@@ -65,6 +65,6 @@ The following is a list of journal papers in which _pymm_ is used:
6565
1. Liu, N., Haugen, M., Benali, B., Landa-Marbán, D., Fernø, M.A., 2023. Pore-scale kinetics of calcium dissolution and secondary precipitation during geological carbon storage. Chem. Geol. 641, 121782. https://doi.org/10.1016/j.chemgeo.2023.121782.
6666

6767
## About pymm
68-
_pymm_, an image-based Python package for computational fluid dynamics, is funded by [_Center for Sustainable Subsurface Resources_](https://cssr.no) [project no. 331841] and [_NORCE Norwegian Research Centre As_](https://www.norceresearch.no) [project number 101070].
68+
_pymm_, an image-based Python package for computational fluid dynamics, is funded by [_Center for Sustainable Subsurface Resources_](https://cssr.no) [project no. 331841] and [_NORCE Research As_](https://www.norceresearch.no) [project number 101070].
6969
Contributions are more than welcome using the fork and pull request approach.
7070
For a new feature, please request this by raising an issue.

docs/_images/contents.png

-4.26 KB
Loading

docs/_sources/device.rst.txt

Lines changed: 0 additions & 21 deletions
This file was deleted.

docs/_sources/examples.rst.txt

Lines changed: 98 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,103 @@
22
Examples
33
********
44

5-
.. include:: image.rst
5+
=====
6+
Image
7+
=====
68

7-
.. include:: device.rst
9+
In this example we consider the micromodel described in the
10+
:doc:`configuration file<./configuration_file>` section.
811

9-
.. include:: online.rst
12+
The image is available in the examples folder in the `Github page <https://github.com/cssr-tools/pymm>`_
13+
with the default name 'microsystem.png'. The configuration file corresponds to the one in the
14+
:doc:`configuration file<./configuration_file>` section and it is saved as 'parameters.toml'
15+
(the default name for the configuration file). Since 'image' is the default entry for the simulation
16+
setup, and assuming that the command 'gmsh' in the terminal
17+
executes Gmsh, then to run the whole framework (meshing, flow, and tracer):
18+
19+
.. code-block:: bash
20+
21+
pymm -i microsystem.png -p parameters.toml -t all
22+
23+
The execution time was ca. 20 minutes and the following are screenshots of the simulation results:
24+
25+
.. figure:: figs/pressure.png
26+
.. figure:: figs/velocity.png
27+
.. figure:: figs/tracer.png
28+
29+
Simulation results of the (top) pressure, (middle) velocity, and (bottom) tracer concentration.
30+
31+
======
32+
Device
33+
======
34+
35+
Here we consider the same image and configuration file as in the
36+
previous example, but we are interested now on the
37+
device setup (the flow is from the top-left corner to the bottom-right
38+
corner of the device). Then we add the corresponding flag to the **pymm**
39+
executable:
40+
41+
.. code-block:: bash
42+
43+
pymm -t all -m device
44+
45+
The execution time was ca. 35 minutes and the following are screenshots of the simulation results:
46+
47+
.. figure:: figs/device_pressure.png
48+
.. figure:: figs/device_velocity.png
49+
.. figure:: figs/device_tracer.png
50+
51+
Simulation results of the (top) pressure, (middle) velocity, and (bottom) tracer concentration.
52+
53+
======
54+
Online
55+
======
56+
57+
In this example we consider a micromodel available online in Fig. 2a in
58+
`Joekar-Niasar et al. 2009 <https://agupubs.onlinelibrary.wiley.com/doi/full/10.1029/2007WR006641>`_.
59+
60+
The image was extracted by screenshot and saved with the name 'online.png' (1068x1068 pixels).
61+
The configuration file was saved as 'configuration.toml' and contained the following text:
62+
63+
.. code-block:: python
64+
:linenos:
65+
66+
#Set the pymm parameters
67+
lenght = 600e-6 #Image-related, length of the microsystem [m]
68+
width = 600e-6 #Image-related, height of the microsystem [m]
69+
tickness = 1.8e-6 #Image-related, depth of the microsystem [m]
70+
grainMeaning = 1 #Image-related, 0 if the grains in the image are light colors (e.g., white) or 1 for dark colors (e.g., black)
71+
threshold = 0.5 #Image-related, threshold for converting the image to binary
72+
rescale = 1 #Image-related, rescaled factor for the input image
73+
grainsSize = 50 #Image-related, minimum size of the grain clusters
74+
borderTol = 1 #Image-related, tolerance to approximate the border as polygon
75+
grainsTol = 1 #Image-related, tolerance to approximate the grains as polygon
76+
lineWidth = 1 #Figure-related, line width to show the contours in the produced figures
77+
channelWidth = 6e-6 #Device-related, width of the top and bottom channels in the micromodel device [m]
78+
meshSize = 1e-6 #Mesh-related, mesh size [m]
79+
viscocity = 1e-6 #Fluid-related, kinematic viscosity [dynamic viscosity/fluid_density, m2/s]
80+
diffusion = 1e-12 #Fluid-related, diffusion coefficient for tracer [m2/s]
81+
inletLocation = "top" #Simulation-related, inlet bc location (left, top, right, or bottom)
82+
inletValue = 2.0e-3 #Simulation-related, inlet boundary condition (pressure/fluid_density, [Pa/(kg/m3)])
83+
tracerTime = 120 #Simulation-related, end time for the tracer simulation [s]
84+
tracerWrite = 1 #Simulation-related, time interval to write the tracer results [s]
85+
pressureConv = 1e-7 #Solver-related, convergence criterium for the pressure solution in the numerical scheme for the Stokes simulation
86+
velocityConv = 1e-8 #Solver-related, convergence criterium for the velocity solution in the numerical scheme for the Stokes simulation
87+
iterationsMax = 10000 #Solver-related, maximum number of iterations for the Stokes simulation in case the convergence criteria have not been reached
88+
tracerStep = 1 #Solver-related, time step in the numerical scheme for the tracer simulation [s]
89+
90+
Here we used a version of Gmsh built from source, then we gave the path to the executable via the '-g' flag.
91+
Since we are interested in the flow and tracer simulations, then we add the flag '-t all'.
92+
Then, the following command was exectued in the terminal:
93+
94+
.. code-block:: bash
95+
96+
pymm -i online.png -p configuration.toml -m device -t all -gmsh /home/AD.NORCERESEARCH.NO/dmar/Github/gmsh/build/gmsh
97+
98+
The execution time was ca. 15 minutes and the following are screenshots of the simulation results:
99+
100+
.. figure:: figs/online_pressure.png
101+
.. figure:: figs/online_velocity.png
102+
.. figure:: figs/online_tracer.png
103+
104+
Simulation results of the (top) pressure, (middle) velocity, and (bottom) tracer concentration.

docs/_sources/image.rst.txt

Lines changed: 0 additions & 25 deletions
This file was deleted.

docs/_sources/installation.rst.txt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,25 @@ install the Python requirements in a virtual environment with the following comm
3636
# For contributions/testing/linting, install the dev-requirements
3737
pip install -r dev-requirements.txt
3838
39+
.. note::
40+
41+
While with Python3.12 the previous lines should install all required Python packages with the correct versions,
42+
using Python3.13 requires to install a higher version of scikit-image, this by executing **pip install scikit-image==0.25.2** after the previous lines.
43+
3944
.. tip::
4045

4146
Typing **git tag -l** writes all available specific versions.
4247

4348
OpenFOAM
4449
--------
4550

46-
See the `OpenFOAM page <https://openfoam.org/download/12-ubuntu/>`_, where from OpenFOAM-12 the simulator is available via apt get.
51+
See the `OpenFOAM page <https://openfoam.org/download/13-ubuntu/>`_, where from OpenFOAM-12 the simulator is available via apt get,
52+
and OpenFOAM-13 is the latest release. To test if OpenFoam is installed and working, you could type in the terminal:
53+
54+
.. code-block:: console
55+
56+
. /opt/openfoam13/etc/bashrc
57+
foamRun -help
4758
4859
Gmsh
4960
----
@@ -54,5 +65,4 @@ See the `Gmsh page <https://gmsh.info/#Download>`_.
5465
.. tip::
5566

5667
See the `CI.yml <https://github.com/cssr-tools/pymm/blob/main/.github/workflows/CI.yml>`_ script
57-
for installation of pymm in Ubuntu using Python3.13. Using Python3.13 requires to install a higher version
58-
of scikit-image by executing **pip install scikit-image==0.25.2**.
68+
for installation of pymm in Ubuntu using Python3.13.

docs/_sources/online.rst.txt

Lines changed: 0 additions & 52 deletions
This file was deleted.

docs/about.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ <h1>About pymm<a class="headerlink" href="#about-pymm" title="Link to this headi
100100
<hr/>
101101

102102
<div role="contentinfo">
103-
<p>&#169; Copyright 2022, NORCE Norwegian Research Centre AS.</p>
103+
<p>&#169; Copyright 2022-2025, NORCE Research AS.</p>
104104
</div>
105105

106106
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a

docs/api.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ <h2>pymm<a class="headerlink" href="#pymm" title="Link to this heading"></a><
128128
<hr/>
129129

130130
<div role="contentinfo">
131-
<p>&#169; Copyright 2022, NORCE Norwegian Research Centre AS.</p>
131+
<p>&#169; Copyright 2022-2025, NORCE Research AS.</p>
132132
</div>
133133

134134
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a

docs/configuration_file.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ <h2>Remaining parameters<a class="headerlink" href="#remaining-parameters" title
208208
<hr/>
209209

210210
<div role="contentinfo">
211-
<p>&#169; Copyright 2022, NORCE Norwegian Research Centre AS.</p>
211+
<p>&#169; Copyright 2022-2025, NORCE Research AS.</p>
212212
</div>
213213

214214
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a

0 commit comments

Comments
 (0)