generatemesh not respecting boundaries in 2023
이전 댓글 표시
I am having some issues with the generatemesh function. I used the following code to mesh a 2D plate with a crack in it. It works perfectly in v2022a, but does not produce the expected result in v2023b.
% boundary polyshape from vertices
x = [0 150 150 75 150 150 0];
y = [0 0 72.5 75 77.5 150 150];
pgon = polyshape({x}, {y});
% triangulation of geometry
T = triangulation(pgon);
tnodes = T.Points';
telements = T.ConnectivityList';
model = createpde;
geometryFromMesh(model, tnodes, telements);
% generate mesh
h = 20;
mesh = generateMesh(model, 'GeometricOrder', 'linear', 'Hmax', h);
pdemesh(model)
In v2022a, it produces the following mesh. The crack boundary is respected.

However, in v2023b, it does not respect the geometry of the crack, and meshes over it!

I'm aware that I can set a finer element size at vertices and edges, for example, at the crack tip, but this is not working properly either. For example, using
mesh = generateMesh(model, 'GeometricOrder', 'linear', 'Hmax', h, 'Hvertex', {4,h/20});
to set a finer mesh at the crack tip, improves the situation, but the crack tip is still not in the right place, as shown in the zoom in on the crack tip in the image below (it should be at coordinate 75,75)!

Is there any way I can use generatemesh in v2023b and have it still respect the boundaries?
답변 (2개)
Christopher
2024년 2월 28일
Jiexian Ma
2025년 4월 5일
0 개 추천
Hi Christopher,
I encoutered the same issue when using function generateMesh.


You could check demo14 to demo17 in Im2mesh package. I provide a few examples.
카테고리
도움말 센터 및 File Exchange에서 Geometry and Mesh에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
