Expand description
GPU-accelerated FEM matrix assembly (CPU mock implementation).
This module provides Finite Element Method (FEM) matrix assembly routines that mirror a GPU implementation. All operations run on the CPU via plain loops for portability.
The formulation assumes 2-node bar/rod elements in 1-D for simplicity, making the element stiffness matrix 2×2 and DOF management straightforward. The same patterns extend to 2-D and 3-D elements.
Structs§
- GpuFem
Mesh - A FEM mesh with element connectivity and material parameters.
Functions§
- gpu_
all_ element_ stiffness - Return the element stiffness matrices for all elements (parallel mock).
- gpu_
apply_ dirichlet - Apply Dirichlet boundary conditions by zeroing constrained DOF rows/cols.
- gpu_
assemble_ global - Parallel element stiffness computation — returns all element matrices.
- gpu_
dot_ product - Parallel reduction dot product:
a · b. - gpu_
element_ stiffness - Compute the 2×2 element stiffness matrix for bar/rod element
e. - gpu_
residual - Compute the residual vector
r = f − K·uin parallel.