generatemesh not respecting boundaries in 2023
Mostra commenti meno recenti
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?
Risposte (2)
Christopher
il 28 Feb 2024
Jiexian Ma
il 5 Apr 2025
0 voti
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.
Categorie
Scopri di più su Geometry and Mesh in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
