View Issue Details

IDProjectCategoryView StatusLast Update
0002649FEMBugpublic2017-03-13 23:49
Reporterberndhahnebach Assigned To 
PrioritylowSeverityminorReproducibilityalways
Status closedResolutionopen 
PlatformallOSallOS Versionall
Product Version0.17 
Summary0002649: save and reload pyra elements (pyra5 and pyra13)
DescriptionThe pyra13 elements are still disorted on FreeCAD file save and reload. This has been working with old SMESH.

EDIT:
the med file format export and import in FreeCAD 0.17.xxxx supports the pyra5 and pyra13 elements.
Steps To ReproduceMake a pyra13 element by python. Save FreeCAD file, Load the FreeCAD file. The nodes are disorted.

import Fem
# 13 node pyramid --> pyra13 ####################
pyra13 = Fem.FemMesh()
pyra13.addNode( 0,20, 0, 1)
pyra13.addNode(20,20, 0, 2)
pyra13.addNode(20, 0, 0, 3)
pyra13.addNode( 0, 0, 0, 4)
pyra13.addNode(10,10,10, 5)

pyra13.addNode(10,20, 0, 6)
pyra13.addNode(20,10, 0, 7)
pyra13.addNode(10, 0, 0, 8)
pyra13.addNode( 0,10, 0, 9)

pyra13.addNode( 5,15, 5,10)
pyra13.addNode(15,15, 5,11)
pyra13.addNode(15, 5, 5,12)
pyra13.addNode( 5, 5, 5,13)
pyra13.addVolume([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13])
pyra13
obj = App.ActiveDocument.addObject("Fem::FemMeshObject","pyra13")
obj.FemMesh = pyra13
obj.Placement.Base = (120,0,0)
obj.ViewObject.DisplayMode = "Faces, Wireframe & Nodes"
Additional InformationThe pyra5 element does not save and reload at all. This is a known problem and has happend in older SMESH too. See forum post in the regard of pyra5. http://forum.freecadweb.org/viewtopic.php?f=18&t=13583#p108941 The ling in the forum post is may be wrong because it points to the old SMEH.
TagsNo tags attached.
FreeCAD Information

Activities

berndhahnebach

2017-01-24 17:16

developer   ~0007965

Last edited: 2017-01-24 17:17

confirmed on Version: 0.17.9783 (Git)

I had a closer look the problem is in the unv reader writer. Since FreeCAD fcstd uses unv to write and load FEM meshes the problem occurs on FreeCAD file save and load too.I do not know if it is the reader or writer. The following code shows the problem:

# 13 node pyramid --> pyra13
import Fem
pyra13 = Fem.FemMesh()
pyra13.addNode( 0,20, 0, 1)
pyra13.addNode(20,20, 0, 2)
pyra13.addNode(20, 0, 0, 3)
pyra13.addNode( 0, 0, 0, 4)
pyra13.addNode(10,10,10, 5)

pyra13.addNode(10,20, 0, 6)
pyra13.addNode(20,10, 0, 7)
pyra13.addNode(10, 0, 0, 8)
pyra13.addNode( 0,10, 0, 9)

pyra13.addNode( 5,15, 5,10)
pyra13.addNode(15,15, 5,11)
pyra13.addNode(15, 5, 5,12)
pyra13.addNode( 5, 5, 5,13)
pyra13.addVolume([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13])
pyra13.Volumes
pyra13.getElementNodes(1)


mesh_file = u"/tmp/femmesh.unv"
pyra13.write(mesh_file)
mesh = Fem.read(mesh_file)
mesh.Volumes
mesh.getElementNodes(1)


pyra13.getElementNodes(1) gives: (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)

where as

mesh.getElementNodes(1) gives (1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 5)

berndhahnebach

2017-01-24 17:21

developer   ~0007966

Attached furthermore code to make a pyra5 save it to unv and read it. The nodes will be read but the elements not

