User Guide#

This guide gives an overview over the ogstools package. It explains important features, especially the usage of shipped command-line tools, and should give new users a good start with this package.

Getting Started#

Installation#

It is a good practice to create a Python virtual environment in which your Python packages will get installed. Create a virtual environment and activate it:

python -m venv .venv
source .venv/bin/activate
python -m venv .venv

# The following may need to be run once. Please check the docs for its consequences:
# https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policiess
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser

.venv\Scripts\Activate.ps1

Important

Make sure to activate the virtual environment in every new shell session!

The latest release of ogstools can be installed from PyPI using pip:

pip install ogstools

Install development version

You can also install the latest development version with pip (requires also git):

pip install git+https://gitlab.opengeosys.org/ogs/tools/ogstools.git@main

First steps#

Currently ogstools contains propertylib, meshplotlib, nuclearwasteheat, fe2vtu - FEFLOW converter and the msh2vtu application. Try to run it:

$ msh2vtu --help
usage: msh2vtu [-h] [-g] [-r] [-a] [-d DIM] [-o OUTPUT] [-z] [-s] [-v]
               filename

Prepares a Gmsh-mesh for use in OGS by extracting domain-, boundary- and
physical group-submeshes, and saves them in vtu-format. Note that all mesh
entities should belong to physical groups.

positional arguments:
  filename              Gmsh mesh file (*.msh) as input data

options:
  -h, --help            show this help message and exit
  -g, --ogs             rename "gmsh:physical" to "MaterialIDs" for domains
                        and change type of corresponding cell data to INT32
  -r, --rdcd            renumber domain cell data, physical IDs (cell data) of
                        domains get numbered beginning with zero
  -a, --ascii           save output files (*.vtu) in ascii format
  -d DIM, --dim DIM     spatial dimension (1, 2 or 3), trying automatic
                        detection, if not given
  -o OUTPUT, --output OUTPUT
                        basename of output files; if not given, then it
                        defaults to basename of inputfile
  -z, --delz            deleting z-coordinate, for 2D-meshes with z=0, note
                        that vtu-format requires 3D points
  -s, --swapxy          swap x and y coordinate
  -v, --version         show program's version number and exit