Mesh Settings
Moderator: bernd
Forum rules
and Helpful information for the FEM forum
and Helpful information for the FEM forum
Mesh Settings
I just saw that Bernd has added different mesh element size for shape elements. I could not figure out how it works.
My idea is to make a new object: mesh-setting. This is a very similar object like a constraint. It contains a reference to a face, edge or vertex and it contains a characteristic length.
There should be a way to put these information into the geo file for Gmsh.
Ulrich
My idea is to make a new object: mesh-setting. This is a very similar object like a constraint. It contains a reference to a face, edge or vertex and it contains a characteristic length.
There should be a way to put these information into the geo file for Gmsh.
Ulrich
Re: Mesh Settings
Python only ATM.ulrich1a wrote:I could not figure out how it works.
- start FreeCAD --> StartWB --> 3D FEM example
- delete FEM Netgen mesh object
- activate the analysis --> select the Part object Cube --> click on GMSH Mesh object in FEM WB
- make an new FEM mesh with default values
- run the following python code
Code: Select all
femmesh = App.ActiveDocument.getObject("Box_Mesh")
femmesh.CharacteristicLengthMap = {'Face3':'50'}
It should look like the attached screen. But since the example has only 8 nodes it is rather boring. I'll have a look for a better one.
- Attachments
-
- screen1.jpg (300.26 KiB) Viewed 3630 times
Last edited by bernd on Tue Nov 29, 2016 8:21 am, edited 1 time in total.
Re: Mesh Settings
OK attached a much better example to play with:
The vertex does not seam to work, but it is in the geo file. Some GMSH expert could may be explain this.
Code: Select all
femmesh = App.ActiveDocument.getObject("CompSolid_Mesh")
femmesh.CharacteristicLengthMap = {'Face51':'1', 'Vertex3':'1', 'Solid7':'2', 'Edge23':'0.5'}
Re: Mesh Settings
ATM I use a PropertyMap. The property name is CharacteristicLengthMap = {'ElementNameOfTheShapeToMesh' : 'ElementLengthInMilimeter'} I'm not convinced this it the way to go but it works quite well. That is why I just implemented it without GUI.ulrich1a wrote:There should be a way to put these information into the geo file for Gmsh.
This was my idea first too. I changed and thought we could save it in the GMSH mesh object too. Than I made the ProperyMap implementation. It worked but I was not happy with it.ulrich1a wrote: My idea is to make a new object: mesh-setting. This is a very similar object like a constraint. It contains a reference to a face, edge or vertex and it contains a characteristic length.
At the moment I would prefer the following:
- an constraint for each needed CharacteristicLength the user would like to use. The constraint object only needs two properties, a PropertyLength and a PropertySubLink. With this we are much more stable since we gone use real properties instead of the weak map I have been using. The selection could be similar to the material constraint for multi body.
How about this?
Re: Mesh Settings
This is quite the thing, what I have in mind. But it could be a PropertyLinkSubList like in a typical constraint. I tried today myself to make a mesh with different characteristic lengths. I used the Gmsh command "Characteristic Length" which needs a list of vertex numbers. It did the job.bernd wrote:At the moment I would prefer the following:
- an constraint for each needed CharacteristicLength the user would like to use. The constraint object only needs two properties, a PropertyLength and a PropertySubLink. With this we are much more stable since we gone use real properties instead of the weak map I have been using. The selection could be similar to the material constraint for multi body.
How about this?
The constraint approach for the characteristic length has another advantage. It allows to store important properties of the mesh, without having the mesh itself in the document. Sometimes you do not want to have the mesh in the document, because of its storage size.
In a similar direction goes the Gmesh-mesh property "Optimize". I had to set it, because otherwise I got always meshes with a negative Jacobian. I think this has to be set in the Gmesh-Task dialog or in the Gmesh-Properties. Otherwise you have at least make the mesh a second time, if you want to have this option set. Or set the default-value to True.
It worked here for me. I am using Gmesh 2.9.3.bernd wrote:The vertex does not seam to work, but it is in the geo file. Some GMSH expert could may be explain this.
Ulrich
Re: Mesh Settings
Sure it has to be a PropertyLinkSubList. I will try to go this way and come up with something, but it will take some days.ulrich1a wrote:This is quite the thing, what I have in mind. But it could be a PropertyLinkSubList like in a typical constraint.
Have you been reading my first two post? CharacteristicLength is exactly what I use in UpToDate FreeCAD Master to generate the different element size of the meshes posted in the screen. It really works well except if I use only one vertex in the CharacteristicLength. Attached again the mutlibody10solid but the CharacteristicLength PropertyMap included already. Download the file, open it, double click on teh GMSH mesh object, remesh and you will have different element size for some elements. Attached furthermore the geo and brep file. The CharacteristicLength for Solid7, Face51 and Edge23 are recognized, but for the Vertex3 not. But they all are in the geo file.ulrich1a wrote:I tried today myself to make a mesh with different characteristic lengths. I used the Gmsh command "Characteristic Length" which needs a list of vertex numbers. It did the job.
delete .txt
Last edited by bernd on Wed Nov 30, 2016 7:30 am, edited 2 times in total.
Re: Mesh Settings
BTW: Have you seen the PropertyEditor of GMSH mesh object. The Algorithm2D, Algorithm3D and different Mesh optimizations could be activated. Just make a GMSH mehs object, close it, change the Properties, double click and it uses the adjusted Properties will be used in the geo file. Means you can optimize the GMSH mesh from FreeCAD GUI.
cheers bernd
cheers bernd
Re: Mesh Settings
How do we name such object which defines mesh fem-element length for shape-elements of the shape to mesh? Any suggestions?bernd wrote:Sure it has to be a PropertyLinkSubList. I will try to go this way and come up with something, but it will take some days.ulrich1a wrote:This is quite the thing, what I have in mind. But it could be a PropertyLinkSubList like in a typical constraint.
Re: Mesh Settings
I first thought "Mesh-Setting" but I think, "Mesh-Constraint" is good for this type of element.bernd wrote:How do we name such object which defines mesh fem-element length for shape-elements of the shape to mesh? Any suggestions?
I did the first experiments with the Windows-version, which lags behind and did not have this. I gave up compiling myself, since the windows versions are supplied by sgrogan. Thanks to sgrogan for this!bernd wrote:BTW: Have you seen the PropertyEditor of GMSH mesh object. The Algorithm2D, Algorithm3D and different Mesh optimizations could be activated. Just make a GMSH mehs object, close it, change the Properties, double click and it uses the adjusted Properties will be used in the geo file. Means you can optimize the GMSH mesh from FreeCAD GUI.
Yes, I saw the new properties at home and will do some experiments with it. See, if I can get a hex-mesh.
As already said, Vertex 3 was working for me. So it may be a bug in a certain version of Gmsh.
Ulrich
Re: Mesh Settings
I tried too but my knowledge of GMSH is limited. I got a quad mesh for a plane but failed in CalculiX due some strange nodes in the mesh. Would be cool if you are able to mesh hex elements by GMSH. If you need some more sitches of GMSH they are really easy to add.ulrich1a wrote: See, if I can get a hex-mesh.
bernd