# 5 node pyramid --> pyra5
import Fem
pyra5 = Fem.FemMesh()
pyra5.addNode( 0,20, 0, 1)
pyra5.addNode(20,20, 0, 2)
pyra5.addNode(20, 0, 0, 3)
pyra5.addNode( 0, 0, 0, 4)
pyra5.addNode(10,10,10, 5)
pyra5.addVolume([1, 2, 3, 4, 5])
pyra5.Volumes
pyra5.getElementNodes(1)

mesh_file = u"/tmp/femmesh.unv"
pyra5.write(mesh_file)
mesh = Fem.read(mesh_file)
mesh.Nodes
mesh.Volumes

vejmarie

2017-02-26 15:35

developer   ~0008450

I can reproduce the problem and confirm it. Let's try to find the root cause.

vejmarie

2017-02-26 16:44

developer   ~0008454

I think for pyra5 we hit the same limitation than the one reported by Werner in your forum entry unfortunatly the UNV Writer/Reader do not support such elements. pyra13 are the only one elements with wrong element ordering or did you detect any others ? Tetra are now working fine that is why I ask ;)

berndhahnebach

2017-02-26 17:39

developer   ~0008455

yes,
pyra13 has errors, pyra5 is not supported and all other work fine!
bernd

vejmarie

2017-02-26 18:19

developer   ~0008456

Ok, will continue to check for pyra13. That should be an index error somewhere.

berndhahnebach

2017-02-26 18:37

developer   ~0008458

Last edited: 2017-02-26 18:37

pyra13.getElementNodes(1) gives: (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)

where as

mesh.getElementNodes(1) gives (1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 5)

berndhahnebach

yes

vejmarie

2017-02-26 20:30

developer   ~0008462

I just checked with 0.16. If the file is properly generated (the UNV) I can open it with 0.17. So it looks like to be an issue at the export stage.

berndhahnebach

2017-02-27 13:02

developer   ~0008465

YEAH it is what I encountered too. It seams an export issue. Import is same node indexes on 0.16 and 0.17 in smesh import code:

https://github.com/FreeCAD/FreeCAD/blob/dde52952f4de7ae8ec92a6afe90f013e292921f0/src/3rdParty/salomesmesh/src/DriverUNV/DriverUNV_R_SMDS_Mesh.cpp#L376

https://github.com/FreeCAD/FreeCAD/blob/releases/FreeCAD-0-16/src/3rdParty/salomesmesh/src/DriverUNV/DriverUNV_R_SMDS_Mesh.cpp#L242

vejmarie

2017-03-01 22:11

developer   ~0008485

Got a question for you. While looking at that documentation
http://www.sdrl.uc.edu/sdrl/referenceinfo/universalfileformats/file-format-storehouse/universal-dataset-number-2412
There is no Pyra element defined into the UNV file format. (I am trying to find some documentation about the format, but it is not that easy as to understand the node interleaving). They are driven through 114, which are wedges.
It worked in the past but the new implementation with VTK is really different, and I am still investigating. But if some of you have a better description than me on the UNV file format I will really appreciate !

berndhahnebach

2017-03-02 07:26

developer   ~0008495

Last edited: 2017-03-02 07:27

When I filled the bug report I thought it was an index problem only. Since you had been fixing the other elements I assigned it to you. But it seams to be more difficault to fix.

It's is a pity gmsh does not support pyra elemets AFAIK, means we can not have a look at their code, and can not test with gmsh.

Since at the moment I do not know anybody who uses pyra elements we could set the priority to very low. I would delete your assignment and set it back to confirmed.

But anyway I will have a look too and try to figure it out ...

cheers bernd

vejmarie

2017-03-02 07:35

developer   ~0008496

Hi Bernd,

