FE Meshing a Fabrication Direct From CAD

About the development of the FEM module/workbench.

Moderator: bernd

User avatar
DamianHarty
Posts: 48
Joined: Tue Jul 07, 2020 3:50 pm

FE Meshing a Fabrication Direct From CAD

Post by DamianHarty »

O Learned Denizens, I humbly prostrate myself before your collective wisdom once more.

I have received yet another STEP file, this time of quite a simple fabrication.

I want to run some finite element analysis on it, but at present when I run GMSH it meshes most of the structure but misses two tubes out when the file is imported with STEP Compound Merge enabled. If I run Netgen then I get a beautiful mesh over the whole component...that is only a surface mesh with no tetrahedrals in it.

If I import the file without STEP Compound Merge then I can mesh each part individually using GMSH without difficulty, but the problematic items from the first go only have a surface mesh on them.

Anyone got any advice on what features of the CAD cause the mesher to fail like this? It's basically a tube with an end cut made by another tube, the two that are failing; another tube in the fabrication meshes just fine.

After I have it all meshed, I will be back with more questions about "constraint tie", I am sure.

Damian
User avatar
-alex-
Veteran
Posts: 1861
Joined: Wed Feb 13, 2019 9:42 pm
Location: France

Re: FE Meshing a Fabrication Direct From CAD

Post by -alex- »

DamianHarty wrote: Thu Mar 09, 2023 12:49 pm Anyone got any advice on what features of the CAD cause the mesher to fail like this?
Without the CAD file that's not so easy to help.
I assume the issue is due to your model which is certainly a mix of shells and solids.
You have to Part_CheckGeometry your model first.
Then adjust it to get only 1 shell or only 1 solid to mesh.
FEM workbench doesn't handle multi-mesh.
chrisb
Veteran
Posts: 54223
Joined: Tue Mar 17, 2015 9:14 am

Re: FE Meshing a Fabrication Direct From CAD

Post by chrisb »

Moved to FEM forum.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
DamianHarty
Posts: 48
Joined: Tue Jul 07, 2020 3:50 pm

Re: FE Meshing a Fabrication Direct From CAD

Post by DamianHarty »

So my next question is how to run the geometry check?

https://wiki.freecad.org/Part_CheckGeometry - got it.

"1 processed out of 1 selected
0 invalid shapes."

The file is attached.
Attachments
ArmSample.STEP
(319.62 KiB) Downloaded 25 times
User avatar
DamianHarty
Posts: 48
Joined: Tue Jul 07, 2020 3:50 pm

Re: FE Meshing a Fabrication Direct From CAD

Post by DamianHarty »

I can parse the source file to see what's in it.

Code: Select all

awk '/^#[0-9]/ { print $3 }' ArmSample.STEP | sort | uniq
I see all sorts of things:

Code: Select all

ADVANCED_BREP_SHAPE_REPRESENTATION
ADVANCED_FACE
APPLICATION_CONTEXT
APPLICATION_PROTOCOL_DEFINITION
APPROVAL
APPROVAL_DATE_TIME
APPROVAL_PERSON_ORGANIZATION
APPROVAL_ROLE
APPROVAL_STATUS
AXIS2_PLACEMENT_3D
B_SPLINE_CURVE_WITH_KNOTS
B_SPLINE_SURFACE_WITH_KNOTS
BOUNDED_CURVE
CALENDAR_DATE
CARTESIAN_POINT
CC_DESIGN_APPROVAL
CC_DESIGN_DATE_AND_TIME_ASSIGNMENT
CC_DESIGN_PERSON_AND_ORGANIZATION_ASSIGNMENT
CC_DESIGN_SECURITY_CLASSIFICATION
CIRCLE
CLOSED_SHELL
CONICAL_SURFACE
CONVERSION_BASED_UNIT
COORDINATED_UNIVERSAL_TIME_OFFSET
CYLINDRICAL_SURFACE
DATE_AND_TIME
DATE_TIME_ROLE
DESIGN_CONTEXT
DIMENSIONAL_EXPONENTS
DIRECTION
EDGE_CURVE
EDGE_LOOP
FACE_BOUND
FACE_OUTER_BOUND
GEOMETRIC_REPRESENTATION_CONTEXT
LENGTH_MEASURE_WITH_UNIT
LENGTH_UNIT
LINE
LOCAL_TIME
MANIFOLD_SOLID_BREP
MECHANICAL_CONTEXT
NAMED_UNIT
ORGANIZATION
ORIENTED_EDGE
PERSON
PERSON_AND_ORGANIZATION
PERSON_AND_ORGANIZATION_ROLE
PLANE
PRODUCT
PRODUCT_DEFINITION
PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE
PRODUCT_DEFINITION_SHAPE
PRODUCT_RELATED_PRODUCT_CATEGORY
SECURITY_CLASSIFICATION
SECURITY_CLASSIFICATION_LEVEL
SHAPE_DEFINITION_REPRESENTATION
UNCERTAINTY_MEASURE_WITH_UNIT
VECTOR
VERTEX_POINT
So a simple admonishment about mixing shells and surfaces doesn't seem to cut it.
User avatar
DamianHarty
Posts: 48
Joined: Tue Jul 07, 2020 3:50 pm

