|
2 | 2 | Examples |
3 | 3 | ******** |
4 | 4 |
|
5 | | -.. include:: image.rst |
| 5 | +===== |
| 6 | +Image |
| 7 | +===== |
6 | 8 |
|
7 | | -.. include:: device.rst |
| 9 | +In this example we consider the micromodel described in the |
| 10 | +:doc:`configuration file<./configuration_file>` section. |
8 | 11 |
|
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. |
0 commit comments