Export mesh with regions and properties of materials

About the development of the FEM module/workbench.

Moderator: bernd

User avatar
Adel Chepkunov
Posts: 12
Joined: Mon Oct 07, 2019 1:03 pm

Export mesh with regions and properties of materials

Postby Adel Chepkunov » Mon Oct 07, 2019 2:11 pm

Hello, All!

I have several geometry objects. For example 2 objects: tube (which is cylinder minus cylinder) and another cylinder. I can combine ones and generate the mesh in FEM module.

Now I want to export mesh in some format for use it in external solver (for compare result of two solvers with same mesh).

So, it is need to export not only nodes, faces and volumes, but also regions and properties of materials. Isn't?

How I can do one?

What is best format of exported file?

Thank you in advance for any links. I can't formulate the appropriate question for Google.

BR
Adel
Last edited by Adel Chepkunov on Mon Oct 07, 2019 6:21 pm, edited 1 time in total.
User avatar
bernd
Posts: 10956
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Export mesh with regions and properties of materials

Postby bernd » Mon Oct 07, 2019 4:39 pm

what formats does your external solver supports?
User avatar
Adel Chepkunov
Posts: 12
Joined: Mon Oct 07, 2019 1:03 pm

Re: Export mesh with regions and properties of materials

Postby Adel Chepkunov » Mon Oct 07, 2019 5:57 pm

bernd wrote:
Mon Oct 07, 2019 4:39 pm
what formats does your external solver supports?

Solver was wrote on MatLab, which support stl. But stl store only triangles, I prefer more flexible format. I think there are several external packages for matlab, which can read another mesh formats. I can also try to parse any text format. I can also parse binary format, if it is free and documented format, but it is worse.

So, if solver not support appropriate format, it is not key problem.
User avatar
bernd
Posts: 10956
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Export mesh with regions and properties of materials

Postby bernd » Mon Oct 07, 2019 6:25 pm

FEM meshes with group data are saved inside FreeCAD document by unv file format. Furthermore FEM meshes are transferred from Gmsh to FreeCAD by unv format. Means with unv you are save because it is very well tested inside FreeCAD. If you mark in FreeCAD prefs the group meshing you get group data for any FEM material object, for any FEM constraint. Means you have everything in the mesh. But if you only would like to use the meshing in FreeCAD you do not need to add constraints, better to directly use the FEM group tool to directly create the groups you need. With the tool you can give the mesh groups any name you like.

Hope that helps.
User avatar
Adel Chepkunov
Posts: 12
Joined: Mon Oct 07, 2019 1:03 pm

Re: Export mesh with regions and properties of materials

Postby Adel Chepkunov » Mon Oct 07, 2019 6:47 pm

bernd wrote:
Mon Oct 07, 2019 6:25 pm
...
Yes, I feel this is what I need. Thank you, I'll try it tomorrow.
User avatar
Adel Chepkunov
Posts: 12
Joined: Mon Oct 07, 2019 1:03 pm

Re: Export mesh with regions and properties of materials

Postby Adel Chepkunov » Tue Oct 08, 2019 1:19 pm

Excuse me, but I can not get the groups and regions :(
bernd wrote:
Mon Oct 07, 2019 6:25 pm
If you mark in FreeCAD prefs the group meshing you get group data for any FEM material object, for any FEM constraint.
did you mean """menu:Edit/Preferences => page:FEM -> checkbox: Create mesh groups for analysis reference shapes"""?

It was already checked.


I also found this page: https://www.freecadweb.org/wiki/FEM_She ... site_Block

And made 2 additional conclusion. I'll add ones after time
User avatar
bernd
Posts: 10956
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Export mesh with regions and properties of materials

Postby bernd » Tue Oct 08, 2019 5:49 pm

Adel Chepkunov wrote:
Tue Oct 08, 2019 1:19 pm
Excuse me, but I can not get the groups and regions :(
bernd wrote:
Mon Oct 07, 2019 6:25 pm
If you mark in FreeCAD prefs the group meshing you get group data for any FEM material object, for any FEM constraint.
did you mean """menu:Edit/Preferences => page:FEM -> checkbox: Create mesh groups for analysis reference shapes"""?

It was already checked.
Yes. Be aware it only works with Gmsh and only if the Analysis the objects are in is active.

Adel Chepkunov wrote:
Tue Oct 08, 2019 1:19 pm
I also found this page: https://www.freecadweb.org/wiki/FEM_She ... site_Block

And made 2 additional conclusion. I'll add ones after time
This is useful too
User avatar
bernd
Posts: 10956
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Export mesh with regions and properties of materials

Postby bernd » Tue Oct 08, 2019 5:57 pm

As stated before the other possibility would be the use of the tool FEM mesh group The wiki page does not help much here FEM_MeshGroup ... Just give it a try. You can check the groups by selecting a mesh and check the Data tab.
User avatar
Adel Chepkunov
Posts: 12
Joined: Mon Oct 07, 2019 1:03 pm

Re: Export mesh with regions and properties of materials

Postby Adel Chepkunov » Wed Oct 09, 2019 2:13 pm

bernd wrote:
Tue Oct 08, 2019 5:57 pm
As stated before the other possibility would be the use of the tool FEM mesh group The wiki page does not help much here FEM_MeshGroup ... Just give it a try. You can check the groups by selecting a mesh and check the Data tab.
Yes, I tried to create regions and groups. All is ok.

Notice for new users: Regions can set max size parameter, but isn't transfered to "FEM Mesh" object. With groups it's the other way around
And I have a problem with this mesh.

Nodes of mesh is very small if I not set any parameters. Parameter 'max size' for regions is make mesh very huge.

For example, I have 20mm tube with 4-mm thickness in 200 mm space

When I not set any parameters, volumes in space near tube is very big, and intersect tube in several points.
And when I set max size of tube element to 2, gmesh can hang, because it is created very huge mesh.

Ani idea to do good matrix?

BTW netgen create good matrix with deafault parameters, but not worked with groups.
User avatar
Adel Chepkunov
Posts: 12
Joined: Mon Oct 07, 2019 1:03 pm

Re: Export mesh with regions and properties of materials

Postby Adel Chepkunov » Fri Oct 11, 2019 7:56 am

bernd wrote:
Tue Oct 08, 2019 5:57 pm
As stated before the other possibility would be the use of the tool FEM mesh group The wiki page does not help much here FEM_MeshGroup ... Just give it a try. You can check the groups by selecting a mesh and check the Data tab.
Hello, again.

I added solids material into Analysis and found, that this materials added to unv file. It is very good, because I can only create regions if it need to set mesh-parameter, and can do not create the groups. But, unfortunately, groups created by materials has autogenerated names.

For example -
===
...
SolidMaterial001_Volumes <-- start group based on material defined in Analysis
8 1571 0 0 8 1572 0 0
8 1573 0 0 8 1574 0 0
...
shellGroup_Volumes <-- start same group, but defined in mesh.
8 1571 0 0 8 1572 0 0
8 1573 0 0 8 1574 0 0
...
===

In first case name autogenerated always
In second case, I can set radiobutton 'Label' in group properties, and name in exported file will be based of name in GUI.