Quickstart

Create a Simple Grid

Create a basic Rectilinear grid using the Corner-Point grid representation:

from petres.grids import CornerPointGrid

grid = CornerPointGrid.from_rectilinear(
   x=[0, 500, 700, 1000],
   y=[0, 500, 800],
   z=[0, 30, 100],
)

# Print a summary of the grid
print(grid.summary())

This defines a grid consisting of 3 cells in the x-direction, 2 cells in the y-direction, and 2 layers in the z-direction.

Visualize the Grid

Render the grid in an interactive 3D viewer:

grid.show(scalars="depth")

Assign a Property Distribution

Properties are defined per cell and attached to the grid. Create a porosity property:

poro = grid.properties.create(
   name="porosity",
   description="Porosity",
   eclipse_keyword="PORO",
)

The eclipse_keyword argument is optional, but enables direct export to Eclipse-compatible format.

Assign values using a lognormal distribution:

poro.fill_lognormal(
   mean=0.24,
   std=0.03,
   min=0.0,
   max=0.35,
)

Visualize the Property

Display the property directly:

poro.show()

Or alternatively through the grid using the property name:

grid.show(scalars="porosity")

Export to Eclipse Format

Export the grid and its associated properties in Eclipse .GRDECL format:

grid.to_grdecl("example.grdecl", properties=["porosity"])

What to Learn Next

After this quickstart, continue with the next tutorials: