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:
Describing a pde model geometry that can have multiple domains
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
Antworten (0)
Siehe auch
Kategorien
Mehr zu Geometry and Mesh finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!