Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New features such as gifs, mask, subplots #16

Merged
merged 1 commit into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -163,22 +163,27 @@ cython_debug/
.DS_Store

# Tests
examples/fipnum_*,1,*.png
examples/permx_*,1,*.png
examples/permz_*,1,*.png
examples/poro_*,1,*.png
examples/porv_*,1,*.png
examples/satnum_*,1,*.png
examples/sgas_*,1,*.png
examples/rsw_*,1,*.png
examples/spe11b_fipnum_*,1,*_t5.png
examples/spe11b_permx_*,1,*_t5.png
examples/spe11b_permz_*,1,*_t5.png
examples/spe11b_poro_*,1,*_t5.png
examples/spe11b_porv_*,1,*_t5.png
examples/spe11b_satnum_*,1,*_t5.png
examples/spe11b_sgas_*,1,*_t4.png
examples/spe11b_rsw_*,1,*_t5.png
examples/spe11b_sgas_*,1,*_t5.png
examples/subfigs_summary.png
examples/spe11b_xco2l.gif
examples/fgip.png
examples/SPE11B-*.vtu
examples/SPE11B.pvd
tests/generic_deck

# Python environment
vplopm/

# Developing
debugging/
developing/
studies/
prototyping/
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# plopm: Simplified and flexible tool to visualize OPM Flow geological models

## Main feature
Quick generation of PNG figures and VTKs from a OPM Flow type model.
Quick generation of PNG figures, GIFs, and VTKs from a OPM Flow type model.

## Installation
To install the _plopm_ executable in an existing Python environment:
Expand Down
Binary file added docs/_images/comparison.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/fgip.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/_images/fgip_spe11b.png
Binary file not shown.
Binary file removed docs/_images/fgipm.png
Binary file not shown.
Binary file modified docs/_images/norne.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_images/norne_transformed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/_images/satnum_spe11b.png
Binary file not shown.
Binary file modified docs/_images/sgas_diff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_images/sgas_diff_edit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/_images/sgas_spe11b.png
Binary file not shown.
Binary file removed docs/_images/spe10.png
Binary file not shown.
Binary file added docs/_images/spe10_model2_permz_*,4,*_t0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/spe11b_satnum_*,1,*_t5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/spe11b_sgas_*,1,*_t4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_images/wells.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/xco2l.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
91 changes: 50 additions & 41 deletions docs/_sources/examples.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,27 @@ Then, if you succeed in installing **plopm**, inside the `examples folder <https

the following figure should be generated (this example is used in the `tests <https://github.com/cssr-tools/plopm/blob/main/tests>`_, then it runs with the default terminal argument options).

.. figure:: figs/satnum_spe11b.png
.. figure:: figs/spe11b_satnum_*,1,*_t5.png

The default argument options are:

.. code-block:: bash

plopm -i SPE11B -o . -v '' -m png -s ,1, -p flow -z yes -f 14 -x '' -y '' -u resdata -c '' -e '' -n '' -b '' -d 8,16 -l '' -t '' -r -1 -w 0 -g 0 -a 1 -time s -ylabel '' -xlabel '' -ylnum 4 -xlnum 4 -cnum '' -clabel '' -labels '' -axgrid 1 -dpi 300 -xformat '' -yformat '' -xunits m -yunits m -remove 0,0,0,0 -facecolor w -save '' -log 0 -rotate 0 -translate '[0,0]' -global 0 -ncolor w

See the :ref:`overview` or run `plopm -h` for the definition of the argument options.
See the :ref:`overview` or run `plopm -h` for the definition of the argument options, as well as using `-printv` flag to output the available
summary, init, and restart available variables given an input deck.

For example, for the gas saturation at the report step number 4 using a given colormap (-c):

.. code-block:: bash

plopm -i SPE11B -v sgas -r 4 -c cubehelix

.. figure:: figs/sgas_spe11b.png
.. figure:: figs/spe11b_sgas_*,1,*_t4.png

and for the gas in place summary vector given a color, line style, font size, dimension of the figure, and using dates for the times:
and for the gas in place summary vector given a color, line style, font size, dimension of the figure, line width, and using dates for the times:

.. code-block:: bash

