How to save a .msh format to read with Gmsh from vertices, elements (tetra) and type of tissue?

15 Views Asked by At

I'm trying to save a .msh file starting from 3 matrices that contain Vertices, Elements and the type of tissue. I cannot see the meshes when I open the generated file onto Gmsh. It loaded without error but I can see the elements in Gmsh but it doesn't display anything.

enter image description here

I'm gessing I'm doing something wrong somewhere. Here my code:

import numpy as np
from scipy import io
import  meshio
 
Vertices = # nd.array (N*3, float64)
Elements = # nd.array (M*4, int32)
Tissue = # nd.array (M, uint8) (from 1 to 5)  
 
cells = [
    ("tetra", Elements),
] 
mesh = meshio.Mesh(
    Vertices,
    cells,
    # cell_data={"domain": [Tissue]},
    cell_data={"gmsh:physical": [Tissue],"gmsh:geometrical": [Tissue]},
    # Each item in cell data must match the cells array
    # cell_sets={"gmsh:geometrical": "/tetra"},
)
mesh.write(
    savename + "//foogmsh22.msh",  # str, os.PathLike, or buffer/open file
    file_format="gmsh22" 
)
0

There are 0 best solutions below