Section 9.1 of Chapter 9: 2D Stress Analysis: Finite Element Types, Linear Case

CST Finite Element

A complete constant-strain triangular finite element formulation for linear plane-stress analysis, followed by a reproducible MATLAB cantilever example and comparison model for ANSYS.

Plane stressCST elementLinear analysisMATLABANSYS

01

CST element and hypotheses

The constant-strain triangle (CST) is a three-node finite element with two translational degrees of freedom at each node. The standard formulation introduced here follows the finite element treatment presented by Felippa [1].

StrainSmall
DisplacementSmall
MaterialLinear elastic
Stress statePlane stress
Element definition

Three nodes; two translational degrees of freedom per node: uiu_i and viv_i.

Three-node CST element showing nodal displacements, nodal forces, and global coordinates
Figure 1. Three-node CST element: nodal displacements and the corresponding nodal force components.
fel=kelueluel={u1v1u2v2u3v3}Tfel={X1Y1X2Y2X3Y3}T \boldsymbol{f}_{el}=\boldsymbol{k}_{el}\boldsymbol{u}_{el} \qquad \boldsymbol{u}_{el}= \begin{Bmatrix}u_1&v_1&u_2&v_2&u_3&v_3\end{Bmatrix}^{T} \qquad \boldsymbol{f}_{el}= \begin{Bmatrix}X_1&Y_1&X_2&Y_2&X_3&Y_3\end{Bmatrix}^{T}

02

Interpolation functions

The displacement field inside the element is interpolated from the six nodal displacement components:

{u(x,y)v(x,y)}=Nuel \begin{Bmatrix}u(x,y)\\v(x,y)\end{Bmatrix} =\boldsymbol{N}\boldsymbol{u}_{el}
N=[NuNv]=[N1(x,y)0N2(x,y)0N3(x,y)00N1(x,y)0N2(x,y)0N3(x,y)] \boldsymbol{N}= \begin{bmatrix}\boldsymbol{N}_u\\\boldsymbol{N}_v\end{bmatrix} = \begin{bmatrix} N_1(x,y)&0&N_2(x,y)&0&N_3(x,y)&0\\ 0&N_1(x,y)&0&N_2(x,y)&0&N_3(x,y) \end{bmatrix}
N1(x,y)=12Ael[(y2y3)x(x2x3)y+x2y3x3y2] N_1(x,y)=\frac{1}{2A_{el}} \left[(y_2-y_3)x-(x_2-x_3)y+x_2y_3-x_3y_2\right]
N2(x,y)=12Ael[(y3y1)x(x3x1)y+x3y1x1y3] N_2(x,y)=\frac{1}{2A_{el}} \left[(y_3-y_1)x-(x_3-x_1)y+x_3y_1-x_1y_3\right]
N3(x,y)=12Ael[(y1y2)x(x1x2)y+x1y2x2y1] N_3(x,y)=\frac{1}{2A_{el}} \left[(y_1-y_2)x-(x_1-x_2)y+x_1y_2-x_2y_1\right]

03

Strain-displacement matrix

Differentiation of the interpolation functions gives the constant strain-displacement matrix:

B=[x00yyx][NuNv] \boldsymbol{B}= \begin{bmatrix} \dfrac{\partial}{\partial x}&0\\[4pt] 0&\dfrac{\partial}{\partial y}\\[4pt] \dfrac{\partial}{\partial y}&\dfrac{\partial}{\partial x} \end{bmatrix} \begin{bmatrix}\boldsymbol{N}_u\\\boldsymbol{N}_v\end{bmatrix}
B=12Ael[y2y30y3y10y1y200x3x20x1x30x2x1x3x2y2y3x1x3y3y1x2x1y1y2] \boldsymbol{B}=\frac{1}{2A_{el}} \begin{bmatrix} y_2-y_3&0&y_3-y_1&0&y_1-y_2&0\\ 0&x_3-x_2&0&x_1-x_3&0&x_2-x_1\\ x_3-x_2&y_2-y_3&x_1-x_3&y_3-y_1&x_2-x_1&y_1-y_2 \end{bmatrix}