plopm -i SPE11B -v fgip -c b -e ':' -f 12 -d 5,5 -time dates
plopm -i SPE11B -v fgip -c b -e dotted -f 12 -d 5,5 -lw 4 -tunits dates

.. figure:: figs/fgip_spe11b.png
:scale: 30%
.. figure:: figs/fgip.png
:scale: 7%

============
Generic deck
Expand All @@ -52,23 +47,26 @@ for an example where **plopm** is used to generate figures from the
`SPE10_MODEL2 model <https://github.com/OPM/opm-data/tree/master/spe10model2>`_ by downloading the files and using the
`OPM Flow <https://opm-project.org/?page_id=19>`_ simulator.

.. image:: ./figs/spe10.png
.. image:: ./figs/spe10_model2_permz_*,4,*_t0.png

.. code-block:: bash

plopm -i SPE10_MODEL2 -v permz -s ,4, -log 1 -xunits km -yunits km -xlnum 6 -yformat .2f -t 'K$_z$ at the forth slide in the xz plane' -b '[1e-7,1e3]'

Here, we look at the forth slide in the xz plane and use log scale for the permeability in the z direction, as well as changing the axis units to km,
setting the format to the numbers to two floats in the y axis, and setting manualli the upper and lower bound for the color map.
setting the format to the numbers to two floats in the y axis, and setting manually the upper and lower bound for the color map.

To plot information for the grid, and also the location of the wells from the top view, this is achieved by:

.. code-block:: bash

plopm -i SPE10_MODEL2 -s 1,, -d 3,4 -f 8 -g 1 && plopm -i SPE10_MODEL2 -s 1,, -d 3,4 -f 8 -w 1
plopm -i SPE10_MODEL2 -s ,,1 -d 3,4 -f 8 -v grid -remove 0,0,1,0 && plopm -i SPE10_MODEL2 -s ,,1 -d 3,4 -f 8 -v wells -remove 0,0,0,1

.. image:: ./figs/wells.png

Here, we use the remove flag to delete the colorbar axis in the maps for the grid and to delete the generated title in the wells plot (the first entry
in remove would delete the left axis, e.g., the y label and y ticks in this example, while the second entry if set to 1 would remove the x axis).

===============================
Rotation, translation, and zoom
===============================
Expand All @@ -88,10 +86,31 @@ In order to reduce the white space outside the active cells, as well as to rotat

.. code-block:: bash

plopm -i NORNE_ATW2013 -s ,,1 -rotate 65 -translate '[6456335.5,-3476500]' -x '[0,5600]' -y '[0,7600]' -f 20
plopm -i NORNE_ATW2013 -s ,,1 -rotate 65 -translate '[6456335.5,-3476500]' -x '[0,5600]' -y '[0,7600]' -f 30

.. image:: ./figs/norne_transformed.png

==============
Convert to VTK
==============
Inside the `examples folder <https://github.com/cssr-tools/plopm/blob/main/examples>`_, then we can create VTKs from the
OPM Flow simulation results (i.e., .EGRID, .INIT, .UNRST). For example, to create VTKS for the temperature, fipnum, the co2 mass, and the co2 mass fraction in the liquid phase
from the restart files from the initial (0) to the number 5 restart, using a OPM Flow build from source in a given path, this can be achieved by:

.. code-block:: bash

plopm -i SPE11B -v temp,fipnum,co2m,xco2l -vtkformat Float32,UInt16,Float64,Float32 -r 0,5 -m vtk

.. figure:: ./figs/vtk_temp.png

Visualization using paraview of the grid and temperature after 25 years of CO2 injection.

.. note::

It is possible to write directly VTKs from OPM Flow simulations by adding the flag **--enable-vtk-output=true**.
However, there are quantities that are not written (e.g., fipnum, flores), in addition to quantities not supported
such as component mass (e.g., co2, h2o). This is when **plopm** can be helpful.

=====================
Different input files
=====================
Expand All @@ -101,49 +120,39 @@ called spe11b_larger_inj. Then, to plot the summary vector for both runs we can

.. code-block:: bash

