Hello everyone, I’m trying to rotate my mesh imported from Gmsh in PyVista, but I haven’t succeeded. I want to display the geometry exactly as it was in Gmsh, but when I attempt to visualize it with PyVista, it appears with a different rotation. What can I do to set the rotation in PyVista?
Below, you’ll find my Gmsh script and the code used to visualize the mesh.
Thank you in advance.
// Gmsh project created on Tue Apr 16 21:06:14 2024
SetFactory("OpenCASCADE");
//+
Point(1) = {0, 0, 0, 1.0};
//+
Point(2) = {1, 0, 0, 1.0};
//+
Point(3) = {0.5, 1, 0, 1.0};
//+
Line(1) = {1, 2};
//+
Line(2) = {2, 3};
//+
Line(3) = {3, 1};
//+
Curve Loop(1) = {3, 1, 2};
//+
Plane Surface(1) = {1};
//+
Extrude {0, 0, 3} {
Surface{1};
}
//+
Physical Surface("inlet", 10) = {1};
//+
Physical Surface("outlet", 11) = {5};
//+
Physical Surface("walls_right", 12) = {2};
//+
Physical Surface("walls_left", 13) = {4};
//+
Physical Surface("walls_bottom", 14) = {3};
//+
Physical Volume(15) = {1};
My code is:
import pyvista
print(pyvista.global_theme.jupyter_backend)
tdim = msh.topology.dim
fdim = tdim - 1
from dolfinx import plot
pyvista.start_xvfb()
# Filter out ghosted cells
topology, cell_types, geometry = plot.vtk_mesh(msh, tdim)
p = pyvista.Plotter(window_size=[800, 800])
grid = pyvista.UnstructuredGrid(topology, cell_types, geometry)
p.add_mesh(grid, show_edges=True)
if pyvista.OFF_SCREEN:
figure = p.screenshot("subdomains_structured.png")
p.show()
the mesh i get with Pyvista is:
The mesh i get with Gmsh :