The signed element area used in these expressions is:

Ael=12[(x2x1)(y3y1)(x3x1)(y2y1)] A_{el}=\frac{1}{2}\left[(x_2-x_1)(y_3-y_1)-(x_3-x_1)(y_2-y_1)\right]

04

Strains, stresses, and constitutive law

For plane stress, the strain and stress vectors and Hooke's law are:

σ=Dεσ={σxσyτxy}ε={εxεyγxy}=Buel \boldsymbol{\sigma}=\boldsymbol{D}\boldsymbol{\varepsilon} \qquad \boldsymbol{\sigma}=\begin{Bmatrix}\sigma_x\\\sigma_y\\\tau_{xy}\end{Bmatrix} \qquad \boldsymbol{\varepsilon}=\begin{Bmatrix}\varepsilon_x\\\varepsilon_y\\\gamma_{xy}\end{Bmatrix} =\boldsymbol{B}\boldsymbol{u}_{el}
D=E1ν2[1ν0ν10001ν2] \boldsymbol{D}=\frac{E}{1-\nu^2} \begin{bmatrix} 1&\nu&0\\ \nu&1&0\\ 0&0&\dfrac{1-\nu}{2} \end{bmatrix}

Here EE is Young's modulus and ν\nu is Poisson's ratio.

05

Potential energy and virtual work

For an assemblage of finite elements, the total potential energy may be written in either of the equivalent forms. Here u\boldsymbol{u} is the global vector containing all nodal displacement degrees of freedom of the finite element discretization.

Π=12elVelεTσdVuTF \Pi=\frac{1}{2}\sum_{el}\int_{V_{el}}\boldsymbol{\varepsilon}^{T}\boldsymbol{\sigma}\,dV -\boldsymbol{u}^{T}\boldsymbol{F}
Π=12elVelεTDεdVuTF \Pi=\frac{1}{2}\sum_{el}\int_{V_{el}}\boldsymbol{\varepsilon}^{T}\boldsymbol{D}\boldsymbol{\varepsilon}\,dV -\boldsymbol{u}^{T}\boldsymbol{F}

The virtual-work statement is:

δΠ=elVelδεTDεdVδuTF=0 \delta\Pi=\sum_{el}\int_{V_{el}}\delta\boldsymbol{\varepsilon}^{T}\boldsymbol{D}\boldsymbol{\varepsilon}\,dV -\delta\boldsymbol{u}^{T}\boldsymbol{F}=0

Using ε=Buel\boldsymbol{\varepsilon}=\boldsymbol{B}\boldsymbol{u}_{el}, this becomes:

δΠ=elδuelT(VelBTDBdV)uelδuTF=0 \delta\Pi=\sum_{el}\delta\boldsymbol{u}_{el}^{T} \left(\int_{V_{el}}\boldsymbol{B}^{T}\boldsymbol{D}\boldsymbol{B}\,dV\right) \boldsymbol{u}_{el}-\delta\boldsymbol{u}^{T}\boldsymbol{F}=0

for every geometrically admissible virtual displacement δu\delta\boldsymbol{u}.

06

Element and assembled stiffness matrices

The virtual-work equation leads to the assembled linear system through the usual element assembly process:

el(VelBTDBdV)uel=Fel(keluel)=FA ⁣(kel)u=FKu=F \sum_{el}\left(\int_{V_{el}}\boldsymbol{B}^{T}\boldsymbol{D}\boldsymbol{B}\,dV\right) \boldsymbol{u}_{el}=\boldsymbol{F} \quad\longrightarrow\quad \sum_{el}\left(\boldsymbol{k}_{el}\boldsymbol{u}_{el}\right)=\boldsymbol{F} \quad\longrightarrow\quad \mathcal{A}\!\left(\boldsymbol{k}_{el}\right)\boldsymbol{u}=\boldsymbol{F} \quad\longrightarrow\quad \boldsymbol{K}\boldsymbol{u}=\boldsymbol{F}