plopm -i spe11b/SPE11B,/home/user/spe11b_larger_inj/SPE11B -v fgipm -a 1e-6 -time w -d 5,5 -c r,b -e 'solid;:' -t 'Comparing the total mass' -f 10
plopm -i 'spe11b/SPE11B spe11b_larger_inj/SPE11B' -v 'fgip,fgipm,RGIP:3 / 2' -a 1,1e-6 -tunits w -d 10,5 -c r,b -e 'solid,dashed' -t 'Field gas in place Comparing the total mass Half gas in place in fipnum 3' -f 14 -subfigs 2,2 -delax 1 -loc empty,empty,empty,center -save comparison

.. image:: ./figs/fgipm.png
:scale: 30%
.. image:: ./figs/comparison.png
:scale: 6%

Here, we plot the injected mass and scaled to kilo tons, and the time is shown in weeks.
Here, using subplots, we plot the gas in place, injected mass and scaled to kilo tons, the regional gas in place in fipnum 3 divided by 2, and the time is shown in weeks.

.. tip::
For any summary variable, one can give the path to more than two different simulation cases, just by separating the folder paths by commas in the -i.
For any summary variable, one can give the path to more than two different simulation cases, just by separating the folder paths by spaces in the -i.

To look at the difference between these two simulations for the dynamic variable sgas at the restar step 3, this can be achieved by executing:

.. code-block:: bash

plopm -i spe11b/SPE11B,spe11b_larger_inj/SPE11B -v sgas -r 3
plopm -i spe11b_larger_inj/SPE11B -v sgas -r 3 -diff spe11b/SPE11B -remove 0,0,0,1

.. image:: ./figs/sgas_diff.png

To changue the colormap and setting the clorbar limits manually, this can be achieved by:
To changue the colormap and setting the colorbar limits manually, this can be achieved by:

.. code-block:: bash

plopm -i spe11b/SPE11B,spe11b_larger_inj/SPE11B -v sgas -r 3 -c tab20c -b '[-0.8,0]' -n "lambda x, _: f'{x:.3f}'"
plopm -i spe11b_larger_inj/SPE11B -v sgas -r 3 -diff spe11b/SPE11B -remove 0,0,0,1 -c tab20c_r -b '[0,0.8]' -cformat .3 -cnum 9

.. image:: ./figs/sgas_diff_edit.png

==============
Convert to VTK
==============
Inside the `examples folder <https://github.com/cssr-tools/plopm/blob/main/examples>`_, then we can create VTKs from the
OPM Flow simulation results (i.e., .EGRID, .INIT, .UNRST). For example, to create VTKS for the temperature, fipnum, and the co2 mass
from the restart files from the initial (0) to the number 5 restart, using a OPM Flow build from source in a given path, this can be achieved by:
============
GIF and mask
============
To create a gif and mask the results using the satnum numbers (any variable should be supported) for the different rock properties, this can be achieved by:

.. code-block:: bash

plopm -i SPE11B -v temp,fipnum,co2m -r 0,5 -m vtk -p /Users/dmar/build/opm-simulators/bin/flow

.. figure:: ./figs/vtk_temp.png

Visualization using paraview of the grid and temperature after 25 years of CO2 injection.
plopm -v xco2l -subfigs 1,2 -i 'spe11b/SPE11B spe11b_larger_inj/SPE11B' -d 16,2.5 -mask satnum -r 0,5 -m gif -dpi 1000 -t "spe11b spe11b larger injection" -f 16 -interval 1000 -loop 1 -cformat .2f -cbsfax 0.30,0.01,0.4,0.02

.. note::

