Mesh creation is one of the primary tasks in implementing the Finite Element Method (FEM) to solve two- and three-dimensional boundary value problems. However, the whole procedure becomes tedious and problematic when higher-order finite elements are employed to construct mesh and prepare corresponding element data. In this study, we strive to develop a versatile algorithm for discretizing the two-dimensional domain using linear, quadratic, and cubic triangular finite elements. The algorithm is developed based on n vertices (actual or more in number) that constitute the boundary of the domain, along with a computed (n+1)-th point such as the centroid. The algorithm, using this input, generates an initial mesh consisting of n triangular elements. Then, in every subsequent step, the algorithm increases the number of triangles in the mesh fourfold compared to the previous step. The algorithm we present here can employ (a) straight-sided (linear, quadratic, and cubic) triangular elements to generate the mesh for domains with polygonal boundaries and (b) both straight-sided and curved (quadratic and cubic) triangular elements with two straight sides and one curved side to generate meshes for domains with curved boundaries. Thus, the algorithm generates the desired meshes if the vertices are specified once at the initial step. Additionally, the inclusion of the mathematical expression of the curved boundary enables the algorithm to generate the fine mesh for the curved domain utilizing higher-order curved and straight-sided triangular elements. We also present a computer code in MATLAB incorporating the algorithm to create the mesh, prepare the element's data, and determine the element's connectivity.
 GANIT J. Bangladesh Math. Soc. 43.1 (2023) 017- 035
Read full abstract