mesh region

About the development of the FEM module/workbench.

Moderator: bernd

ElMastro
Posts: 39
Joined: Mon May 27, 2019 9:52 am

mesh region

Post by ElMastro »

Taking advantage of your kindness, I have a last question. I've read in another topic that there is a command in freecad to add physical groups in the mesh with "make mesh region" to provide a mesh to use directly with calculix. As calculix does have a set of peculiar FEM cases available (eletromagnetic study, dynamic, etc) is that true? Is there a guide/tutorial everywhere to read to do that, as I can't find it on the wiki?
Last edited by ElMastro on Thu Jun 27, 2019 3:43 pm, edited 1 time in total.
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: FEM doesn't work anymore

Post by sgrogan »

ElMastro wrote: Tue Jun 25, 2019 10:13 pm Is there a guide/tutorial everywhere to read to do that, as I can't find it on the wiki?
Maybe start here: https://forum.freecadweb.org/viewtopic. ... 18&t=26517 ?
"fight the good fight"
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: mesh region

Post by bernd »

or this FEM_Shear_of_a_Composite_Block

BTW: mesh groups are supportrd by FreeCAD FEM too.
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: mesh region

Post by bernd »

you need to create mesh groups not mesh regions. Export the mesh with groups to inp mesh file format.
ElMastro
Posts: 39
Joined: Mon May 27, 2019 9:52 am

Re: mesh region

Post by ElMastro »

Maybe start here: https://forum.freecadweb.org/viewtopic. ... 18&t=26517 ?
I tried it, but seems different from what I want to do.
Let's say
[*] I create a cube
[*] In FEM, create analysis, mesh with gmsh
[*] Mesh Group, I create two groups
[*] Select everything, export to /tmp/Mesh.inp
Opening in Calculix it doesn't find the Mesh groups.
I doesn't understand where I'm wrong.
In python console, the output is

Code: Select all

Python 3.7.3 (default, Jun 24 2019, 04:54:02) 
[GCC 9.1.0] on linux
Type 'help', 'copyright', 'credits' or 'license' for more information.
>>> App.newDocument("Senza nome")
>>> App.setActiveDocument("Senza_nome")
>>> App.ActiveDocument=App.getDocument("Senza_nome")
>>> Gui.ActiveDocument=Gui.getDocument("Senza_nome")
>>> Gui.activeDocument().activeView().viewDefaultOrientation()
>>> Gui.activateWorkbench("PartWorkbench")
>>> App.ActiveDocument.addObject("Part::Box","Box")
>>> App.ActiveDocument.ActiveObject.Label = "Cubo"
>>> App.ActiveDocument.recompute()
>>> Gui.SendMsgToActiveView("ViewFit")
>>> Gui.activateWorkbench("FemWorkbench")
>>> import FemGui
>>> import ObjectsFem
>>> ObjectsFem.makeAnalysis(FreeCAD.ActiveDocument, 'Analysis')
>>> FemGui.setActiveAnalysis(FreeCAD.ActiveDocument.ActiveObject)
>>> ObjectsFem.makeSolverCalculixCcxTools(FreeCAD.ActiveDocument)
>>> FemGui.getActiveAnalysis().addObject(FreeCAD.ActiveDocument.ActiveObject)
>>> ObjectsFem.makeMeshGmsh(FreeCAD.ActiveDocument, 'FEMMeshGmsh')
>>> FreeCAD.ActiveDocument.ActiveObject.Part = FreeCAD.ActiveDocument.Box
>>> FemGui.getActiveAnalysis().addObject(FreeCAD.ActiveDocument.ActiveObject)
>>> FreeCADGui.ActiveDocument.setEdit(FreeCAD.ActiveDocument.ActiveObject.Name)
>>> ObjectsFem.makeMeshGroup(FreeCAD.ActiveDocument, FreeCAD.ActiveDocument.FEMMeshGmsh)
>>> FreeCADGui.ActiveDocument.setEdit(FreeCAD.ActiveDocument.ActiveObject.Name)
>>> ObjectsFem.makeMeshGroup(FreeCAD.ActiveDocument, FreeCAD.ActiveDocument.FEMMeshGmsh)
>>> FreeCADGui.ActiveDocument.setEdit(FreeCAD.ActiveDocument.ActiveObject.Name)
>>> __objs__=[]
>>> __objs__.append(FreeCAD.getDocument("Senza_nome").getObject("FEMMeshGmsh"))
>>> __objs__.append(FreeCAD.getDocument("Senza_nome").getObject("FEMMeshGroup001"))
>>> __objs__.append(FreeCAD.getDocument("Senza_nome").getObject("FEMMeshGroup"))
>>> import Fem
>>> Fem.export(__objs__,u"/tmp/Mesh.inp")
>>> 
>>> del __objs__
>>> 
In shell the output is

