Stress Result in Shells
Moderator: bernd
Forum rules
and Helpful information for the FEM forum
and Helpful information for the FEM forum
Re: Stress Result in Shells
Would be interesting how Salomone handle node gaps in their mesh structure. What do they use to save and load the mesh to and from disk?
Re: Stress Result in Shells
The options are:Werner do you see any solution apart from use some compactMesh() right at the beginning when we create a mesh in FreeCAD. With this the mesh is renumbered during import from frd file.
- Check if it's possible to find a way to make everything consistent again after a mesh has been compacted
- Do some kind of compact mesh before saving a project. At this stage we have the chance to make everything consistent.
- Copy the relevant code of the UNV reader and remove the compactMesh() call. Doing it in the original version is a bad idea because one can link the external smesh. This would be the easiest solution but requires quite a lot of code duplication.
- Switch to another format where it's sure that a mesh won't be reordered after load
IMO, it's a very odd behaviour to hard-code the call of compactMesh() and doesn't give any possibility to disable it.Would be interesting how Salomone handle node gaps in their mesh structure. What do they use to save and load the mesh to and from disk?
Re: Stress Result in Shells
Do we have any salome users over here? maybe somebody can ask it on their forum?
http://www.salome-platform.org/forum
Re: Stress Result in Shells
Attaches some code which would fix it for the FEM 2D start wb example.
- the code loads the example
- runs the analysis
- fixes result object and result mesh
- saves the document
- loads the document
- than the document could be saved and loaded as much as needed ...
- the code loads the example
- runs the analysis
- fixes result object and result mesh
- saves the document
- loads the document
- than the document could be saved and loaded as much as needed ...
Code: Select all
# load 2D example file and set 3D output in solver
doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'data/examples/FemCalculixCantilever2D.FCStd')
doc.FEMMeshGmsh.ViewObject.Visibility = False
doc.CalculiXccxTools.BeamShellResultOutput3D = True
doc.recompute()
# run the analysis
import FemGui
FemGui.setActiveAnalysis(doc.Analysis)
from femtools import ccxtools
fea = ccxtools.FemToolsCcx()
fea.update_objects()
fea.purge_results()
fea.run()
# node keys
doc.Result_mesh.FemMesh.Nodes.keys() # starts with 178
# lets fix it ...
# we need a new res_obj.Mesh.FemMesh and a new res_obj.NodeNumbers
# works on the FEM 2D example only, edges and faces not treated, only 15 node volume treated!
res_obj = doc.CalculiX_static_results
ononu = res_obj.NodeNumbers
res_mesh = res_obj.Mesh
omesh = res_mesh.FemMesh
onodes = omesh.Nodes
ovols = omesh.Volumes
# omesh.Nodes.keys()
# omesh.Edges
# omesh.Faces
# omesh.Volumes
nomap = {} # 178:1, 179:2, ...
elmap = {} # 37:1, 38:2, ...
import Fem
nmesh = Fem.FemMesh()
for i, n in enumerate(onodes):
# print(i)
# print(n)
# print(onodes[n])
nid = i + 1
nmesh.addNode(onodes[n].x, onodes[n].y, onodes[n].z, nid)
nomap[n] = nid
for i, v in enumerate(ovols):
# print(i)
# print(v)
# print(omesh.getElementNodes(v))
vid = i + 1
olenodes = omesh.getElementNodes(v)
nelenodes = []
for on in olenodes:
nelenodes.append(nomap[on])
# print(nelenodes)
nmesh.addVolume(nelenodes, vid)
elmap[v] = vid
nnonu = []
for on in ononu:
nnonu.append(nomap[on])
# nmesh.Nodes.keys()
# nmesh.Volumes
# nnonu
# Fem.show(nmesh)
res_obj.Mesh.FemMesh = nmesh
res_obj.NodeNumbers = nnonu
doc.recompute()
# save and reload the file
save_name = u"/home/hugo/Desktop/nodegapstest.FCStd"
doc.saveAs(save_name)
FreeCAD.closeDocument(doc.Name)
doc2 = FreeCAD.open(save_name)
# node keys
doc2.Result_mesh.FemMesh.Nodes.keys() # starts with 1
Re: Stress Result in Shells
I'm not Salome specialist, but as I understand Salome does not allow to manually control node and element numbers too much. If you delete elements or nodes with low numbers, the rest will be renumbered to start from 1 without gaps.Jee-Bee wrote: ↑Thu Jan 17, 2019 9:04 pmDo we have any salome users over here? maybe somebody can ask it on their forum?
http://www.salome-platform.org/forum
Re: Stress Result in Shells
this compacts the result object and result mesh on inport from frd file. Since they are compacted already saving and reloading a FreeCAD file works fine. https://github.com/berndhahnebach/FreeC ... da24b2085b
Re: Stress Result in Shells
Great. Seams to work fine so far.