On the Matlab S-FEM code for 2D problems using
T3 and Q4 elements
These codes were developed by Liu, Nguyen and workers. The detailed
theoretical background, formulation and implementation procedure are given
in the book:
Liu, G. R. and Nguyen Thoi Trung, Smoothed Finite Element Method, CRC
press, Boca Raton, USA, 2010.
Important note: The authors decided to release the source codes free of charge with the hope that the S-
FEM technique can be applied to more problems and can be further developed into even more powerful
methods. The authors are not be able to provide any services or user-guides, but appreciate very much
your feedback on errors and suggestions, so that we can improve these codes/methods in the future. If the
idea, method, and any part of these codes are used in anyway, the users are required to cite the book and
the following related original papers of the authors:
• Liu, G. R., The Finite element method – a practical course, Elsevier (BH), UK. 2003.
• Liu, G. R. and Nguyen Thoi Trung, Smoothed Finite Element Method, CRC press, Boca Raton,
USA, 2010.
• Liu GR, Dai KY, Nguyen-Thoi T (2007) A smoothed finite element method for mechanics
problems. Computational Mechanics; 39: 859-877.
• Dai KY, Liu GR (2007) Free and forced vibration analysis using the smoothed finite element
method (SFEM). Journal of Sound and Vibration; 301: 803-820.
• Dai KY, Liu GR, Nguyen-Thoi T (2007) An n-sided polygonal smoothed finite element method
(nSFEM) for solid mechanics. Finite Elements in Analysis and Design; 43: 847-860.
• Nguyen-Thoi T, Liu GR, Dai KY, Lam KY (2007) Selective Smoothed Finite Element
Method. Tsinghua Science and Technology; 12(5): 497-508.
• Liu GR, Nguyen-Thoi T, Dai KY, Lam KY (2007) Theoretical aspects of the smoothed finite
element method (SFEM). International Journal for Numerical Methods in Engineering; 71: 902-
930.
• Liu GR, Nguyen-Thoi T, Nguyen-Xuan H, Dai KY, Lam KY (2009) On the essence and the
evaluation of the shape functions for the smoothed finite element method (SFEM) (Letter to
Editor). International Journal for Numerical Methods in Engineering; 77: 1863-1869.
• Liu GR, Nguyen-Thoi T, Nguyen-Xuan H, Lam KY (2009) A node-based smoothed finite
element method (NS-FEM) for upper bound solutions to solid mechanics problems. Computers
and Structures; 87: 14-26.
• Nguyen-Thoi T, Liu GR, Nguyen-Xuan H (2009) Additional properties of the node-based
smoothed finite element method (NS-FEM) for solid mechanics problems. International Journal
of Computational Methods, 6(4): 633-666.
• Nguyen-Thoi T, Liu GR, Nguyen-Xuan H, Nguyen-Tran C (2010) Adaptive analysis using the
node-based smoothed finite element method (NS-FEM). International Journal for Numerical
Methods in Biomedical Engineering; in press, doi: 10.1002/cnm.1291.
• Liu GR, Nguyen-Thoi T, Lam KY (2009) An edge-based smoothed finite element method (ES-
FEM) for static, free and forced vibration analyses in solids. Journal of Sound and Vibration; 320:
1100-1130.
• Nguyen-Xuan H, Liu GR, Thai-Hoang C, Nguyen-Thoi T (2009) An edge-based
smoothed finite element method with stabilized discrete shear gap technique for analysis
of Reissner-Mindlin plates. Computer Methods in Applied Mechanics and Engineering;
199: 471-489.
• Nguyen-Xuan H, Liu GR, Nguyen-Thoi T, Nguyen-Tran C (2009) An edge-based smoothed
finite element method for analysis of two-dimensional piezoelectric structures, Smart Materials
and Structures 18 (6). no. 065015.
• Nguyen-Thoi T, Liu GR, Vu-Do HC, Nguyen-Xuan H (2009) An edge-based smoothed finite
element method (ES-FEM) for visco-elastoplastic analyses of 2D solids using triangular mesh.
Computational Mechanics; 45: 23-44.
• Nguyen-Thoi T, Liu GR, Nguyen-Xuan H (2010) An n-sided polygonal edge-based smoothed
finite element method (nES-FEM) for solid mechanics. International Journal for Numerical
Methods in Biomedical Engineering; doi:10.1002/cnm.1375.
• Nguyen-Thoi T, Liu GR, Lam KY, GY Zhang (2009) A Face-based Smoothed Finite Element
Method (FS-FEM) for 3D linear and nonlinear solid mechanics problems using 4-node tetrahedral
elements. International Journal for Numerical Methods in Engineering; 78: 324-353.
• Nguyen-Thoi T, Liu GR, Vu-Do HC, Nguyen-Xuan H (2009) A face-based smoothed finite
element method (FS-FEM) for visco-elastoplastic analyses of 3D solids using tetrahedral mesh.
Computer Methods in Applied Mechanics and Engineering; 198: 3479-3498.
• Liu GR, Nguyen-Thoi T, Lam KY (2009) A novel FEM by scaling the gradient of strains with
factor α (αFEM). Computational Mechanics; 43: 369-391.
• Liu GR, Nguyen-Thoi T, Lam KY (2008) A novel Alpha Finite Element Method (αFEM) for
exact solution to mechanics problems using triangular and tetrahedral elements. Computer
Methods in Applied Mechanics and Engineering; 197: 3883-3897.
• Liu GR, Nguyen-Xuan H, Nguyen-Thoi T, Xu X (2009) A novel weak form and a
superconvergent alpha finite element method (SαFEM) for mechanics problems using triangular
meshes. Journal of Computational Physics; 228: 4055-4087.
• Liu GR, Chen L, Nguyen-Thoi T, Zeng K, G. Y. Zhang (2010) A novel singular node-based
smoothed finite element method (NS-FEM) for upper bound solutions of cracks. International
Journal for Numerical Methods in Engineering; doi: 10.1002/nme.2868.
• Liu GR, Nourbakhshnia N, Chen L, Zhang YW (2010) A novel general formulation for singular
stress field using the ES-FEM method for the analysis of mixed-mode cracks, International
Journal of Computational Methods 7 (1), pp. 191-214.
• Liu GR, Nourbakhshnia N, Zhang YW (2010) A novel singular ES-FEM method for simulating
singular stress fields near the crack tips for linear fracture problems, Engineering Fracture
Mechanics, (in press).
• Wu SC, Liu GR, Zhang HO, Zhang GY (2009) A node-based smoothed point interpolation
method (NS-PIM) for thermoelastic problems with solution bounds. International Journal of Heat
and Mass Transfer; 52(5-6): 1464-1471.
• Wu SC, Liu GR, Zhang HO, Zhang GY (2008) A node-based smoothed point interpolation
method (NS-PIM) for three-dimensional thermoelastic problems. Numerical Heat Transfer, Part
A: Applications; 54(12): 1121-1147.
• Wu SC, Liu GR, Zhang HO, Xu X, Li ZR (2009) A node-based smoothed point interpolation
method (NS-PIM) for three-dimensional heat transfer problems. International Journal of Thermal
Sciences; 48(7): 1367-1376, 2009.
A brief overall view on the use of these codes is given as follows. Some guidance is given in the
commend lines of the source codes.
Main file : main_2D_problems.m
There are 3 major processes:
• Preprocess
• Solution
• Postprocess
1. Preprocessor 1.1. Choice of examples: there are two examples (with the analytical solutions)
1) cantilever (a rectangular cantilever loaded at the end)
2) platehole (infinite plate with a circular hole)
1.2. Choice of the methods: there are 7 methods including
1) FEM_T3 (FEM using 3-node triangular elements)
2) FEM_Q4 (FEM using 4-node quadrilateral elements)
3) CSFEM_Q4 (cell-based smoothed FEM using 4-node quadrilateral elements)
Input the number of smoothing cells per element (1, 2, 3, 4, 8, 16)
4) NSFEM_T3 (node-based smoothed FEM using 3-node triangular elements)
5) NSFEM_Q4 (node-based smoothed FEM using 4-node quadrilateral elements)
6) ESFEM_T3 (cell-based smoothed FEM using 3-node triangular elements)
7) Alpha_FEM_T3 (alpha FEM using 3-node triangular elements)
Input the value of parameter alpha [ ]0,1α ∈
1.3. Input the initial data of the problem: density of element mesh
1.4. Compute the necessary data from the initial data including: coordinates of nodes
(gcoord), element connectivity (ele_nods), boundary conditions (bcdof, bcval) and force vector (ff).
2. Solution procedure 2.1. Compute the stiffness matrix: K
For NSFEM_T3 and ESFEM_T3: there are two schemes (optional):
1st scheme: basing on the boundary of smoothing domains
NSFEM_T3: [K]=cal_K_NSFEM_T3_boun(nod_adjele,area_nod);
ESFEM_T3: [K]=cal_K_ESFEM_T3_boun(edge_data,area_edg);
2nd scheme: taking average of the adjacent elements of nodes or edges
NSFEM_T3: [K]=cal_K_NSFEM_T3_aver(nod_adjele,area_nod,area_T3);
ESFEM_T3: [K]=cal_K_ESFEM_T3_aver(edge_data,area_edg,area_T3);
For CSFEM_Q4 and ESFEM_T3: there is also the selective scheme used for nearly
incompressible materials
CSFEM_Q4: [K]=cal_K_CSFEM_Q4_selective(nSD);
ESFEM_T3: [K]=cal_K_ESFEM_T3_selective(edge_data,area_T3,area_edg);
2.2. Apply the boundary condition: [K,ff]=apply_bcdof(K,ff,bcdof,bcval);
2.3. Solve the system of equations to obtain the nodal displacement vector
3. Postprocess 3.1. Compute the strain energy of system (energy)
3.2. Compute error norms: in displacement (norm_disp), in energy (norm_E) and
recovery energy (norm_Ereco)
3.3. Output error norms and plot the results of displacement and stresses.