On Thu, Apr 29, 2010 at 8:49 PM, Logan Sorenson <logan.s...@gmail.com> wrote:
Hi,
On Thu, Apr 29, 2010 at 3:37 PM, Logan Sorenson <logan.s...@gmail.com> wrote:
Hi Robert,
On Thu, Apr 29, 2010 at 5:20 AM, Robert Cimrman <cimr...@ntc.zcu.cz> wrote:
Hi Logan,
On 04/28/10 22:01, Logan Sorenson wrote:
Hi All,
Please find attached a patch to sfepy/fem/meshio.py for basic read support for MED format meshes. I'm attaching the patch here since github seems to be down in the US. MED is the native mesh format for the very powerful open-source meshing tools salome [1] and pythonocc [2].
Actually, it is very incomplete, but seems to work with the provided example mesh (Mesh_1.med). I only tried loading the mesh with postproc.py, so I haven't run any calculations on it yet (I assume that should work ok). So far, it only supports 3D 8-node hexahedral elements, so I suppose it is more of an example of reading the format than an actual final production code. :) I hope it can be generalized to work with more MED meshes.
Nice! It works fine here. Do you want me to apply it now, or after you add more functionality?
I'm going to be doing some more work to get it more robust and support more features of the MED format. On the other hand, I guess it doesn't affect any other parts of sfepy, so it probably wouldn't hurt to check it in. Do you think we should wait until it supports more features?
Ok, I put in some work, now it should (in theory - see below) support all MED elements except for general polygons and polyhedrons. Also, I made it grab the mesh automatically without relying on the name being Mesh_1. It still only looks at the first mesh in the MED file, but we could easily roll it into a loop if we think it's needed. The code is now in the med branch on my github repository at [6]. Feel free to give it a try and see if there are any bugs! ;)
One detail - I had used the comment markup like
## # c: 05.02.2008
at the ancient times before I used any version control system at all and it leaked into the repository only by inertia. There is no need for this now, and I slowly remove it when updating/fixing some part of the code.
It is a good indicator which parts are old, usually buggy, undocumented, and need a refit :-)
Ok, it's no problem to remove it if it is no longer recommended. :)
I found some French documentation on MED in the source packages at [1]; I used google docs to translate it to English, so if someone wants a copy of that, let me know. I'm looking for a better English version of these docs.
I can handle French (sort of), if you do not find the English version.
Ok, I put the French document at [3], along with the google docs English translation (text only) at [4]. I can decipher most of it, but one thing I'm having problems with is the distinction between "Maillage" and "Maille". I'm guessing "Maillage" is the mesh as a whole while a "Maille" is the element connectivities.
Also, this documentation seems to be for the API rather than the file format itself. Do you think it would be advantageous to use the APIs provided by salome platform, or would it be better just to implement our own version based off the file format? So far, I think the latter has the advantage of simplicity. There is a nice high-level description of the MED layers at [5].
One question I have is if SfePy supports multiple dimensional meshes at once. It seems the MED format also contains the face and edge elements for a 3D mesh. What would happen if we grab all of these meshes? I'll give it a try... :)
Right now, I'm grabbing all the elements in the MED file (assuming they are compatible with SfePy). postproc.py doesn't seem to complain about mixed 2D and 3D elements, but I've yet to try an actual calculation with the mesh. Is it a problem to mix the dimensionalities of the elements?
Ok, I was able to run the poisson's example on an MED mesh! However, I had to comment out the 2D elements from the MED->SfePy desc translation dict below. I am getting a SEGFAULT when running with multiple dimension meshes. I suspect the mixed dimensionality of the mesh is overrunning some array bounds in the C code. I guess for now we can try to grab only 3D elements if they exist, and if not, grab 2D elements.
Where can I find what element (descs) are supported by SfePy? Following is the dictionary which maps MED element types to SfePy descs. I have certain lines commented out because postproc.py was throwing a KeyError, so I was assuming these types are not implemented yet. Also, I think the 1D elements are not supported by SfePy, correct? Is there support for quad order elements (e.g., 20 node hexahedral)?
# Dict to map MED element names to SfePy descs #NOTE: The commented lines are elements which # produce KeyError in SfePy med_descs = { 'TE4' : '3_4', #'T10' : '3_10', #'PY5' : '3_5', #'P13' : '3_13', 'HE8' : '3_8', #'H20' : '3_20', #'PE6' : '3_6', #'P15' : '3_15', #TODO: Polyhedrons (POE) - need special handling 'TR3' : '2_3', #'TR6' : '2_6', 'QU4' : '2_4', #'QU8' : '2_8', #TODO: Polygons (POG) - need special handling #'SE2' : '1_2', #'SE3' : '1_3', }
Ok, I'm off to try some calculations. Thanks, and happy meshing! :)
Logan
[1] http://www.salome-platform.org [2] http://www.pythonocc.org [3] http://groups.google.com/group/sfepy-devel/web/NOTE_HI_26_03_012_A.pdf [4] http://groups.google.com/group/sfepy-devel/web/NOTE_HI.txt [5] http://www.salome-platform.org/about/med
-- You received this message because you are subscribed to the Google Groups "sfepy-devel" group. To post to this group, send email to sfepy...@googlegroups.com. To unsubscribe from this group, send email to sfepy-devel...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sfepy-devel?hl=en.