# Elastic Media in Spherical Coordinates

When an elastic medium is at equilibrium, the force at each point balances the divergence of the rank-2 stress tensor. The stress tensor, in turn, is the contraction of the symmetric rank-4 stiffness tensor and the rank-2 strain tensor. The strain tensor is the symmetrized gradient of the displacement field. All these fields can be represented and manipulated as symmetrized arrays, in any coordinate system known to Mathematica.

#### Define the stress tensor with built-in symmetry and compute its divergence in spherical coordinates.

 In:= X\[Sigma][r_, \[Theta]_, \[CurlyPhi]_] = SymmetrizedArray[{{1, 1} -> \[Sigma]rr[ r, \[Theta], \[CurlyPhi]], {1, 2} -> \[Sigma]r\[Theta][ r, \[Theta], \[CurlyPhi]], {1, 3} -> \[Sigma]r\[CurlyPhi][ r, \[Theta], \[CurlyPhi]], {2, 2} -> \[Sigma]\[Theta]\[Theta][ r, \[Theta], \[CurlyPhi]], {2, 3} -> \[Sigma]\[Theta]\[CurlyPhi][r, \[Theta], \[CurlyPhi]], {3, 3} -> \[Sigma]\[CurlyPhi]\[CurlyPhi][ r, \[Theta], \[CurlyPhi]]}, {3, 3}, Symmetric[All]];
 In:= Xdiv = Div[\[Sigma][ r, \[Theta], \[CurlyPhi]], {r, \[Theta], \[CurlyPhi]}, "Spherical"] // Simplify // Normal
 Out= #### Compute the strain in spherical coordinates from its definition.

 In:= Xu[r_, \[Theta]_, \[CurlyPhi]_] := {ur[r, \[Theta], \[CurlyPhi]], u\[Theta][r, \[Theta], \[CurlyPhi]], u\[CurlyPhi][r, \[Theta], \[CurlyPhi]]}
 In:= Xstrain = Symmetrize[ Grad[u[r, \[Theta], \[CurlyPhi]], {r, \[Theta], \[CurlyPhi]}, "Spherical"]] // Simplify; strain // SymmetrizedArrayRules // Most
 Out= #### Contract the strain tensor with the stiffness tensor to obtain the stress tensor. Mathematica can verify the symmetry of the result.

 In:= Xstrain = Symmetrize[ Grad[u[r, \[Theta], \[CurlyPhi]], {r, \[Theta], \[CurlyPhi]}, "Spherical"]] // Simplify; strain // SymmetrizedArrayRules // Most; stiff = SymmetrizedArray[pos_ :> c @@ pos, {3, 3, 3, 3}, Symmetric[All]] TensorContract[stiff\[TensorProduct]strain, {{3, 5}, {4, 6}}] % // TensorSymmetry
 Out= Out= Out= 