A\mathcal{A} denotes the standard finite element assembly operator, so that

K=A ⁣(kel) \boldsymbol{K}=\mathcal{A}\!\left(\boldsymbol{k}_{el}\right)

Because B\boldsymbol{B} and D\boldsymbol{D} are constant over a CST element, its stiffness matrix is:

kel=VelBTDBdV=BTDBAelh \boldsymbol{k}_{el}=\int_{V_{el}}\boldsymbol{B}^{T}\boldsymbol{D}\boldsymbol{B}\,dV =\boldsymbol{B}^{T}\boldsymbol{D}\boldsymbol{B}\,|A_{el}|h
Vel=hAel V_{el}=h|A_{el}|

Here hh is the thickness, Ael|A_{el}| is the geometric area, and VelV_{el} is the element volume.

07

MATLAB example

The example is a rectangular cantilever fixed at x=0x=0 and loaded at x=Lx=L by a total downward force distributed over the end nodes.

LengthL=200 mmL=200\ \mathrm{mm}
HeightH=50 mmH=50\ \mathrm{mm}
Thicknessh=5 mmh=5\ \mathrm{mm}
Young's modulusE=2.1×105 MPaE=2.1\times10^5\ \mathrm{MPa}
Poisson's ratioν=0.3\nu=0.3
End forceF0=1000 NF_0=1000\ \mathrm{N}
Rectangular cantilever discretized with a CST triangular mesh
Figure 2. CST mesh, supports at x=0x=0, and distributed nodal forces at x=Lx=L.

The mesh contains 40 subdivisions along the beam and 16 through the height: 1280 CST finite elements, 697 nodes, and 1394 equations.

  • gen defines the data, generates the mesh, applies the fixed-end constraints, and distributes the end force.
  • triang2d forms the element stiffness matrices, assembles the global system, imposes the boundary conditions, and solves for the nodal displacements.
  • plot_disp plots the selected displacement component.
  • plot_stress calculates element stresses, forms nodally averaged values, and plots the selected stress component.

08

Displacement and stress results

The program was executed in MATLAB R2026a. The four contour maps below use the turbo(16) colormap; the numerical calculations and plotted data are unchanged.

Figure 3. Horizontal displacement uu.
Figure 4. Vertical displacement vv.
Figure 5. Normal stress σx\sigma_x.
Figure 6. Shear stress τxy\tau_{xy}.
QuantityMinimumMaximum
uu0.0449544 mm-0.0449544\ \mathrm{mm}0.0449544 mm0.0449544\ \mathrm{mm}
vv0.249364 mm-0.249364\ \mathrm{mm}0 mm0\ \mathrm{mm}
σx\sigma_x93.9528 MPa-93.9528\ \mathrm{MPa}93.9528 MPa93.9528\ \mathrm{MPa}
τxy\tau_{xy}14.2312 MPa-14.2312\ \mathrm{MPa}0.518913 MPa0.518913\ \mathrm{MPa}

The calculated extrema agree with the values reported in the numerical example after rounding. The MATLAB results also agree very closely with the ANSYS comparison results.

Limitation of the CST shear-stress field

The shear stress τxy\tau_{xy} is poorly represented by the CST mesh used here. This is a consequence of the constant-stress approximation within each triangular element. In Section 9.4, the same problem will be analyzed with a four-node isoparametric quadrilateral element; for a comparable mesh density, the τxy\tau_{xy} distribution is represented much more accurately.

09

Programs and downloads

Verification status

The program was executed in MATLAB R2026a and reproduced all four published extrema. The ANSYS macro was inspected against the MATLAB geometry, material, thickness, mesh, constraints, and total load, but was not executed.

10

Reference

  1. C. A. Felippa, Introduction to Finite Element Methods, University of Colorado Boulder, course notes and syllabus.