Apart from Part_CheckGeometry, What Else?

Post by DamianHarty »

If I pick one of the problem items I can ask to convert it to a solid, in case it isn't already. I get this message:

Code: Select all

15:04:50  ArmSample is ignored because it is already a solid.
So then I ask GMSH to mesh it "from shape" with min element size 1.0 and max element size 4.0:

Code: Select all

15:05:26  Fem::FemMeshObjectPython: Link(s) to object(s) 'Part__Feature' go out of the allowed scope 'FEMMeshGmsh009'. Instead, the linked object(s) reside within 'ArmSample'.
15:05:37    ElementDimension: 3
15:05:37    No Group meshing for analysis.
15:05:37    C:\Users\damia\AppData\Local\Temp\fcfem_ui9ap36g\Part__Feature_Geometry.brep
15:05:37    C:\Users\damia\AppData\Local\Temp\fcfem_ui9ap36g\Part__Feature_Mesh.unv
15:05:37    C:\Users\damia\AppData\Local\Temp\fcfem_ui9ap36g\shape2mesh.geo
15:05:37    C:/CL34-win64/bin/gmsh-2.7.0-Windows/gmsh.exe
15:05:37    New mesh was added to the mesh object.
15:05:37  Gmsh had warnings ...
15:05:37  Error   : Unknown number option 'General.NativeFileChooser'
Error   : Unknown number option 'Mesh.MeshSizeMin'
Error   : Unknown number option 'Mesh.MeshSizeMax'
Error   : Unknown number option 'General.NumThreads'
Error   : Unknown number option 'Mesh.MeshSizeFromCurvature'
Error   : Self intersecting surface mesh, computing intersections (this could take a while)
Error   : Could not open file 'intersect.pos'
Error   : ------------------------------
Error   : Mesh generation error summary
Error   :     0 warnings
Error   :     2 errors
Error   : Check the full log for details
Error   : ------------------------------
My previous messing around has taught me about the .geo file, so I retrieved it from the AppData folder to somewhere a bit more traceable and ran GMSH from the command line. It gives me a picture of a shell mesh and the following output:

Code: Select all

