Skip to main content

Module gpu_fem_assembly

Module gpu_fem_assembly 

Source
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§

GpuFemMesh
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·u in parallel.