Read Tensor Mesh

Read a UBC tensor mesh file

from pyvista import examples

# sphinx_gallery_thumbnail_number = 1
import PVGeo

Download sample data files and keep track of names:

url = 'https://github.com/OpenGeoVis/PVGeo/raw/main/tests/data/Craig-Chile/craig_chile.msh'
mesh_file, _ = examples.downloads._retrieve_file(url, 'craig_chile.msh')
url = 'https://github.com/OpenGeoVis/PVGeo/raw/main/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()
mesh
HeaderData Arrays
RectilinearGridInformation
N Cells190440
N Points200900
X Bounds3.550e+05, 3.722e+05
Y Bounds5.999e+06, 6.016e+06
Z Bounds-5.250e+03, 3.000e+03
Dimensions70, 70, 41
N Arrays1
NameFieldTypeN CompMinMax
Lpout.modCellsfloat641-6.000e-013.000e-01


Use a PyVista threshold filter to remove NaN data values

mesh.threshold().plot()
read tensor mesh

Or inspect slices of the model

mesh.slice_orthogonal().plot()
read tensor mesh

Or threshold a data range

mesh.threshold([-0.6, -0.3]).plot(clim=[-0.6, 0.3])
read tensor mesh

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

Gallery generated by Sphinx-Gallery