Is gmsh working on an rpi4 ? (aarch64)
Hi,
I'm trying to use pygmsh/gmsh in my project, I tried some code on my window computer to do some tests and generate an 3D mesh (union between 2 volumes).
I used this code and it worked fine :
from skfem.visuals.matplotlib import draw, show, plot
from skfem.models.elasticity import linear_elasticity, lame_parameters
from skfem.helpers import dot
from skfem import *
import pygmsh
import gmsh
import numpy as np
resolution = 0.01
# Beam parameter
print("parameters")
length = 0.3
width = 0.05
t = 0.03
# added_mass parameter
w2 = 0.03
h2 = 0.03
t2 = 0.03
x0 = 0.0125
y0 = 0.25
z0 = t
# physics parameters
rho = 1120
E = 2.174e9
nu = 0.35
# Clear previous model
mesh_size = 0.01
geom = pygmsh.occ.Geometry()
model3D = geom.__enter__()
box0 = model3D.add_box([0, 0, 0], [width, length, t])
box1 = model3D.add_box([x0, y0, z0], [w2, h2, t2])
union = model3D.boolean_union([box0, box1])
model3D.synchronize()
model3D.add_physical(union, "Union")
geom.generate_mesh(dim=3)
gmsh.write("Mesh3D.msh")
model3D.__exit__()
m = MeshTet.load('mesh3D.msh')
draw(m)
show()
I generate a .msh file that I use later in my code to do FEM.
The thing is when I try to do the same on my Raspberry Pi 4 i get this error :
/home/alban/.local/lib/python3.8/site-packages/numpy/ctypeslib.py:517: RuntimeWarning: A builtin ctypes object gave a PEP3118 format string that does not match its itemsize, so a best-guess will be made of the data type. Newer versions of python may behave correctly.
return array(obj, copy=False)
Traceback (most recent call last):
File "/home/alban/.local/lib/python3.8/site-packages/meshio/gmsh/main.py", line 38, in read_buffer
reader = _readers[fmt_version]
KeyError: '4,1'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/alban/.local/lib/python3.8/site-packages/meshio/gmsh/main.py", line 41, in read_buffer
reader = _readers[fmt_version.split(".")[0]]
KeyError: '4,1'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/alban/PycharmProjects/Stage_2021/Test_Scikit-fem/Mesh_gmsh.py", line 45, in <module>
m = MeshTet.load('Mesh3D.msh')
File "/home/alban/.local/lib/python3.8/site-packages/skfem/mesh/mesh.py", line 429, in load
return from_file(filename)
File "/home/alban/.local/lib/python3.8/site-packages/skfem/io/meshio.py", line 140, in from_file
return from_meshio(meshio.read(filename))
File "/home/alban/.local/lib/python3.8/site-packages/meshio/_helpers.py", line 69, in read
return reader_map[file_format](filename)
File "/home/alban/.local/lib/python3.8/site-packages/meshio/gmsh/main.py", line 19, in read
mesh = read_buffer(f)
File "/home/alban/.local/lib/python3.8/site-packages/meshio/gmsh/main.py", line 43, in read_buffer
raise ValueError(
ValueError: Need mesh format in ['2', '2.2', '4', '4.0', '4.1'] (got 4,1)
Process finished with exit code 1
I tchecked and I found out that, with the same code, the .msh file generated is not the same between my computer and the rpi4 :
the .msh generated by my windows computer :
And the one generated on the RPI4 :
As you can see with the same method the files are differents, I have some theories :
- It can be linked with the
/home/alban/.local/lib/python3.8/site-packages/numpy/ctypeslib.py:517: RuntimeWarning: A builtin ctypes object gave a PEP3118 format string that does not match its itemsize, so a best-guess will be made of the data type. Newer versions of python may behave correctly. return array(obj, copy=False) error
-
It can be linked with the mesh generation/export part, maybe gmsh or pygmsh is not supposed to work with the aarch64 from the raspberry pi (i'm on ubuntu 20.04) ?
-
It can simply be linked my python version ?
I installed gmsh/pygmsh with :
sudo apt install python3-gmsh
pip install pygmsh
Is there some depencies that I forgot or did I installed badly something ? (Sorry for the long post by advance)