Code: Select all

FreeCAD 0.19, Libs: 0.19R17105 (Git)
© Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2019
  #####                 ####  ###   ####  
  #                    #      # #   #   # 
  #     ##  #### ####  #     #   #  #   # 
  ####  # # #  # #  #  #     #####  #   # 
  #     #   #### ####  #    #     # #   # 
  #     #   #    #     #    #     # #   #  ##  ##  ##
  #     #   #### ####   ### #     # ####   ##  ##  ##

connect failed: File o directory non esistente
Active analysis found: Analysis
TypeError: Can't call meta function because I have no idea how to handle Base::Quantity
TypeError: Can't call meta function because I have no idea how to handle Base::Quantity
Active analysis found: Analysis

We are going to start Gmsh FEM mesh run!
  Part to mesh: Name --> Box,  Label --> Cubo, ShapeType --> Solid
  CharacteristicLengthMax: 1e+22
  CharacteristicLengthMin: 0.0
  ElementOrder: 2
  ElementDimension: 3
  /tmp/Box_Geometry.brep
  /tmp/Box_Mesh_TmpGmsh.unv
  /tmp/shape2mesh.geo
  /usr/bin/gmsh
  Group meshing for analysis.
  The Part should have a pretty new FEM mesh!
Warning : Unknown element type for UNV export (MSH type 15) - output file might be invalid
Warning : Unknown element type for UNV export (MSH type 15) - output file might be invalid
Warning : Unknown element type for UNV export (MSH type 15) - output file might be invalid
Warning : Unknown element type for UNV export (MSH type 15) - output file might be invalid
Warning : Unknown element type for UNV export (MSH type 15) - output file might be invalid
Warning : Unknown element type for UNV export (MSH type 15) - output file might be invalid
Warning : Unknown element type for UNV export (MSH type 15) - output file might be invalid
Warning : Unknown element type for UNV export (MSH type 15) - output file might be invalid

Single click on a Solid, Face, Edge, Vertex will add it to the list!
selection: Solid  Box  Face6
Single click on a Solid, Face, Edge, Vertex will add it to the list!
selection: Solid  Box  Face5 
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: mesh region

Post by bernd »

would you attach the FreeCAD file and the inp file. On the inp file you may need to attach a .txt for upload.
ElMastro
Posts: 39
Joined: Mon May 27, 2019 9:52 am

Re: mesh region

Post by ElMastro »

MeshGroup.FCStd
Project
(102.88 KiB) Downloaded 35 times
Mesh.inp.zip
Result File
(63.66 KiB) Downloaded 34 times
Hope it is ok like this, or I'll attach it as *.txt
fandaL
Posts: 440
Joined: Thu Jul 24, 2014 8:29 am

Re: mesh region

Post by fandaL »

ElMastro wrote: Thu Jun 27, 2019 3:51 pm I tried it, but seems different from what I want to do.
Let's say
[*] I create a cube
[*] In FEM, create analysis, mesh with gmsh
[*] Mesh Group, I create two groups
[*] Select everything, export to /tmp/Mesh.inp
Opening in Calculix it doesn't find the Mesh groups.
Check your “Edit -> Preferences -> Import-Export -> Abaqus INP” where “Export group data” should be checked.

When I created objects in your order, I did not get mesh groups. Inp file contained at the file end
** Group data
But no group data were there.

But if I updated mesh, then export works and nsets and elsets are there. So mesh groups seems to be "empty" until mesh is generated (apply button in Mesh object) with FEMMeshGroup defined by a user.

BTW:
When I had in preferences “Which mesh elements to export = Highest” I got volume mesh only (no face nor edge elements) as expected, but for mesh groups I got also

Code: Select all

** GroupID: 3 --> GroupName: FEMMeshGroup001_Faces --> GroupElementType: Face
*ELSET, ELSET=FEMMeshGroup001_Faces
5
6
7  

Which seems to crate elset from face elements which does not exist in the exported inp file. Similarly, if I create mesh group from geometry edge, it will export non-existing edge elements. That would probably give an error in ccx.
ElMastro
Posts: 39
Joined: Mon May 27, 2019 9:52 am

Re: mesh region

Post by ElMastro »

fandaL, I can fully confirm.
With the method described by you, in the *.inp the groups (withe their names) are added, however loading it with calculix a MsgBox appears telling
Access violation.

Press OK to ignore and risk data corruption.
Press Cancel to kill the program.
and after it refuses of loading all groups.
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: mesh region

Post by bernd »

What programm do you use to load the file? AFIK calculix can not load a file, it only can run a file. Furthermore calculix does not have a gui with message boxes AFIK.
Post Reply