Five-point stiffness stencil on a diagonal triangular grid (source code)

= Five-point stiffness stencil on a diagonal triangular grid
{title2=$4U_{ij}-U_{i-1,j}-U_{i+1,j}-U_{i,j-1}-U_{i,j+1}$}

For conforming piecewise affine elements on uniform squares split along their positive diagonals, a lower-triangle element matrix is $\frac12[[1,-1,0],[-1,2,-1],[0,-1,1]]$ in consecutive vertex order. <Finite element assembly> gives diagonal entry 4 and four axis-neighbor entries $-1$. The diagonal mesh edges contribute zero coupling because the corresponding local shape-function gradients are perpendicular. Strong Dirichlet elimination removes known-neighbor columns and adjusts the load.