FEM: How to create model with multiple materials

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: FEM: How to create model with multiple materials

Post by bernd »

lambda wrote: Mon Sep 25, 2017 11:11 am Attached you find a minimal example of the fused parts causing an error when writing the .inp file, that I mentioned in my initial post. I have included the FemMesh as it is quite small and maybe there is something wrong with my mesher setup. All you need to do to reproduce is to load the file, activate the analysis, select the solver object, start the solver and click "Write .inp file" button. After a few seconds there will be a message "Error in get_femelement_sets -- > femelements_count_ok() failed!" in the console.
Sure. You meshed a fuse. The fuse does not know about the inner face, thus theres is not FEM-node on the inner face, thus the inp file writer does not know which element is which solid. See attached screen. That is why you have to use the CompSolids. With compsolids the mesher knows about the inner face and can place nodes on that face.

What you could do is make a compound of the two solids. Than the inp writer will work but than the two solids are not connected in the mesh because every solid will have its own nodes on the inner face. Thus again CompSolids. With a compsolid the solids share the inner face and thus they share the nodes in the FEM mesh. Thus the solids will be connected and there will be nodes on the inner face.

Bernd

screen.jpg
screen.jpg (327.76 KiB) Viewed 1661 times
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: FEM: How to create model with multiple materials

Post by bernd »

your example meshed with a compsolid instead of a fusion ... the femmesh has nodes on the inner face.

screen.jpg
screen.jpg (520.62 KiB) Viewed 1655 times
lambda
Posts: 91
Joined: Sat Feb 25, 2017 3:10 pm
Contact:

Re: FEM: How to create model with multiple materials

Post by lambda »

Hi bernd,

thanks for your explanation - this make sense. I guess there is little chance I could have figured this out from the error message.

Maybe describing things in the Wiki would also help. How about the following text for FEM_MeshGmshFromShape?
Description
For a finite elements analysis the geometry needs to be discretized into a mesh. This command uses gmsh (which needs to be installed on the system) for calculating the mesh.

How to use
1. Select the shape you want to analyze. This needs to be a solid or compsolid. A compsolid is necessary if your part is made from multiple materials. (A compsolid can be created with Part_BooleanFragments.)
2. Press the MeshGmshFromShape button
3. Optionally edit the minimal and maximal element size. (Autodetection works fine unless you apply complicated boundary conditions.)
4. Press the Apply button and wait for the computation of the mesh to complete
5. Close the task. You now should see a new FEMMeshGMSH object in your active analysis container.
ATM Debian stable and testing both have the same version of occ, however a new version has been uploaded to unstable just yesterday. I'll give it a try once the migration to testing is complete (if FreeCAD compiles under testing without to much hassle).

Any other ways to create compsolids besides BooleanFragments?
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: FEM: How to create model with multiple materials

Post by bernd »

ask for wiki editing permission in the wiki part of the forum and than you could change the wiki. Your text is right as long as it is about volume fem. But gmsh could be used in shell and beam fem too. One would need similar connected mesh which shares nodes geometry. For shells and wires these are not called compsolid.

You have to have OCCT 6.9 to use boolean fragments. A few CompSolids can be created with older OCCT (solid inside solid), but they are not useful for your kind of FEM.

I have compiled OCCT myself which works quite straight forward. This may help ... https://gist.github.com/berndhahnebach/ ... 967e6cdd36

bernd
lambda
Posts: 91
Joined: Sat Feb 25, 2017 3:10 pm
Contact:

Re: FEM: How to create model with multiple materials

Post by lambda »

Finally got around to updating the wiki, maybe you want to review or improve: https://www.freecadweb.org/wiki/FEM_MeshGmshFromShape
Post Reply