Badlands vtk stratigraphic mesh creation

If the stratigraphic structure is turned on in the XmL input file, Badlands produces sedimentary layers Hdf5 files. The stratigraphic layers are defined on a regularly spaced grid and a layer is recorded at each layer time interval given by the user.

Here we build a vtk structured grid based on the stratal layers that could be visualise directly in Paraview/Visit.


In [ ]:
%matplotlib inline

import numpy as np

# Import badlands grid generation toolbox
import pybadlands_companion.stratalMesh as mesh

# display plots in SVG format
%config InlineBackend.figure_format = 'svg'

Loading stratigraphic file

First we need to load one of the stratigraphic file. The files are located in the h5/ folder in the simulation main output folder and are named using the following convention:

  • sed.timeT.pX.hdf5

with T the display time index and X the number of the partition (used in the parallel version). In cases where you ran your simulation in parallel you will also need to give the number of CPUs used (cpus).

To load a file you will need to give the folder name and the number of processors used in your simulation.

For more information regarding the function uncomment the following line.


In [ ]:
#help(mesh.stratalMesh.__init__)

In [ ]:
folder = '/workspace/volume/Examples/delta/output_0/h5/'
vtkMesh = mesh.stratalMesh(folder)

Then we need to load a particular output time interval (this is the T parameter in the hdf5 file name convention).

Note

This number is not always the number of sedimentary layers for this particular time step as you could have chosen in the input file to have more than 1 sedimentary layer recorded by output interval!


In [ ]:
#help(vtkMesh.loadStratigraphy)

In [ ]:
vtkMesh.loadStratigraphy(timestep=50)

Building the vtk unstructured grid

We then build the stratigraphic mesh for the considered time interval.

You need to specify the folder where you want your output to be stored.

The mesh file names will have the following convention:

  • stratalMesh.timeT.vts

with T the display time index.


In [ ]:
#help(vtkMesh.buildMesh)

In [ ]:
vtkMesh.buildMesh(outfolder='/workspace/volume/')

In [ ]: