Mesh crack tip
Download Im2mesh package https://www.mathworks.com/matlabcentral/fileexchange/71772
Im2mesh package require Matlab Mapping toolbox
Before we start, please set folder "Im2mesh_Matlab" as your current folder of MATLAB.
clearvars
Function bounds2mesh use a mesh generator called MESH2D (developed by Darren Engwirda). We can use the following command to add the folder 'mesh2d-master' to the path of MATLAB.
addpath(genpath('mesh2d-master'))
Create polyshape
x = [0 150 150 75 150 150 0];
y = [0 0 72.5 75 77.5 150 150];
ps = polyshape(x,y);
plot(ps);
axis equal

Convert to a nested cell array of polygon
psCell = {ps}; bounds = polyshape2bound(psCell); % plot boundaries and show all vertices plotBounds(bounds,false,'ko-')

Generate mesh
hmax = 20;
grad_limit = 0.25;
opt = [];
opt.disp = inf; % silence verbosity
[vert,tria,tnum,vert2,tria2] = bounds2mesh( bounds, hmax, grad_limit, opt );
plotMeshes(vert,tria,tnum);

refine mesh locally
hmax = 20; grad_limit = 0.25; opt = []; opt.disp = inf; % silence verbosity pnt = [75, 75]; % 1 point hsize = 1; % mesh size at point opt.pnt_size = [ pnt, hsize ]; % p-by-3 array [ vert,tria,tnum,vert2,tria2 ] = bounds2mesh( bounds, hmax, grad_limit, opt ); plotMeshes(vert,tria,tnum);

Please refer to the following link for how to refine mesh locally https://mjx888.github.io/im2mesh_demo_html/demo17.html
Create matlab pde model object
% linear model model_linear = createpde(); geometryFromMesh( model_linear, vert', tria', tnum' ); % qudratic model model_quad = createpde(); geometryFromMesh( model_quad, vert2', tria2', tnum' );
show geometry
pdegplot(model_quad, 'EdgeLabels','on','VertexLabels','on', 'FaceLabels','on' )

Show mesh
pdemesh( model_quad )

end