Info    : -------------------------------------------------------
Info    : Reading 'shape2mesh.geo'...
Error   : Unknown number option 'General.NumThreads'
Info    : Reading 'C:\Users\damia\AppData\Local\Temp\fcfem_ui9ap36g\Part__Feature_Geometry.brep'...
Info    : Done reading 'C:\Users\damia\AppData\Local\Temp\fcfem_ui9ap36g\Part__Feature_Geometry.brep'
Error   : Unknown number option 'Mesh.MeshSizeFromCurvature'
Info    : Finalized high order topology of periodic connections
Info    : Meshing 1D...
Info    : Meshing curve 1 (BSpline)
Info    : Meshing curve 2 (Line)
Info    : Meshing curve 3 (BSpline)
Info    : Meshing curve 4 (BSpline)
Info    : Meshing curve 5 (BSpline)
Info    : Meshing curve 6 (Line)
Info    : Meshing curve 7 (BSpline)
Info    : Meshing curve 8 (BSpline)
Info    : Meshing curve 9 (Line)
Info    : Meshing curve 10 (BSpline)
Info    : Meshing curve 11 (BSpline)
Info    : Meshing curve 12 (Line)
Info    : Meshing curve 13 (Line)
Info    : Meshing curve 14 (BSpline)
Info    : Meshing curve 15 (Line)
Info    : Meshing curve 16 (BSpline)
Info    : Meshing curve 17 (BSpline)
Info    : Meshing curve 18 (BSpline)
Info    : Meshing curve 19 (BSpline)
Info    : Meshing curve 20 (BSpline)
Info    : Meshing curve 21 (BSpline)
Info    : Meshing curve 22 (BSpline)
Info    : Done meshing 1D (0.328125 s)
Info    : Meshing 2D...
Info    : Meshing surface 1 (Cylinder, MeshAdapt)
Info    : Meshing surface 2 (Cylinder, MeshAdapt)
Info    : Meshing surface 3 (Cylinder, MeshAdapt)
Info    : Meshing surface 4 (Cylinder, MeshAdapt)
Info    : Meshing surface 5 (Cylinder, MeshAdapt)
Info    : Meshing surface 6 (Cylinder, MeshAdapt)
Info    : Meshing surface 7 (Cylinder, MeshAdapt)
Info    : Done meshing 2D (0.375 s)
Info    : Meshing 3D...
Info    : Delaunay Meshing 1 volumes with 1 connected components
Info    : Meshing volume 1 (Delaunay)
Error   : Self intersecting surface mesh, computing intersections (this could take a while)
Info    : 10 intersecting faces have been saved into 'intersect.pos'
Info    : Done meshing 3D (0.5625 s)
Info    : Meshing order 2 (curvilinear on)...
Info    : Meshing curve 1 order 2
Info    : Meshing curve 2 order 2
Info    : Meshing curve 3 order 2
Info    : Meshing curve 4 order 2
Info    : Meshing curve 5 order 2
Info    : Meshing curve 6 order 2
Info    : Meshing curve 7 order 2
Info    : Meshing curve 8 order 2
Info    : Meshing curve 9 order 2
Info    : Meshing curve 10 order 2
Info    : Meshing curve 11 order 2
Info    : Meshing curve 12 order 2
Info    : Meshing curve 13 order 2
Info    : Meshing curve 14 order 2
Info    : Meshing curve 15 order 2
Info    : Meshing curve 16 order 2
Info    : Meshing curve 17 order 2
Info    : Meshing curve 18 order 2
Info    : Meshing curve 19 order 2
Info    : Meshing curve 20 order 2
Info    : Meshing curve 21 order 2
Info    : Meshing curve 22 order 2
Info    : Meshing surface 1 order 2
Info    : Meshing surface 2 order 2
Info    : Meshing surface 3 order 2
Info    : Meshing surface 4 order 2
Info    : Meshing surface 5 order 2
Info    : Meshing surface 6 order 2
Info    : Meshing surface 7 order 2
Info    : Meshing volume 1 order 2
Info    : Finalized high order topology of periodic connections
Info    : Surface mesh: worst distortion = 0.745815 (0 elements in ]0, 0.2]); worst gamma = 0.0122395
Info    : Done meshing order 2 (0.078125 s)
Info    : 11368 vertices 6010 elements
Error   : ------------------------------
Error   : Mesh generation error summary
Error   :     0 warnings
Error   :     1 error
Error   : Check the full log for details
Error   : ------------------------------
Info    : Removing duplicate mesh vertices...
Info    : Found 0 duplicate vertices
Info    : No duplicate vertices found
Info    : Writing 'C:\Users\damia\AppData\Local\Temp\fcfem_ui9ap36g\Part__Feature_Mesh.unv'...
Info    : Done writing 'C:\Users\damia\AppData\Local\Temp\fcfem_ui9ap36g\Part__Feature_Mesh.unv'
Info    : Done reading 'shape2mesh.geo'
I note again the invitation to "check the full log for details", but am none the wiser. So I thought I'd go to one of the tubes that *does* mesh and compare the output from GMSH:

Code: Select all

