# A Compact FEM Implementation for Parabolic Integro-Differential Equations in 2D
###### Abstract  
Although two-dimensional (2D) parabolic integro-differential equations (PIDEs) arise in many physical contexts, there is no generally available software that is able to solve them numerically. To remedy this situation, in this article, we provide a compact implementation for solving 2D PIDEs using the finite element method (FEM) on unstructured grids. Piecewise linear finite element spaces on triangles are used for the space discretization, whereas the time discretization is based on the backward-Euler and the Crank-Nicolson methods. The quadrature rules for discretizing the Volterra integral term are chosen so as to be consistent with the time-stepping schemes; a more efficient version of the implementation that uses a vectorization technique in the assembly process is also presented. The compactness of the approach is demonstrated using the software Matrix Laboratory (MATLAB). The efficiency is demonstrated via a numerical example on an L-shaped domain, for which a comparison is possible against the commercially available finite element software COMSOL Multiphysics. Moreover, further consideration indicates that COMSOL Multiphysics cannot be directly applied to 2D PIDEs containing more complex kernels in the Volterra integral term, whereas our method can. Consequently, the subroutines we present constitute a valuable open and validated resource for solving more general 2D PIDEs. parabolic integro-differential equations; backward-Euler; Crank-Nicolson; quadrature rules; Volterra integral term 2020 1324202018 September 202024 September 202027 August 20202018 September 20202024 September 202027 August 20202018 September 20202027 August 20202018 September 20202027 August 20202027 August 20202027 August 20202027 August 20202027 August 202027 August 20202027  
convergence (both a priori and a posteriori) analysis for such problems is already well-established, and for this one may refer to [9; 10; 12; 22; 23; 24; 25; 26; 27; 28]. As regards existing software platforms which could be used for a finite-element implementation without having to resort to lengthy programming from first principles, the main choices are freefem++ [29], deal.II [30], iFEM [31], FEniCS [32], DUNE [33], FEATool [34], MATLAB's Partial Differential Equation Toolbox [35] and COMSOL Multiphysics [36]; however, it is not immediately obvious how to solve PIDEs with any of these. This is perhaps surprising in the case of MATLAB, which has become increasingly popular in recent years for the numerical solutions of various partial differential equations (PDEs) in structural mechanics and heat transfer [37; 38; 39; 40; 41; 42; 43; 44; 45; 46; 47], and has proven to be an excellent tool for academic education in general [40]. Against that background, the purpose of this article is to provide a compact formulation for solving PIDEs in two spatial dimensions (2D) using FEM on unstructured grids (we made the resulting software, which we programmed in MATLAB, openly available). This is done by extending the already available FEM formulations for PDEs [40; 43; 44; 48; 49] to PIDEs. In particular, we:  
* Use piecewise linear finite element spaces on triangles for the space discretization;
* Vase the time discretizations on the backward-Euler and the Crank-Nicolson methods;
* Choose the quadrature rules for discretizing the Volterra integral term so as to be consistent with the time-stepping schemes. In addition, we demonstrate that for PDEs, vectorization techniques can be used to speed up the sets of code for PIDEs. Importantly, these sets of code can be easily extended to more complex geometries, and to PIDEs with different kernels in the Volterra integral term. A comparison with results obtained using COMSOL Multiphysics for a test example shows that our method is competitive. Moreover, further consideration indicates that COMSOL Multiphysics cannot be directly applied to 2D PIDEs containing more complex kernels in the Volterra integral term, whereas our method can. The rest of the paper is organized as follows.