필터 지우기
필터 지우기

Describing a pde model geometry that can have multiple domains

조회 수: 2 (최근 30일)
Andrei Cheplakov
Andrei Cheplakov 2023년 12월 6일
편집: Andrei Cheplakov 2023년 12월 6일
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:

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

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