Info    : -------------------------------------------------------
Info    : Reading 'shape2mesh.geo'...
Error   : Unknown number option 'General.NumThreads'
Info    : Reading 'C:\Users\damia\AppData\Local\Temp\fcfem_iabitafz\Part__Feature002_Geometry.brep'...
Info    : Done reading 'C:\Users\damia\AppData\Local\Temp\fcfem_iabitafz\Part__Feature002_Geometry.brep'
Error   : Unknown number option 'Mesh.MeshSizeFromCurvature'
Info    : Finalized high order topology of periodic connections
Info    : Meshing 1D...
Info    : Meshing curve 1 (Line)
Info    : Meshing curve 2 (BSpline)
Info    : Meshing curve 3 (Line)
Info    : Meshing curve 4 (BSpline)
Info    : Meshing curve 5 (BSpline)
Info    : Meshing curve 6 (Line)
Info    : Meshing curve 7 (BSpline)
Info    : Meshing curve 8 (Line)
Info    : Meshing curve 9 (BSpline)
Info    : Meshing curve 10 (BSpline)
Info    : Meshing curve 11 (BSpline)
Info    : Meshing curve 12 (BSpline)
Info    : Done meshing 1D (0.140625 s)
Info    : Meshing 2D...
Info    : Meshing surface 1 (Cylinder, MeshAdapt)
Info    : Meshing surface 2 (Cylinder, MeshAdapt)
Info    : Meshing surface 3 (Cylinder, MeshAdapt)
Info    : Meshing surface 4 (Cylinder, MeshAdapt)
Info    : Meshing surface 5 (Cylinder, MeshAdapt)
Info    : Meshing surface 6 (Plane, Delaunay)
Info    : Done meshing 2D (1.10938 s)
Info    : Meshing 3D...
Info    : Delaunay Meshing 1 volumes with 1 connected components
Info    : Meshing volume 1 (Delaunay)
Info    : 6175 points 31350 edges and 12350 faces in the initial mesh
Info    : Found region 1
Info    : 0 points created - Worst tet radius is 0.759992 (PTS removed 0 0)
Info    : 3D point insertion terminated (6175 points created):
Info    :  - 0 Delaunay cavities modified for star shapeness
Info    :  - 0 points could not be inserted
Info    :  - 19000 tetrahedra created in 0 sec. (-2147483648 tets/sec.)
Info    : Done meshing 3D (0.578125 s)
Info    : Optimizing 3D mesh...
Info    : Optimizing volume 1
Info    : Opti : STARTS with  1.12319E+05 QBAD  1.45038E-02 QAVG  7.13465E-01
Info    : Opti : 0.00 < QUAL < 0.10 :        74 elements
Info    : Opti : 0.10 < QUAL < 0.20 :       144 elements
Info    : Opti : 0.20 < QUAL < 0.30 :       170 elements
Info    : Opti : 0.30 < QUAL < 0.40 :       373 elements
Info    : Opti : 0.40 < QUAL < 0.50 :       624 elements
Info    : Opti : 0.50 < QUAL < 0.60 :      1255 elements
Info    : Opti : 0.60 < QUAL < 0.70 :      4291 elements
Info    : Opti : 0.70 < QUAL < 0.80 :      6755 elements
Info    : Opti : 0.80 < QUAL < 0.90 :      4911 elements
Info    : Opti : 0.90 < QUAL < 1.00 :       403 elements
Info    : Opti : (386,0,0) =  1.12319E+05 QBAD  1.23838E-01 QAVG  7.25504E-01 (   0.000 sec)
Info    : Opti : (395,0,0) =  1.12319E+05 QBAD  2.01075E-01 QAVG  7.25696E-01 (   0.000 sec)
Info    : Opti : no ill-shaped tets in the mesh ;-)
Info    : Opti : 0.00 < QUAL < 0.10 :         0 elements
Info    : Opti : 0.10 < QUAL < 0.20 :         0 elements
Info    : Opti : 0.20 < QUAL < 0.30 :         5 elements
Info    : Opti : 0.30 < QUAL < 0.40 :       378 elements
Info    : Opti : 0.40 < QUAL < 0.50 :       537 elements
Info    : Opti : 0.50 < QUAL < 0.60 :      1218 elements
Info    : Opti : 0.60 < QUAL < 0.70 :      4326 elements
Info    : Opti : 0.70 < QUAL < 0.80 :      6917 elements
Info    : Opti : 0.80 < QUAL < 0.90 :      4854 elements
Info    : Opti : 0.90 < QUAL < 1.00 :       402 elements
Info    : Done optimizing 3D mesh (0.015625 s)
Info    : Meshing order 2 (curvilinear on)...
Info    : Meshing curve 1 order 2
Info    : Meshing curve 2 order 2
Info    : Meshing curve 3 order 2
Info    : Meshing curve 4 order 2
Info    : Meshing curve 5 order 2
Info    : Meshing curve 6 order 2
Info    : Meshing curve 7 order 2
Info    : Meshing curve 8 order 2
Info    : Meshing curve 9 order 2
Info    : Meshing curve 10 order 2
Info    : Meshing curve 11 order 2
Info    : Meshing curve 12 order 2
Info    : Meshing surface 1 order 2
Info    : Meshing surface 2 order 2
Info    : Meshing surface 3 order 2
Info    : Meshing surface 4 order 2
Info    : Meshing surface 5 order 2
Info    : Meshing surface 6 order 2
Info    : Meshing volume 1 order 2
Info    : Finalized high order topology of periodic connections
Info    : Surface mesh: worst distortion = 0.818858 (0 elements in ]0, 0.2]); worst gamma = 0.468496
Info    : Volume Mesh: worst distortion = 0.598852 (0 elements in ]0, 0.2])
Info    : Done meshing order 2 (0.21875 s)
Info    : 37162 vertices 31499 elements
Info    : Removing duplicate mesh vertices...
Info    : Found 0 duplicate vertices
Info    : No duplicate vertices found
Info    : Writing 'C:\Users\damia\AppData\Local\Temp\fcfem_iabitafz\Part__Feature002_Mesh.unv'...
Info    : Done writing 'C:\Users\damia\AppData\Local\Temp\fcfem_iabitafz\Part__Feature002_Mesh.unv'
Info    : Done reading 'shape2mesh.geo'
So it seems the key line is:

