KMG2D Mesh Generator

kmg2d is a 2D mesh generator based on signed distance function, i.e. the domain Ω must be defined as

Ω={x | φ(x)<0}
where φ is a real-valued function defined on R2.  The code generates unstructured (linear or quadratic) triangular mesh. The mesh size is automatically adapted to the "thickness" of the computational domain, using a geometric mesh size function based on  distance from the medial axis. The medial axis is the set of interior points that have equal distance to two or more points on the boundary. Computing the medial axis of a domain is a non trivial problem. To save computational time, the code uses an approximate medial axis set. The code can also use a user supplied mesh size function.

The names of the functions and their purposes:
 Package: kmg2d
 Reference : J. Koko, A MATLAB mesh generator for the two-dimensional finite element method, Applied Mathematics and Computation 250, 650-664 (2015).


Hook form Cavity

KMG3D (in progress)

3D obstacle problem


kpde is a vectorized MATLAB library of P1 finite element assembling functions for the numerical solution of the Poisson problem and the linear elasticity problem in 2D/3D. Cell-arrays are used to store the gradient of the element basis functions. The resulting
vectorized MATLAB implementation is close to the standard form. The code consists of 3 sets of functions
−∇.(ν(x)∇ u(x))+α(x)u(x)=f(x)  in Ω

−∇.σ(u(x))=f(x) in Ω.

Package: kpde
Reference: J. Koko, Fast MATLAB assembly of FEM matrices in 2D and 3D using cell-array approach, International Journal of Modeling, Simulation and Scientific Computing, to appear, DOI: 10.1142/S1793962316500100


kstok is a vectorized MATLAB assembling functions for the numerical solution of Stokes problem using P1-bubble/P1 and P1-Stab finite element in 2D and 3D.  The implementation uses cell-array to store the gradient of the element basis functions. Consequently,
the current code is about two times faster than the previous one (see below). Note that, the code shares some functions with kpde package.

Package: available soon

Old versions (2D)

CUDA Codes


Conjugate Gradient algorithm Preconditioned by Symmetric Successive OverRelaxation  Approximate Inverse (SSOR - AI). The preconditioning matrix, computed using a Neumann expansion, is used through sparse matrix-vector multiplication. The proposed preconditioner is then well-suited for massively parallel architectures like GPUs.

Package: available soon.

J. koko Mar 2016