%pip install meshio lxml
import numpy as np
import meshio
reader = meshio.read("pep1_7_OmegaV.vtu")
reader.points
array([[ 1.0582654 , 0.30012401, 0. ], [ 1.05378846, 0.31548356, 0. ], [ 1.04908863, 0.33077637, 0. ], ..., [-1.07034936, -0.25367746, 0. ], [-1.06654672, -0.26921769, 0. ], [-1.08039591, -0.20674804, 0. ]])
reader.cells
{'triangle': array([[3773, 3761, 3759], [3761, 3773, 3792], [3771, 3792, 3773], ..., [ 874, 902, 1511], [1510, 1511, 902], [1511, 1506, 874]], dtype=int32)}
x = reader.points
triangles = reader.cells['triangle']
reader.point_data
{'real_part_term_u': array([ 6.48604e-05, -1.07269e-04, -2.87223e-04, ..., -1.84997e-04, -3.51063e-06, -9.68882e-04]), 'imag_part_term_u': array([-2.50051e-05, -8.37655e-05, -1.65830e-04, ..., 8.22003e-05, 5.68333e-05, -1.75611e-04]), 'abs_term_u': array([6.95135e-05, 1.36101e-04, 3.31657e-04, ..., 2.02437e-04, 5.69416e-05, 9.84669e-04])}
u = reader.point_data['abs_term_u']
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
import matplotlib.pyplot as plt
plt.rcParams['figure.figsize'] = (10.0, 6.0)
# Mesh
plt.figure(figsize=(8, 8))
plt.triplot(x[:,0], x[:,1], triangles)
plt.gca().set_aspect('equal')
# abs_u
plt.figure(figsize=(8, 8))
plt.tricontour(x[:,0], x[:,1], triangles, u, 16);
plt.figure(figsize=(8, 8))
plt.tricontourf(x[:,0], x[:,1], triangles, u, 16);