When you design a part (for 3d printing or other), it is a good thing to assess your design for performance. A critical technique to test a part against stress is finite element analysis. In this post I will go through the design and test of a 3d printed composite part that has to substitute a metal pin

## The Problem…

The problem starts with a broken pin

This pin was broken during a removal attempt, and my task is to understand if it can be substituted by a PLA printed pin with a core made of a 2mm harmonic steel wire. The pin is used to stop the rotation of an element, and it has to withstand a force of 140 kg applied on its side for a couple of seconds during the cycle of the machine it is part of.

## …and how to solve it!

First thing to do is to model the part we want to print: we want to build a revolution solid, so we start defining the profile of the pin:

and obtain it as a revolution solid:

We will also design a profile for the core and a surface were we will apply the force that the part needs to survive to:

This is peculiar to FreeCAD: you cannot select a portion of a surface to apply a force, so you need to create a small surface (by extrusion) where to place your force vector. We wrap all the parts we have as a “boolean fragment solid”:

We need to specify that our boolean fragment will be a single solid:

And then the solid is wrapped in a compound filter:

The aim of these operation is to tell FreeCAD that all the bodies we created are parts of a single physical object: it is possible to check that there are no double surfaces or unconnected parts looking into the “content” tab. If things are good you will end with one solid, no compounds (you have filtered them!) and the exact number of faces you expect:

Last, you need to draw a segment to tell FreeCAD the direction of the force we want to apply to our part:

## Step 2: A crash introduction to Finite Element Method (FEM)

Finite element analysis is basically a technique to numerically solve partial differential equation. Its mathematical foundation is the Green identity:

Now suppose that the function is a linear combination of functions in a base and that any function has nonzero value only in a small region , and that . Then:

That’s all the finite elements magic: if we define a basis for the test functions then solving the equation in the domain with the boundary condition is (numerically) equivalent to solve the linear problem:

for any . We have gained one order of differentiation (the right term is a product of gradients) and the terms under integrals can be stored in a matrix. The problem generalizes to any elliptical differential equation, and usually U is partitioned in fancy geometrical tessellation, called mesh. Many more things could be said (look at this Wikipedia page, or, if you want to get serious on FEMs, look into this book).

## Step 3: FEM in practice

FreeCAD uses CalculiX engine to deal with the math part of finite elements for us. First we need to create the mesh:

And assign constraints and forces:

(mind that we need to put the force we want to act on the face in Newton) and then assign different material (steel and PLA) to different parts ot the compound filter.

Since PLA is not a material in FreeCAD we can use the material editor to setup the properties we need:

We are now ready to launch the analysis:

And look to what happens to our piece:

## Step 4: results!

Back to our problem: will our piece withstand the applied force? In order to answer that we need to look into it. This is best done with ParaView, another free software you can find here. Paraview is a wonderful tool: first we export the finite elements analysis result as a .vtk file from FreeCAD, open it in ParaView:

In Paraview we can slice the design in order to see internal stresses:

(it is possible to do the same whithin FreeCAD, but I prefer Paraview to do that). We can slicealso along specific path:

Comparing these results with the stress that the chosen materials can tolerate, we can answer if the part can withstand the stress it will face or not (by a static point of view, fatigue strength is another story, possibly for another post).