Materials Today: Proceedings: T.V. Smitha, K.V. Nagaraja
Materials Today: Proceedings: T.V. Smitha, K.V. Nagaraja
Materials Today: Proceedings: T.V. Smitha, K.V. Nagaraja
a r t i c l e i n f o a b s t r a c t
Article history: In this article MATLAB code is proposed for three-dimensional CAD geometries to produce automatic
Available online 5 November 2020 higher-order (HO) tetrahedral mesh. The HO mesh generator HOtetramesh proposed here is based up
on a MATLAB PDE toolbox mesh generator function generateMesh. The input for this code is identical with
Keywords: that for input for the PDE toolbox mesh generator and the tetrahedral element with the necessary order.
Subparametric mappings An HO tetrahedral mesh is generated as the output with the node coordinates, connectivity matrix,
HO tetrahedral elements boundary edges and boundary nodes. The proposed mesh generator could be used efficiently to produce
Mesh generation
high-quality meshes in 3D finite element applications. A numerical example is provided with the com-
Finite element method
CAD geometries
plete detail for the demonstration of the proposed automated HO tetrahedral mesh generator over a
3D geometry by the subparametric finite element approach. This methodology can be used easily and
reliably to address several problems in science and engineering.
Ó 2020 Elsevier Ltd. All rights reserved.
Selection and peer-review under responsibility of the scientific committee of the Second International
Conference on Recent Advances in Materials and Manufacturing 2020.
https://doi.org/10.1016/j.matpr.2020.09.546
2214-7853/Ó 2020 Elsevier Ltd. All rights reserved.
Selection and peer-review under responsibility of the scientific committee of the Second International Conference on Recent Advances in Materials and Manufacturing 2020.
T.V. Smitha and K.V. Nagaraja Materials Today: Proceedings 42 (2021) 330–342
In this paper, the MATLAB function Gen_LagSF3D code devel- only for the cubic order ðn ¼ 3Þ tetrahedral elements. Hence, the
oped for the automated 3D Lagrange interpolation function gener- order ðnÞ of the tetrahedral element is chosen as 3, as the cubic-
ation for any order is provided and depicted in Section 2. The order finite elements are utilized. A similar strategy can be pursued
MATLAB fragments for the proposed mesh generator HOtetramesh for all other HO tetrahedral elements.
with the cubic case is detailed in Section 3 along with the code. The MATLAB code lines from 3 to 17 given in the Appendix A in
Other HO tetrahedral elements generated from mesh are similarly Listing 2 can produce different preliminary meshes with element
achieved. A numerical illustration demonstrating the use of the size hmax utilizing the MATLAB mesh generator generateMesh for
created mesh is given in Section 4 with a detailed explanation the provided CAD geometries as STL file as described in [8]. Then,
for the implementation of the HO computational technique by in the MATLAB code lines from 19 to 32 given in the Appendix A
FEM for the Poisson equation. So that, the users can effectively in Listing 2, explicit variable declarations and memory allocation
use the proposed mesh generation and edit the codes as per their have been performed for the cubic case.
requirements. The work is concluded in Section 5. The subparametric mapping formula used for creating the HO
tetrahedral mesh is:
2. Automatic generation of 3D Lagrange interpolation functions tðn; g; fÞ ¼ t 1 þ ðt2 t1 Þn þ ðt3 t1 Þg þ ðt 4 t 1 Þf; ðt ¼ x; y; zÞ: ð2Þ
Interpolation functions in FEM, are utilized to express the vari- For the cubic tetrahedral element, 20 nodes per tetrahedron are
ations inside an element of field variable using its nodal values as required and therefore, 2 nodes are added to each tetrahedron
pursues: edge. Additional nodes are equally spaced along the straight sided
edge.
ðnþ1Þðnþ2Þðnþ3Þ
X 6 The nodes t 17 ; t18 ; and t 19 for the regular face of the tetrahedron
Nk ðn; g; fÞuek :
ðnÞ
u¼ ð1Þ are determined by the following relations:
k¼1
t17 ¼ 16 ð2t1 þ t 2 þ 3t 8 Þ;
In this, u represents field variable inside the element at any
ðnÞ t18 ¼ 16 ð2t1 þ t 4 þ 3t 13 Þ; ð3Þ
point, uek represent the nodal values of u; N k represents interpola-
tion functions which are assigned as shape functions of tetrahedral t19 ¼ 16 ð2t1 þ t 3 þ 3t 16 Þ; ðt ¼ x; y; zÞ:
element at the node k of polynomial order n. The Lagrange shape The interior node t 20 of the curved face of the tetrahedron is
functions for three-dimensional elements are indicated by determined by the following relation:
N i ðx; y; zÞ or N i ðn; g; fÞ and are defined as
1
Ni ðn; g; fÞ ¼ Li ðnÞLi ðgÞLi ðfÞ: t 20 ¼
12
½ð2Þðt 2 þ t3 þ t 4 Þ þ 3ðt 7 þ t 8 þ t 13 þ t 14 þ t 15 þ t16 Þ; ðt ¼ x; y; zÞ:
(i) N: gives the total number of nodes in the geometry. 4. Numerical example
(ii) p: this N 3 array facilitates node coordinates x; y; z for
every one of the N nodes. In this section, we provide the detailed solution procedure for
(iii) t: gives the connectivity matrix having each row associated the Poisson equation over a 3D geometry by the subparametric
with nth order tetrahedron by ðn þ 1Þðn þ 2Þðn þ 3Þ=6 integer finite element approach using the created automated HO tetrahe-
entries to specify node number in that tetrahedron with dral mesh generator. The Poisson equation appears in the form of
node ordering as appeared in Fig. 2. Eq. (5) in many physical problems as in Heat Transfer, Electrostat-
(iv) b: gives the boundary nodes. ics, Magnetostatics, solar cells [9] etc.
r:ðaðx; y; zÞruðx; y; zÞÞ ¼ f ðx; y; zÞ ð5Þ
A similar methodology can be reached out to create for other
HO tetrahedral mesh. It ought to be noticed that, HOtetramesh where aðx; y; zÞ is the material property, f ðx; y; zÞ is the source
creates HO tetrahedral mesh, actually, for any CAD geometry. term and the unknown uðx; y; zÞ to be resolved.
Yet, this works best for the regular geometry as straight-edged The following steps outline the subparametric FEM procedure
tetrahedral elements are utilized. Few outcomes from the pro- for solving a Poisson equation:
posed automated HO mesh generation for CAD geometries are pre- (i) Produce a HO tetrahedral mesh over the geometry utilizing
sented in Figs. 3–8. HOtetramesh for the regular geometry.
332
T.V. Smitha and K.V. Nagaraja Materials Today: Proceedings 42 (2021) 330–342
Z Z Z
(ii) Next, the element geometry is expressed in terms of the @N i @N j @Ni @Nj @Ni @Nj
K i; j ¼ þ þ dxdydz
Lagrange interpolation functions. At that point, utilize the Galerkin Xe @x @x @y @y @z @z
weighted residual finite element procedure to get the following
¼ K i;x; jx þ K i;y; jy þ K i;z; jz ; ð6bÞ
finite element equation:
½KMM fU gM1 ¼ fF gM1 ð6aÞ Xe represents the region of an element and for
ði; j ¼ 1; 2; 3; . . . ; MÞ K i;x; jx ; K i;y; jy and K i;z; jz can be calculated as
where
follows:
333
T.V. Smitha and K.V. Nagaraja Materials Today: Proceedings 42 (2021) 330–342
and
ð6cÞ
334
T.V. Smitha and K.V. Nagaraja Materials Today: Proceedings 42 (2021) 330–342
Fig. 7. HO tetrahedral meshes for a one side curved rectangular plate with four holes geometry.
8
>
< 10; for quadratic tetrahedron element (v) The boundary conditions are imposed.
M ¼ 20; for cubic tetrahedron element ð6eÞ (vi) Next, obtain the solutions of the Poisson equation from the
>
: reduced system of algebraic equations written in Matrix form.
35; for quartic tetrahedron element:
(vii) At all the nodes, get the estimations of the field variable
U; U ¼ K 1 F.
RRR
Fi ¼ f ðx; y; zÞN i dxdydz (viii) Process the precision of the outcomes acquired by the uti-
Xe
R1 R 1n R 1ng lization of subparametric mappings by computing the minimum
¼ n¼0 g¼0 f¼0 Jf ðxðn; g; fÞ; yðn; g; fÞ; zðn; g; fÞÞNi ðn; g; fÞdfdgdn:
and maximum percent errors as follows:
ð6fÞ
u U
percent error ¼ 100 ð7Þ
u
(iii) For each element, compute utilizing Eqs. (6b)–(6f) the ele-
ment matrices components K i; j and F i utilizing the Gauss Legendre
– Gauss Jacobi quadrature rules over a tetrahedral region [10]. where u is the known exact solution and U is the best computed
(iv) Assemble the matrix K and the vector F for the Poisson FEM solution.
equation, KU ¼ Futilizing a piecewise HO FE algorithm from each The flowchart in Fig. 9 provides a brief description of the differ-
of the tetrahedral elements. ent steps associated with solving a Poisson equation utilizing HO
335
T.V. Smitha and K.V. Nagaraja Materials Today: Proceedings 42 (2021) 330–342
Fig. 9. Schematic flowchart on subparametric FEM to solve a Poisson equation using HO tetrahedral elements over any 3D geometry.
336
T.V. Smitha and K.V. Nagaraja Materials Today: Proceedings 42 (2021) 330–342
Fig. 10. Percent error analysis at the common nodes by the subparametric FEM process of the Poisson equation Eqs. (8)–(9).
Table 1
The L2 norm error analysis of FEM over a unit cube geometry utilizing up to cubic-order tetrahedral elements.
Polynomial Gauss Legendre quadrature points L2 Norm Normalized CPU time Degrees of freedom No. of elements
Linear 1 point 3.34352978e03 75.63 3375 16464
Quadratic 2 point 4.55890290e04 2.7 2197 1296
Cubic 3 point 5.61832576e04 1 1000 162
tetrahedral elements over any 3D geometry. The proficiency and u ¼ 0; on the boundary: ð9Þ
exactness of HO FEM are very well proved in the works of [4–
6,11] utilizing subparametric mapping. However, the development The exact solution of Eq. (8) satisfying Eq. (9) is
of HO automated 3D mesh generator especially for MATLAB user is uðx; y; zÞ ¼ xyzðx 1Þðy 1Þðz 1Þ.
still a major bottleneck for various applications. To exhibit the We then compare the exact solution with the computed FEM
appropriateness of the proposed mesh generator for the subpara- solution with by calculating the percent error at common nodal
metric technique on HO FEM and to validate the proposed mesh points for the linear to cubic ordered elements as presented in the
generator we provide here a numerical example. We have devel- Fig. 10 for a discretization of the geometry by 384 elements. The
oped an in–house MATLAB code to solve the 3D Poisson equation CPU time of every test case normalized by the CPU time of the fastest
by the created automated mesh generator utilizing up to cubic- test case by L2 norm of ðu UÞ for achieving similar accuracy for all
order elements. A numerical example over a unit cube is consid- the considered order are shown in Table 1 for this example.
ered by the above-mentioned procedure to approve the proposed It is visible from the Table 1 that cubic-order elements deliver
3D automated mesh generator in MATLAB. We assume here that the most precise approximation to the exact solution as far as
aðx; yÞ ¼ 1in Eq. (5) for the example administered in this section. the L2 norm by a minimum number of elements, degrees of free-
Example: dom and computational time contrasted with the lower-order ele-
We solve the following Poisson equation Eqs. (8), (9) by utiliz- ments. Additionally, it is obvious from the Fig. 10 that, the percent
ing HO FEM in MATLAB by taking up to cubic-order elements as error is diminished by the utilization of HO components. In this
per the procedure explained in the flowchart provided in Fig. 9. manner, the proficiency and exactness of HO elements are appar-
ent from the Fig. 10.
Thus, the proposed mesh generation can be utilized for solving
r2 ðuÞ ¼ 2xyðx 1Þðy 1Þ 2yzðy 1Þðz 1Þ 2xzðx 1Þðz 1Þ; in X ¼ ð0;1Þ3 ;
the Poisson equation productively. Along these lines, the solutions
ð8Þ
with the coveted exactness can be accomplished effortlessly by
337
T.V. Smitha and K.V. Nagaraja Materials Today: Proceedings 42 (2021) 330–342
using HO elements by this methodology. So in a similar manner, functions by parabolic arcs is more great than expanding the
this methodology can be connected and extended to tackle any quantity of elements for upgrading the numerical solutions of
PDE emerging in energy problems to get the most accurate solution PDEs. The users can use and adapt the proposed mesh genera-
as demonstrated in [6] for 2D energy applications. tion to their requirements. We have demonstrated the applica-
bility of the proposed mesh generation in detail for solving the
Poisson equation utilizing the subparamteric HO FEM. The exact-
5. Conclusions
ness and effectiveness of the HO elements differentiated by the
lower order elements are clear from the numerical outcomes.
For 3D problems, the process of HO mesh generation contin-
These simple and exceptional meshes can be effectively used
ues to be a real bottleneck for large-scale computations in engi-
for several science and engineering applications.
neering and scientific applications. In this paper, we have
proposed 3D HO tetrahedral mesh generator especially for FE
applications utilizing the subparametric mappings. The proposed CRediT authorship contribution statement
mesh generation codes HOtetramesh is simple and offers efficient
HO mesh generators for MATLAB users. It is broadly perceived T.V. Smitha: Conceptualization, Software, Writing - original
that the HO elements beat the low-order elements. Likewise, it draft, Data curation, Visualization. K.V. Nagaraja: Methodology,
is remarkable that the computational time, the degrees of free- Supervision, Validation, Writing - review & editing.
dom and the quantity of elements might be definitely dimin-
ished by methods for the use of HO elements in FEM. We Declaration of Competing Interest
have additionally given the total clarification to the created
automated mesh generation MATLAB codes for CAD geometries The authors declare that they have no known competing finan-
for one HO case in detail so the users can utilize it straightfor- cial interests or personal relationships that could have appeared
wardly or with the reasonable revision in their required applica- to influence the work reported in this paper.
tion area. It is obvious that growing the request of the shape
The accompanying MATLAB function Gen_LagSF3d.m provided in Listing 1 generates and displays the generalized Lagrange coefficients
and shape functions for tetrahedral element of any order:
338
T.V. Smitha and K.V. Nagaraja Materials Today: Proceedings 42 (2021) 330–342
The accompanying line of MATLAB code can produce cubic-order tetrahedral elements for the provided CAD geomtery as STL file.
339
T.V. Smitha and K.V. Nagaraja Materials Today: Proceedings 42 (2021) 330–342
340
T.V. Smitha and K.V. Nagaraja Materials Today: Proceedings 42 (2021) 330–342
341
T.V. Smitha and K.V. Nagaraja Materials Today: Proceedings 42 (2021) 330–342
References [6] T.V. Smitha, K.V. Nagaraja, An efficient automated higher-order finite element
computation technique using parabolic arcs for planar and multiply-connected
Energy problems, Energy 183 (2019) 996–1011.
[1] C. Geuzaine, J.-F. Remacle, Gmsh: a three-dimensional finite element mesh
[7] Don Riley, CAD2MATDEMO.m:version 1.0, 3D CAD data to MATLAB Converter,
generator with built-in pre- and post-processing facilities, International
CAD STL to MATLAB Patch (120 KB), MATLAB 6.5 (R13), https://
Journal for Numerical Methods in Engineering 79 (11) (2009) 1309–1331.
in.mathworks.com/matlabcentral/fileexchange/3642-cad2matdemo-m, 2003. .
[2] Jeremy Ims, Zhaowen Duan, Zhi J. Wang, meshCurve: An Automated Low-
[8] MathWorks, Partial Differential Equation Toolbox: User’s Guide (R2015a),
Order to High-Order Mesh Generator, in: 22nd AIAA Computational Fluid
https://in.mathworks.com/help/pdf_doc/pde/rn.pdf, 2015..
Dynamics Conference, AIAA AVIATION Forum, (AIAA 2015-2293), 2015. .
[9] A. Akinpelu et al., A numerical simulation and modeling of poisson equation
[3] T.V. Smitha, K.V. Nagaraja, Automated higher-order mesh generation in
for solar cell in 2 dimensions, IOP Conference Series: Earth and Environmental
MATLAB on biomaterials, IOP Conference Series: Materials Science and
Science 173 (1) (2018) 012001.
Engineering 577 (1) (2019) 012130.
[10] H.T. Rathod, B. Venkatesudu, K.V. Nagaraja, Md Shafiqul Islam, Gauss Legendre
[4] Fahs Hassan, Improving accuracy of high-order discontinuous Galerkin
Gauss Jacobi quadrature rules over a tetrahedral region, Applied Mathematics
method for time-domain electromagnetics on curvilinear domains,
and Computation 190 (1) (2007) 186–194.
International Journal of Computer Mathematics 88 (10) (2011) 2124–2153.
[11] Sara E. McCaslin, Panos S. Shiakolas, Brian H. Dennis, Kent L. Lawrence, Closed-
[5] M. Kardani, M. Nazem, J.P. Carter, A.J. Abbo, Efficiency of high-order elements
form stiffness matrices for higher order tetrahedral finite elements, Advances
in large-deformation problems of geomechanics, International Journal of
in Engineering Software 44 (1) (2012) 75–79.
Geomechanics 15 (6) (2014) 1–10.
342