This code demonstrates vectorization concepts from the paper:
Talal Rahman and Jan Valdman: Fast MATLAB assembly of FEM matrices in 2D and 3D: nodal elements, Applied Mathematics and Computation 219, 7151–7158 (2013).
A link to the paper can be found at the author web page located at http://sites.google.com/site/janvaldman/publications
Please cite the paper if you find the code useful.
Available scripts from the paper:
Additional script (provided by Tien Dat Ngo from EFPL Lausanne):
coeffs denotes a scalar coefficient in corresponding bilinear forms:
a(u,v) = (coeffs * grad u, grad v) (in the stiffness matrix function),
a(u,v) = (coeffs *u, v) (in the mass matrix function),
where u,v are P1 functions. Ignore it in the input of both functions to have coeffs=1.
It is straightforward to modify FEM assemblies to work with rectangular elements, but it is not done in this version. Read the paper and try it yourself :).
What's the 'coeffs' mean in function 'stifness_matrixP1' and 'mass_matrixP1'?
can this create a mass matrix for a rectangular (2 dimensional) mesh?
Description simplified, 'stifness' changed to 'stiffness'.
Title and summary update.
P1 coefficients for mass matrices (both 2D and 3D) added
P0 coefficients added to assemblies of mass matrices in both 2D and 3D
new functionality added: elementwise constant coefficients
paper info completed
Q1 assembly in 3D for linear elasticity added thanks to Tien Dat Ngo.
Paper information added
report link add, extended to work for linear elasticity
tested for both linux and windows
2D functionality added
Inspired: Element-based Solvers, Fast FEM assembly: edge elements, Evolutionary model for shape memory alloys, Hyper elasticity with a non-penetration condition , Implementation of C1 FEM, Simulation of von Kármán viscoelastic plates