Describing a pde model geometry that can have multiple domains

1 次查看(过去 30 天)
Let's say I have a certain number of polygons (given by the coordinates of their points), which make up a geometry in which I want to solve a pde. The number of polygons, as well as their size, can be changed:
% Height and width of polygons
size_x = 0.5;
size_y = 3;
% Number of polygons
Npoly = 5;
figure;
hold on;
axis equal;
for i = 1:Npoly
% Getting coordinates of current polygon's points
p1_x(i) = (i-1)*size_x;
p1_y(i) = 0;
p2_x(i) = size_y + (i-1)*size_x;
p2_y(i) = size_y;
p3_x(i) = size_y + size_x + (i-1)*size_x;
p3_y(i) = size_y;
p4_x(i) = size_x + (i-1)*size_x;
p4_y(i) = 0;
points = [p1_x(i),p1_y(i); p2_x(i),p2_y(i); p3_x(i),p3_y(i); p4_x(i),p4_y(i)];
% Plotting polygon
pg = polyshape(points(:,1),points(:,2));
plot(pg);
end
Each polygon represents a separate domain, and some constant present in the pde can vary between them, so I need a way of labeling parts of the geometry.
Is it possible to somehow convert these polygons into a model geometry, so that they form separate domains?
  1 个评论
Andrei Cheplakov
Andrei Cheplakov 2023-12-6
编辑:Andrei Cheplakov 2023-12-6
I actually figured out how to do this. I used the cgs modelling method, and combined a base rectangle with the coordinates that I got for each polygon. I changed the code slightly, so that there is a spacing between consecutive polygons, and this is what I ended up with:

请先登录,再进行评论。

回答(1 个)

Jiexian Ma
Jiexian Ma 2025-4-5
Yes, it's possible to convert these polygons into a PDE model geometry.
I do this via Im2mesh package.
You could check demo14 to demo17 in Im2mesh package. I provide a few examples.

类别

Help CenterFile Exchange 中查找有关 Geometry and Mesh 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by