Contstraints for med file (code aster) . shape names in med

About the development of the FEM module/workbench.

Moderator: bernd

Post Reply
zoidberg
Posts: 34
Joined: Mon Nov 18, 2013 2:59 pm

Contstraints for med file (code aster) . shape names in med

Post by zoidberg »

Hi,

I come from salome/salome_meca (salome+code_aster) and want to test the FreeCAD FEM features.
I work with code_aster for now with med files and set the constraints in salome.

How can I get the face/shape names in FreeCAD. Are these also exported to med?

does the netgen mesher in FreeCAD also generate 3D (for calculation) and 2D (for constraints) Elements?

my questions refer to the python API and not to the GUI.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Contstraints for med file (code aster) . shape names in med

Post by bernd »

zoidberg wrote: I come from salome/salome_meca (salome+code_aster) and want to test the FreeCAD FEM features.
Hi zidberg, and welcome back to the world of FreeCAD. You have not been posting for quite a while. Just for your information. FreeCAD FEM is evolving fast. Thus you should use the latest FreeCAD development version 0.17.x to work with FEM.
zoidberg wrote:I work with code_aster for now with med files and set the constraints in salome.

How can I get the face/shape names in FreeCAD. Are these also exported to med?
I do not realy know what you meand with this? A face or shape does not have a name in FreeCAD. The document object the shape belongs to has a name. But this are geometry objects, and med is a mesh format. What you can export to med and what will be written into the med are groups of mesh faces or groups of mesh nodes or groups of mesh volumes. These groups have names and you can set this name and it will be exported into med. These groups could be used for boundary conditions. It is what some people do with FreeCAD and ElmerFEM.
zoidberg wrote:does the netgen mesher in FreeCAD also generate 3D (for calculation) and 2D (for constraints) Elements?
The netgen mesher as well as the GMSH mesher do make 3D and 2D elements in one mesh. But the netgen mesher does not support groups of mesh faces at the moment. They are needed to group the mesh faces for setting up the constraints.

BTW:
In FreeCAD we do not define constraints on the mesh like in many other FEM software. In FreeCAD FEM a geometry is modeled, all constraints are set on the geometry, and at very last the mesh is generated with the wished adjustments.

hope that helps bernd
zoidberg
Posts: 34
Joined: Mon Nov 18, 2013 2:59 pm

Re: Contstraints for med file (code aster) . shape names in med

Post by zoidberg »

bernd wrote:...What you can export to med and what will be written into the med are groups of mesh faces or groups of mesh nodes or groups of mesh volumes. These groups have names and you can set this name and it will be exported into med.... In FreeCAD FEM a geometry is modeled, all constraints are set on the geometry, and at very last the mesh is generated with the wished adjustments.
Yes I know that. In Salome e.g. an imported STEP file has shapes with names. The names of the shapes are similar to the exported node/face groups in the med files.

I want to do the same with a FreeCAD script and need some hints how to achieve this.

1. set the names of the geometry shapes
2. create the mesh
3. creating node/face grouprs relating to those shapes and giving them the same names
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Contstraints for med file (code aster) . shape names in med

Post by bernd »

best would be if you coud post a med and the step of a simple example and we try to archive this with FreeCAD.
zoidberg
Posts: 34
Joined: Mon Nov 18, 2013 2:59 pm

Re: Contstraints for med file (code aster) . shape names in med

Post by zoidberg »

STEP:
https://www.dropbox.com/s/cl97ptcka2xgn ... 6.stp?dl=0

MED generated by salome:
https://www.dropbox.com/s/886duwv7xc92l ... 6.med?dl=0

As far as I understand:
Salome uses Smesh for meshing which has interfaces to netgen. FreeCAD also uses Smesh in the FEM modul (has nothing to do with the FreeCAD mesh module for modesling/rendering). Do I have access to all smesh functions as in salome?
In salome I create the groups also from the geometry:

Code: Select all

subshapes =geompy.SubShapeAll( geom, geompy.ShapeType["FACE"])
for subshape in subshapes:
   subShapeID = geompy.GetSubShapeID(geom, subshape)
   group = mesh.GroupOnGeom(subshape)
   groupname = group.GetName()
   elementIDs = mesh.GetSubMeshElementsId(subShapeID)
   [..element access]
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Contstraints for med file (code aster) . shape names in med

Post by bernd »

zoidberg wrote:As far as I understand:
Salome uses Smesh for meshing which has interfaces to netgen. FreeCAD also uses Smesh in the FEM modul (has nothing to do with the FreeCAD mesh module for modesling/rendering).
Totally right !
zoidberg wrote:Do I have access to all smesh functions as in salome?
no not to all, only to the ones implemented in the python FEM mesh API. See https://github.com/FreeCAD/FreeCAD/blob ... MeshPy.xml for all supported calls. Creating mesh groups is only supported by FreeCAD FEM GMSH mesh object. This uses GMSH for meshing and imports the mesh by unv file. Med file import supports mesh groups too. But creating mesh groups directly or by the FreeCAD FEM netgen smesh mesh object is not yet supported unfortunately. This would involve C++ development. So far nobody attracted this ... But at least it has been on my ToDo for quit a long time already.

Means to what you would like to archive you would need FreeCAD 0.17 development version. There you have a GMSH mesh object and a mesh group object. They work on geometry. attached an simple FreeCAD example file of FEM mesh with face groups. Both could be scripted

bernd
mesh_with_groups.fcstd
(92.57 KiB) Downloaded 44 times
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Contstraints for med file (code aster) . shape names in med

Post by bernd »

zoidberg wrote: MED generated by salome:
https://www.dropbox.com/s/886duwv7xc92l ... 6.med?dl=0
could you try to re import the med file? It does not import any mesh in FreeCAD but I do not know whats the problem is, FreeCAD or the file. What software does support med to. I'd like to try this med on a third party software before I start to search inside FreeCAD.

bernd

EDIT: error in FreeCAD:

Code: Select all

- Trace /home/hugo/Documents/dev/freecad/freecadbhb_dev/freecad/src/3rdParty/salomesmesh/src/SMESH/DriverMED_R_SMESHDS_Mesh.cpp [995] : The following exception was caught:
	Not enough memory available
since the file was in an external resouce which might be unavailable later on I attach the file again:

remove .txt
gn_297-17_5-k6.med.txt
(364.81 KiB) Downloaded 83 times
Post Reply