Contents
Validation
Examples

Validation / 7 of 10

Hollow shaft under torsion

Torsion of a circular tube is the shaft problem from every mechanics-of-materials course. Unlike the square bar, a circular section does not warp, so the 1-D theory is exact for the 3-D body away from the loaded end. That makes the case a clean test of how well a mesh represents a curved boundary.

Hollow shaft under torsion: displacement magnitude |u| on the deformed shape, displacements drawn 500 times enlarged
0.00 mm0.0734 mm
Displacement magnitude |U|, deformed shape, displacements drawn 500 times enlarged. Drawn from the analysis file that Open in KoFEM loads.
Angle of twist θ; reference θ = T·L / (G·J)
Reference KoFEM Difference
1.4489 × 10−3 rad 1.4683 × 10−3 rad +1.34 %
within ±5 %

Open in KoFEMOpens the solved model in the app.

The problem

𝑧 𝑇 𝐿 𝑟i 𝑟o section mesh, 32 segments
Tube of length L along z, radii rᵢ and rₒ; J = π·(rₒ⁴ − rᵢ⁴)/2. Sketch, not to scale; thin lines show the element mesh.
L500 mm
ri30 mm
ro50 mm
E210 GPa
ν0.3
T2 kN·m
Supportsz = 0 end fixed (Ux, Uy, Uz).
LoadTorque T about z as a moment on the z = L end.
MeasuredMean rotation of the z = L end about the axis.

Analytical solution

By symmetry, each section of a circular shaft stays plane and turns as a rigid disc. If the angle of twist grows at the rate θ′ along the axis, the material at radius r is sheared by

γ=rθ′,τ=Gγ=Grθ′.

The shear stress grows linearly from the inner to the outer surface. Its moment about the axis balances the applied torque,

T=∫AτrdA=Gθ′∫Ar2dA=GJθ′,

with the polar moment of the annulus

J=π2(ro4−ri4).

Over the length L the free end turns by

θ=TLGJ.

Here J=8.5451×106 mm4, G=80.769 GPa and θ=1.4489×10−3 rad. The largest shear stress, at the outer surface, is τmax=Tro/J=11.703 MPa.

Finite element model

Mesh3 × 32 × 12 grid (radial × around × axial): 1,152 linear 8-node hexahedra (P1)
Unknowns1,664 nodes, 4,992 degrees of freedom
MaterialLinear elastic, isotropic
SolverKoFEM engine (MFEM), the WebAssembly build the app runs: engine-5ceb743373dd

The tube is meshed with 3 elements through the wall, 32 around and 12 along the axis. The nodes lie on the true circles, but the element edges between them are straight. The torque is applied as tangential nodal forces on the end ring, proportional to the radius r (the τ∝r distribution of the exact solution) and scaled so the moment is T, which is how the app applies a moment to a face. The twist is the mean rotation of the end-ring nodes.

Results

Quantityangle of twist θ
Referenceθ = T·L / (G·J) = 1.4489 × 10−3 rad (Gere & Goodno, Mechanics of Materials)
KoFEM1.4683 × 10−3 rad
Difference+1.34 % within ±5 %

Mesh convergence: Hollow shaft

P1 (linear)below the referenceabove
|difference| % 100 1k 10k 100k 0.1 1 10 100 tolerance ±5 % P1 (linear), 1 × 8 × 3: 192 DOFs, difference +23.08 %P1 (linear), 2 × 16 × 6: 1,008 DOFs, difference +5.31 %P1 (linear), 3 × 32 × 12: 4,992 DOFs, difference +1.34 % (the example's mesh)P1 (linear), 4 × 64 × 24: 24,000 DOFs, difference +0.39 % degrees of freedom
Difference from the reference on refined meshes, logarithmic axes. The ringed point is this example's mesh.

The error falls steadily as the straight-sided elements approach the circle.

Data
Order Mesh DOFs KoFEM Difference
P1 (linear) 1 × 8 × 3 192 1.7832 × 10−3 rad +23.08 %
P1 (linear) 2 × 16 × 6 1,008 1.5259 × 10−3 rad +5.31 %
P1 (linear) 3 × 32 × 12 (this example) 4,992 1.4683 × 10−3 rad +1.34 %
P1 (linear) 4 × 64 × 24 24,000 1.4546 × 10−3 rad +0.39 %

Discussion

KoFEM's twist differs from the reference by +1.34 %, and almost all of it is geometry. With straight element edges, the section of the mesh is the ring between two regular polygons inscribed in the true circles. Its polar moment is smaller than J, so it twists more. The polar moment of a regular n-gon inscribed in a circle of radius r is

Jn=nr412sin2πn(2+cos2πn),

which tends to πr4/2 as n grows. The twist the polygon alone predicts, J/Jn−1, matches KoFEM's error on every mesh of the convergence study:

Segments Polygon alone KoFEM
8 +23.09 % +23.08 %
16 +5.29 % +5.31 %
32 +1.29 % +1.34 %
64 +0.32 % +0.39 %

What the elements add on top is under a tenth of a percent. The geometric error falls with the square of the segment angle, which is the factor of four per refinement in the convergence plot. More segments, or curved higher-order elements, remove it. The same holds for any curved surface in a model: the mesh replaces it with facets, and stiffness follows the facets.

Reproduce

In the app: open the model, then Studies → Static 1 → Run static solve, select the result plot and set Field to Displacement (magnitude). The Result summary shows Max |U| 7.343e-2 mm.

From a clone (Node.js 20+, bash, curl), this solves the model with the same engine and prints its line:

git clone https://github.com/mkofler96/KoFEM.git && cd KoFEM
bash scripts/fetch-wasm-engine.sh
node examples/validation/run.mjs --case shaft-torsion
Case                                  Quantity                                  FE   Reference     Err%  Tol%  Status
Hollow shaft under torsion            angle of twist θ                   1.4683e-3   1.4489e-3    +1.34     5  PASS

References

  1. J. M. Gere and B. J. Goodno, Mechanics of Materials, Cengage Learning: axially loaded members, torsion, deflections of beams.
  2. S. P. Timoshenko and J. N. Goodier, Theory of Elasticity, 3rd ed., McGraw-Hill, 1970.

KoFEM is research software and is not certified for safety-critical design. It solves linear-static, linear-elastic problems. Check results that matter against your own references.