# Structural Mechanics in 3D

Compute the deformation of a clamped crankshaft due to a load exerted by pistons.

Specify a Graphics3D.

 In[2]:= XNeeds["NDSolve`FEM`"] mesh = ToElementMesh[DiscretizeGraphics[gr], "MeshOrder" -> 1]
 Out[2]=

Specify the 3D stress formulation.

 In[3]:= XstressOperator[ Y_, \[Nu]_] := {Inactive[ Div][({{0, 0, -((Y \[Nu])/((1 - 2 \[Nu]) (1 + \[Nu])))}, {0, 0, 0}, {-(Y/(2 (1 + \[Nu]))), 0, 0}}.Inactive[Grad][ w[x, y, z], {x, y, z}]), {x, y, z}] + Inactive[ Div][({{0, -((Y \[Nu])/((1 - 2 \[Nu]) (1 + \[Nu]))), 0}, {-(Y/(2 (1 + \[Nu]))), 0, 0}, {0, 0, 0}}.Inactive[Grad][ v[x, y, z], {x, y, z}]), {x, y, z}] + Inactive[ Div][({{-((Y (1 - \[Nu]))/((1 - 2 \[Nu]) (1 + \[Nu]))), 0, 0}, {0, -(Y/(2 (1 + \[Nu]))), 0}, {0, 0, -(Y/(2 (1 + \[Nu])))}}.Inactive[Grad][ u[x, y, z], {x, y, z}]), {x, y, z}], Inactive[Div][({{0, 0, 0}, {0, 0, -((Y \[Nu])/((1 - 2 \[Nu]) (1 + \[Nu])))}, {0, -(Y/( 2 (1 + \[Nu]))), 0}}.Inactive[Grad][ w[x, y, z], {x, y, z}]), {x, y, z}] + Inactive[ Div][({{0, -(Y/(2 (1 + \[Nu]))), 0}, {-((Y \[Nu])/((1 - 2 \[Nu]) (1 + \[Nu]))), 0, 0}, {0, 0, 0}}.Inactive[Grad][u[x, y, z], {x, y, z}]), {x, y, z}] + Inactive[ Div][({{-(Y/(2 (1 + \[Nu]))), 0, 0}, {0, -((Y (1 - \[Nu]))/((1 - 2 \[Nu]) (1 + \[Nu]))), 0}, {0, 0, -(Y/(2 (1 + \[Nu])))}}.Inactive[Grad][ v[x, y, z], {x, y, z}]), {x, y, z}], Inactive[Div][({{0, 0, 0}, {0, 0, -(Y/(2 (1 + \[Nu])))}, {0, -(( Y \[Nu])/((1 - 2 \[Nu]) (1 + \[Nu]))), 0}}.Inactive[Grad][ v[x, y, z], {x, y, z}]), {x, y, z}] + Inactive[ Div][({{0, 0, -(Y/(2 (1 + \[Nu])))}, {0, 0, 0}, {-((Y \[Nu])/((1 - 2 \[Nu]) (1 + \[Nu]))), 0, 0}}.Inactive[Grad][u[x, y, z], {x, y, z}]), {x, y, z}] + Inactive[ Div][({{-(Y/(2 (1 + \[Nu]))), 0, 0}, {0, -(Y/(2 (1 + \[Nu]))), 0}, {0, 0, -(( Y (1 - \[Nu]))/((1 - 2 \[Nu]) (1 + \[Nu])))}}.Inactive[Grad][ w[x, y, z], {x, y, z}]), {x, y, z}]}

Specify constraints such that the boundary of the crankshaft is held fixed at these positions.

 In[4]:= XSubscript[\[CapitalGamma], D] = {DirichletCondition[{u[x, y, z] == 0., v[x, y, z] == 0., w[x, y, z] == 0.}, {y <= 0.1, y >= 890}]};

Specify a boundary load pushing in the negative axes.

 In[5]:= XSubscript[\[CapitalGamma], L] = NeumannValue[-10000., ((217 <= y <= 256) && (40 <= z <= 103)) || ((584 <= y <= 622) && (40 <= z <= 103))];

Solve the coupled equations.

 In[6]:= X{uif, vif, wif} = NDSolveValue[{stressOperator[10^9, 33/100] == {0, 0, Subscript[\[CapitalGamma], L]}, Subscript[\[CapitalGamma], D]}, {u, v, w}, {x, y, z} \[Element] mesh];

Visualize the original crankshaft and the deformed crankshaft in red using the finite element package.

 Out[7]=

## Mathematica + Mathematica Online

Questions? Comments? Contact a Wolfram expert »