Read Tensor Mesh

Read a UBC tensor mesh file

# sphinx_gallery_thumbnail_number = 1
import PVGeo
import pyvista
from pyvista import examples

Download sample data files and keep track of names:

url = 'https://github.com/OpenGeoVis/PVGeo/raw/master/tests/data/Craig-Chile/craig_chile.msh'
mesh_file, _ = examples.downloads._retrieve_file(url, 'craig_chile.msh')
url = 'https://github.com/OpenGeoVis/PVGeo/raw/master/tests/data/Craig-Chile/Lpout.mod'
model_file, _ = examples.downloads._retrieve_file(url, 'Lpout.mod')

Read the mesh and model

reader = PVGeo.ubc.TensorMeshReader()
reader.set_mesh_filename(mesh_file)
reader.add_model_file_name(model_file)
mesh = reader.apply()
print(mesh)

Out:

RectilinearGrid (0x7f0ea79f1fa8)
  N Cells:      190440
  N Points:     200900
  X Bounds:     3.550e+05, 3.722e+05
  Y Bounds:     5.999e+06, 6.016e+06
  Z Bounds:     -5.250e+03, 3.000e+03
  Dimensions:   70, 70, 41
  N Arrays:     1

Use a PyVista threshold filter to remove NaN data values

mesh.threshold().plot()
../../_images/sphx_glr_read-tensor-mesh_001.png

Or inspect slices of the model

mesh.slice_orthogonal().plot()
../../_images/sphx_glr_read-tensor-mesh_002.png

Or threshold a data range

mesh.threshold([-0.6, -0.3]).plot(clim=[-0.6, 0.3])
../../_images/sphx_glr_read-tensor-mesh_003.png

Total running time of the script: ( 0 minutes 4.865 seconds)

Gallery generated by Sphinx-Gallery