This example shows how to analyze a 3-D mechanical part under an applied load using finite element analysis (FEA) and determine the maximal deflection.
The first step in solving a linear elasticity problem is to create a structural analysis model. This is a container that holds the geometry, structural material properties, body and boundary loads, boundary constraints, and mesh.
model = createpde('structural','static-solid');
Import an STL file of a simple bracket model using the
importGeometry function. This function reconstructs the faces, edges and vertices of the model. It can merge some faces and edges, so the numbers can differ from those of the parent CAD model.
Plot the geometry and turn on face labels. You will need the face labels to define the boundary conditions.
figure pdegplot(model,'FaceLabels','on') view(30,30); title('Bracket with Face Labels')
figure pdegplot(model,'FaceLabels','on') view(-134,-32) title('Bracket with Face Labels, Rear View')
Specify Young's modulus and Poisson's ratio for this material.
structuralProperties(model,'Cell',1,'YoungsModulus',200e9, ... 'PoissonsRatio',0.3);
The problem has two boundary conditions: the back face (face 4) is immobile and the front face has an applied load. All other boundary conditions, by default, are free boundaries.
Apply a distributed load in the negative -direction to the front face (face 8).
distributedLoad = 1e4; % Applied load in Pascals structuralBoundaryLoad (model,'Face',8,'SurfaceTraction',[0;0;-distributedLoad]);
Create a mesh that uses 10-node tetrahedral elements with quadratic interpolation functions. This element type is significantly more accurate than the linear interpolation (four-node) elements, particularly in elasticity analyses that involve bending.
bracketThickness = 1e-2; % Thickness of horizontal plate with hole, meters generateMesh(model,'Hmax',bracketThickness); figure pdeplot3D(model) title('Mesh with Quadratic Tetrahedral Elements');
solve to calculate the solution.
result = solve(model);
Find the maximal deflection of the bracket in the direction.
minUz = min(result.Displacement.uz); fprintf('Maximal deflection in the z-direction is %g meters.', minUz)
Maximal deflection in the z-direction is -4.48952e-05 meters.
To see the solution, plot the components of the solution vector. The maximal deflections are in the -direction. Because the part and the loading are symmetric, the -displacement and -displacement are symmetric, and the -displacement is antisymmetric with respect to the center line.
Here, the plotting routine uses the
'jet' colormap, which has blue as the color representing the lowest value and red representing the highest value. The bracket loading causes face 8 to dip down, so the maximum -displacement appears blue.
figure pdeplot3D(model,'ColorMapData',result.Displacement.ux) title('x-displacement') colormap('jet')
figure pdeplot3D(model,'ColorMapData',result.Displacement.uy) title('y-displacement') colormap('jet')
figure pdeplot3D(model,'ColorMapData',result.Displacement.uz) title('z-displacement') colormap('jet')
Plot values of the von Mises Stress at nodal locations. Use the same
figure pdeplot3D(model,'ColorMapData',result.VonMisesStress) title('von Mises stress') colormap('jet')