I can keep it assigned without any issues. I am just trying to figure out what should be the right element sorting into the UNV file format for a Pyra13. Fixing this bug is not an easy task as it requires to digg into the SMESH code a lot. That is of interest to me currently ;). The other thing is that there is not that many documentations available on the UNV format. As Pyra5 are not supported at the export of SMESH, I am starting to wonder why Pyra13 will be, and if they just add started some implementation without validation it. I will have a look into Salome code to see if I find something regarding these elements.

vejmarie

berndhahnebach

2017-03-02 08:55

developer   ~0008500

Last edited: 2017-03-02 08:55

Hi Vejmarie,

that's great.

BTW1: Are we going to see some improvement in FreeCAD FEM meshing?

BTW2: I started to improve my C++ too. I may spend time to extend the python api from FreeCAD to smesh. I allready did add some methods in this regard. I would like to improve the meshing in FreeCAD together with smesh since the GMSH objects are more or less a work araound. We need the smesh meshing and meshing is the bas of FEM! But this surely takes lot of time. Damn ... The spare time is limited and other FEM development is going on too ...

Bernd

vejmarie

2017-03-02 09:18

developer   ~0008501

Hi Bernd,

I also go have a crazy amount of things to do. I am trying to formalize a little what we needed to do. I will probably improve the FEM Mesh rendering with some OpenGL tweaking (it is crazy slow currently and shall be far much faster). I will try to stabalize SMESH in freeCAD and we need to manage Solid/Fluid Mesh for better CFD analysis and integration. I loved to see also hexa mesh but this is a long task. I need to discuss with a few friends to see if they could release publically some good code for that ;)

I agree, we know what is needed, the work is crazy huge and we need to have the patience to do it.

vejmarie

vejmarie

2017-03-02 09:48

developer   ~0008502

Hi,

I think I know why it doesn't work. See https://www.cfd-online.com/Forums/openfoam-meshing-open/73971-mesh-conversion-salome-openfoam.html#post297825 . I discussed with some friends who did confirmed me that pyramid doesn't exist in UNV format and that we shouldn't use them for such format, even if in some cases SMESH has been able to generate them in the past it was not supposed to (roughly it was a bug that it generated them, and you couldn't open the file with non SMESH reader so in the end it is totally useless). So it should act as for the pyra5 which is not exported as a volume, purely because it doesn't exist. I can probably patch SMESH for FreeCAD to avoid generating the Volume element in the UNV file format output, if you believe it is more relevant.

vejmarie

berndhahnebach

2017-03-02 10:10

developer   ~0008503

Wow another grea news. You gone have grazy good contacts out there ...

I can probably patch SMESH for FreeCAD to avoid generating the Volume element in the UNV file format output, if you believe it is more relevant.

vejmarie
For me it is not relevant, the only possibility to create these pyra elements I have seen so far is by python in FreeCAD. I wonder if we should comment this possibility and change the documentation in this regard. https://www.freecadweb.org/wiki/FEM_Mesh
I did wrote you an pm on FC forum ...

bernd

vejmarie

2017-03-02 10:25

developer   ~0008504

I think we can keep the support for the element, purely because MED file format support pyramid ;). (this is also why I pushed a little to support this format support, I-DEAS format is old). The bug is purely that SMESH is generating Pyra5 and Pyra13 element into 2412 UNV card, while it shouldn't. It is easy for me to avoid that and keep these elements into MED as an example. Will try to do it tonight. You can then keep the element. If you could update the documentation in that way this might be great.

I will check my PM on the forum ;)

berndhahnebach

2017-03-02 10:50

developer   ~0008505

Last edited: 2017-03-02 10:51

I think we can keep the support for the element, purely because MED file format support pyramid ;).

vejmarie
wow I did not know ... Just gave it a try and export and import works great for me with pyra5 and pyra13 with FreeCAD 0.17.10337 !

Will try to do it tonight. You can then keep the element. If you could update the documentation in that way this might be great.

vejmarie
Ok I will update the documentation in the regard of im and export on https://www.freecadweb.org/wiki/FEM_Mesh I will add med there too. On unv (and thus FreeCAD) I'm gone write no support for pyra elements.

