Describing a pde model geometry that can have multiple domains

2 ビュー (過去 30 日間)
Andrei Cheplakov
Andrei Cheplakov 2023 年 12 月 6 日
回答済み: Jiexian Ma 2025 年 4 月 5 日
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 Center および File ExchangeGeometry and Mesh についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by