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

Postby ElMastro » Tue Jun 25, 2019 10:13 pm

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
Posts: 5203
Joined: Wed Oct 22, 2014 5:02 pm

Re: FEM doesn't work anymore

Postby sgrogan » Wed Jun 26, 2019 1:57 am

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 ?
User avatar
bernd
Posts: 8030
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: mesh region

Postby bernd » Wed Jun 26, 2019 9:29 am

or this FEM_Shear_of_a_Composite_Block

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

Re: mesh region

Postby bernd » Wed Jun 26, 2019 9:35 am

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

Postby ElMastro » Thu Jun 27, 2019 3:51 pm

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
Posts: 8030
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: mesh region

Postby bernd » Thu Jun 27, 2019 4:02 pm

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

Postby ElMastro » Thu Jun 27, 2019 4:44 pm

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

Re: mesh region

Postby fandaL » Thu Jun 27, 2019 5:27 pm

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

Postby ElMastro » Thu Jun 27, 2019 8:46 pm

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
Posts: 8030
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: mesh region

Postby bernd » Thu Jun 27, 2019 8:58 pm

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.