It is possible to write directly VTKs from OPM Flow simulations by adding the flag **--enable-vtk-output=true**.
However, there are quantities that are not written (e.g., fipnum, flores), in addition to quantities not supported
such as component mass (e.g., co2, h2o). This is when **plopm** can be helpful.
.. image:: ./figs/xco2l.gif
18 changes: 9 additions & 9 deletions docs/_sources/installation.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,25 +57,25 @@ in the terminal the following lines (which in turn should build flow in the fold

CURRENT_DIRECTORY="$PWD"

for repo in common grid models simulators
for repo in common grid simulators
do
git clone https://github.com/OPM/opm-$repo.git
done

mkdir build

for repo in common grid models
for repo in common grid
do
mkdir build/opm-$repo
cd build/opm-$repo
cmake -DUSE_MPI=1 -DWITH_NDEBUG=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$CURRENT_DIRECTORY/build/opm-common;$CURRENT_DIRECTORY/build/opm-grid" $CURRENT_DIRECTORY/opm-$repo
cmake -DUSE_MPI=1 -DWITH_NDEBUG=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$CURRENT_DIRECTORY/build/opm-common" $CURRENT_DIRECTORY/opm-$repo
make -j5 opm$repo
cd ../..
done

mkdir build/opm-simulators
cd build/opm-simulators
cmake -DUSE_MPI=1 -DWITH_NDEBUG=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$CURRENT_DIRECTORY/build/opm-common;$CURRENT_DIRECTORY/build/opm-grid;$CURRENT_DIRECTORY/build/opm-models" $CURRENT_DIRECTORY/opm-simulators
cmake -DUSE_MPI=1 -DWITH_NDEBUG=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$CURRENT_DIRECTORY/build/opm-common;$CURRENT_DIRECTORY/build/opm-grid" $CURRENT_DIRECTORY/opm-simulators
make -j5 flow
cd ../..

Expand Down Expand Up @@ -106,7 +106,7 @@ package (see the `prerequisites <https://opm-project.org/?page_id=239>`_, which
./dune-common/bin/dunecontrol --only=dune-$module make -j5
done

for repo in common grid models simulators
for repo in common grid simulators
do
git clone https://github.com/OPM/opm-$repo.git
done
Expand All @@ -115,18 +115,18 @@ package (see the `prerequisites <https://opm-project.org/?page_id=239>`_, which

mkdir build

for repo in common grid models
for repo in common grid
do
mkdir build/opm-$repo
cd build/opm-$repo
cmake -DPYTHON_EXECUTABLE=$(which python) -DWITH_NDEBUG=1 -DUSE_MPI=0 -DOPM_ENABLE_PYTHON=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$CURRENT_DIRECTORY/dune-common/build-cmake;$CURRENT_DIRECTORY/dune-grid/build-cmake;$CURRENT_DIRECTORY/dune-geometry/build-cmake;$CURRENT_DIRECTORY/dune-istl/build-cmake;$CURRENT_DIRECTORY/build/opm-common;$CURRENT_DIRECTORY/build/opm-grid" $CURRENT_DIRECTORY/opm-$repo
make -j5
cmake -DPYTHON_EXECUTABLE=$(which python) -DWITH_NDEBUG=1 -DUSE_MPI=0 -DOPM_ENABLE_PYTHON=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$CURRENT_DIRECTORY/dune-common/build-cmake;$CURRENT_DIRECTORY/dune-grid/build-cmake;$CURRENT_DIRECTORY/dune-geometry/build-cmake;$CURRENT_DIRECTORY/dune-istl/build-cmake;$CURRENT_DIRECTORY/build/opm-common" $CURRENT_DIRECTORY/opm-$repo
make -j5 opm$repo
cd ../..
done

mkdir build/opm-simulators
cd build/opm-simulators
cmake -DUSE_MPI=0 -DWITH_NDEBUG=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$CURRENT_DIRECTORY/dune-common/build-cmake;$CURRENT_DIRECTORY/dune-grid/build-cmake;$CURRENT_DIRECTORY/dune-geometry/build-cmake;$CURRENT_DIRECTORY/dune-istl/build-cmake;$CURRENT_DIRECTORY/build/opm-common;$CURRENT_DIRECTORY/build/opm-grid;$CURRENT_DIRECTORY/build/opm-models" $CURRENT_DIRECTORY/opm-simulators
cmake -DUSE_MPI=0 -DWITH_NDEBUG=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$CURRENT_DIRECTORY/dune-common/build-cmake;$CURRENT_DIRECTORY/dune-grid/build-cmake;$CURRENT_DIRECTORY/dune-geometry/build-cmake;$CURRENT_DIRECTORY/dune-istl/build-cmake;$CURRENT_DIRECTORY/build/opm-common;$CURRENT_DIRECTORY/build/opm-grid" $CURRENT_DIRECTORY/opm-simulators
make -j5 flow
cd ../..

Expand Down
Loading
Loading