Code: Select all

Error   : Self intersecting surface mesh, computing intersections
Now, the real question is "what checks (other than the Part_CheckGeometry I've already run and found inconclusive) do I need to run to get ahead of this?"
User avatar
DamianHarty
Posts: 48
Joined: Tue Jul 07, 2020 3:50 pm

Re: FE Meshing a Fabrication Direct From CAD

Post by DamianHarty »

OK, so when I get down to it, it becomes somewhat obvious:

Image
Or here if the link is broken.

When two tubes of the same size are coped together, a sliver is the outcome, mathematically.

So *that's* the sort of thing I need to be looking for.
Last edited by DamianHarty on Fri Mar 10, 2023 10:37 am, edited 1 time in total.
User avatar
-alex-
Veteran
Posts: 1861
Joined: Wed Feb 13, 2019 9:42 pm
Location: France

Re: Apart from Part_CheckGeometry, What Else?

Post by -alex- »

DamianHarty wrote: Thu Mar 09, 2023 3:46 pm Now, the real question is "what checks (other than the Part_CheckGeometry I've already run and found inconclusive) do I need to run to get ahead of this?"
Inconclusive? Come on... :roll:
Part_CheckGeometry show 9 shells and 9 solids, and a lot of auto-intersections:
Part_Check_Geom_0WA - Custom LCA.png
Part_Check_Geom_0WA - Custom LCA.png (121.77 KiB) Viewed 722 times

Your model is not ready to mesh as is, far from it.
You have to clean your model first (remove small details, split eges, avoid tangencies with null thickness, remove small gaps, small holes, fuse solids, get a single shell, etc...) then mesh it.

Code: Select all

OS: Debian GNU/Linux 10 (buster) (LXDE/LXDE-pi)
Word size of FreeCAD: 64-bit
Version: 0.20.31627 (Git)
Build type: Unknown
Branch: LinkDaily
Hash: 628ab90134e80886cb9bf8d6a6b6b07311514f10
Python version: 3.7.3
Qt version: 5.11.3
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: French/France (fr_FR)
User avatar
DamianHarty
Posts: 48
Joined: Tue Jul 07, 2020 3:50 pm

Re: Apart from Part_CheckGeometry, What Else?

Post by DamianHarty »

-alex- wrote: Thu Mar 09, 2023 6:17 pm
DamianHarty wrote: Thu Mar 09, 2023 3:46 pm Now, the real question is "what checks (other than the Part_CheckGeometry I've already run and found inconclusive) do I need to run to get ahead of this?"
Inconclusive? Come on... :roll:
The results from your check are very different to the results that I got.

Can you be more explicit on how you are running the check? Because I am seeing this:

Image
Or this if the link is broken.

If you look at the picture, I think my confusion is reasonable.

Of course the geometry isn't ready to mesh! I am trying to get the mesher to guide me about what it objects to. But it seems there is more than one geometry check that can be run, so let's start with that before getting too excited about everything else?
Last edited by DamianHarty on Fri Mar 10, 2023 10:41 am, edited 1 time in total.
User avatar
NewJoker
Veteran
Posts: 3084
Joined: Sun Oct 11, 2020 7:49 pm

Re: Apart from Part_CheckGeometry, What Else?

Post by NewJoker »

DamianHarty wrote: Thu Mar 09, 2023 6:33 pm I am trying to get the mesher to guide me about what it objects to.
Btw. simplification is not just a matter of what can be meshed but there are also good practices recommended in most cases. The geometry should be clean, with no issues (even if it's meshed somehow, there may still be some serious issues with it in such cases) and all unnecessary (especially small) details should be removed.
Post Reply