Convert a wire 3D mesh from Salome to FEniCS


280
views
0
3 months ago by
Diego  
Hello everybody,

I am modelling the transversal displacement of a slender beam. Since the normal loads act on both perpendicular axes of the beam (x and y) I have to model the problem with a 3D Interval mesh.
I have created the 3D mesh in Salome, it is just an Interval of 60 elements and then I have exported the mesh as a ".mesh" file.
When I try to convert it into a ".xml" file I get an error saying that some data are missing.
Here below is the code.
from fenics import *
from dolfin_utils import meshconvert
import os

os.system('dolfin-convert mesh_R600.mesh riser600_mesh.xml')

and here is the output error message:
Converting from Medit format (.mesh) to DOLFIN XML format
Expecting 61 vertices
Found all vertices
*** Missing data, unable to convert
Process finished with exit code 0

I have already used these instructions to convert other 3D geometries from .mesh into .xml file but this is the first time that I work with a 3D wire geometry.
Could you please help me?

I think that the command "Internal" in mshr allows only 2D wire to be generated that is why I have decided to use Salome to build the 3D wire mesh.
Thank you very much

Diego
Community: FEniCS Project

1 Answer


2
3 months ago by
Try https://github.com/nschloe/meshio . It is more flexible and dolfin-independent mesh converter.
Hello Michal,

in these days I am trying to use meshio as you suggested.
I applied 'meshio' to the wire mesh I created in Salome and it managed to create a ".xml" from a ".med" file despite the following error appeared on the terminal:

File "/home/diego/.local/lib/python2.7/site-packages/meshio/med_io.py", line 25, in read
import h5py
ImportError: No module named h5py

Then I have tried to import the mesh in FEniCS but the ".xml" file cannot be read.
This is the code and the error:

from fenics import *
import numpy as np

mesh = Mesh('meshRiser_600.xml')

Traceback (most recent call last):
File "/home/diego/Documenti/Salome Meca/riser_600.py", line 9, in <module>
mesh = Mesh('meshRiser_600.xml')
File "/usr/lib/python2.7/dist-packages/dolfin/mesh/meshes.py", line 63, in __init__
cpp.Mesh.__cppinit__(self, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/dolfin/cpp/mesh.py", line 1736, in __init__
_mesh.Mesh_swiginit(self, _mesh.new_Mesh(*args))
RuntimeError:

*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
***
*** fenics-support@googlegroups.com
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------------------------------------------------------------------------
*** Error: Unable to read data from XML file.
*** Reason: Error while parsing XML with status "Start-end tags mismatch".
*** Where: This error was encountered inside XMLFile.cpp.
*** Process: 0
***
*** DOLFIN version: 2017.1.0
*** Git changeset: unknown
*** -------------------------------------------------------------------------


Do you have any idea about the error?
Do you know if the problem is related to the fact that I am trying to create a mesh of 1D elements (a sort of beam elements in structural mechanics) and FEniCS cannot handle them?

Thank you very much

Diego
written 11 weeks ago by Diego  
Just install h5py (type in your terminal pip install h5py)
written 11 weeks ago by Hernán Mella  
Please login to add an answer/comment or follow this question.

Similar posts:
Search »