I can probably patch SMESH for FreeCAD to avoid generating the Volume element in the UNV file format output, if you believe it is more relevant.

vejmarie
We may deactive it. It is up to you.

berndhahnebach

2017-03-02 12:07

developer   ~0008508

Last edited: 2017-03-02 12:07

I will update the documentation in the regard of im and export

berndhahnebach
done https://www.freecadweb.org/wiki/FEM_Mesh#FEM_Mesh_Elements_in_FreeCAD

vejmarie

2017-03-03 21:45

developer   ~0008533

I just submitted a PR, so if wmayer merge it I think we can close the bug. UNV Writer do not generate anymore Pyra5 and Pyra13 volume element which are prohibited by UNV file format.

Related Changesets

FreeCAD: master f66307e4

2017-03-03 21:36:38

vejmarie


Committer: yorik Details Diff
Disable pyra13 output within UNV file, as this element is not officially supported
by this file format.

Fix bug 2649
Affected Issues
0002649
mod - src/3rdParty/salomesmesh/src/DriverUNV/DriverUNV_W_SMDS_Mesh.cpp Diff File

Issue History

Date Modified Username Field Change
2016-07-28 23:09 berndhahnebach New Issue
2016-07-28 23:09 berndhahnebach Status new => assigned
2016-07-28 23:09 berndhahnebach Assigned To => vejmarie
2017-01-24 17:16 berndhahnebach Note Added: 0007965
2017-01-24 17:17 berndhahnebach Note Edited: 0007965
2017-01-24 17:21 berndhahnebach Note Added: 0007966
2017-02-26 15:35 vejmarie Note Added: 0008450
2017-02-26 16:44 vejmarie Note Added: 0008454
2017-02-26 17:39 berndhahnebach Note Added: 0008455
2017-02-26 18:19 vejmarie Note Added: 0008456
2017-02-26 18:37 berndhahnebach Note Added: 0008458
2017-02-26 18:37 berndhahnebach Note Edited: 0008458
2017-02-26 20:30 vejmarie Note Added: 0008462
2017-02-27 13:02 berndhahnebach Note Added: 0008465
2017-03-01 22:11 vejmarie Note Added: 0008485
2017-03-02 07:26 berndhahnebach Note Added: 0008495
2017-03-02 07:27 berndhahnebach Note Edited: 0008495
2017-03-02 07:28 berndhahnebach Priority normal => low
2017-03-02 07:28 berndhahnebach Status assigned => confirmed
2017-03-02 07:28 berndhahnebach Target Version 0.17 =>
2017-03-02 07:28 berndhahnebach Assigned To vejmarie =>
2017-03-02 07:29 berndhahnebach Summary save and reload pyra13 => save and reload pyra elements (pyra5 and pyra13)
2017-03-02 07:35 vejmarie Note Added: 0008496
2017-03-02 08:55 berndhahnebach Note Added: 0008500
2017-03-02 08:55 berndhahnebach Note Edited: 0008500
2017-03-02 09:18 vejmarie Note Added: 0008501
2017-03-02 09:48 vejmarie Note Added: 0008502
2017-03-02 10:10 berndhahnebach Note Added: 0008503
2017-03-02 10:25 vejmarie Note Added: 0008504
2017-03-02 10:50 berndhahnebach Note Added: 0008505
2017-03-02 10:51 berndhahnebach Note Edited: 0008505
2017-03-02 12:07 berndhahnebach Note Added: 0008508
2017-03-02 12:07 berndhahnebach Note Edited: 0008508
2017-03-03 21:45 vejmarie Note Added: 0008533
2017-03-05 20:37 berndhahnebach Status confirmed => closed
2017-03-05 20:37 berndhahnebach Description Updated
2017-03-13 23:49 Kunda1 Changeset attached => FreeCAD master f66307e4