- Build a geometry description matrix using the polygon data
- Use decsg function to construct decomposed geometry matrix
- Use geometryFromEdges function to add geometry to PDE model container
How to create a planar STL in PDE Modeler?
13 次查看(过去 30 天)
显示 更早的评论
Is it possible to create a 2D planar STL file as described in PDE Modeler documentation? The general opinion claims a 2D STL is not possible due to the general purpose for 3D printing. If possible, this would allow import of a complex geometry and creation of a 2D finite element model that is far less computationally intensive than the 3D counterpart.
Please see this link or image attached. Mathworks claims this exists.
This is pivotal for my graduate research of creating a finite element groundwater model. Any support is greatly appreciated! If a 2D stl is not possible, is it feasible to import xy coordinates and integrate a 2D geometry to PDE Modeler another way? I have additional experience with and access to ArcGIS, Excel, AutoCAD.
Drawing the domain in the PDE GUI would jeopardize the accuracy of the geometry and aesthetics, but this seems to be the best option for 2D model creation and subdomains for variable parameter input.
0 个评论
回答(2 个)
Konstantin Kovalev
2019-5-16
If input data consists of polygons specified as arrays of corner points coordinates, you can use the following approach to create geometry for pde model:
Here is a code example that constructs geometry from 4 simple polygons:
% polygon 1
x1 = [0 1 1 0];
y1 = [0 0 1 1];
% polygon 2
x2 = [1 2 2 1];
y2 = [0 0 1 1];
% polygon 3
x3 = [0.5 1.5 1.5 0.5];
y3 = [0.5 0.5 1.5 1.5];
% polygon 4
x4 = [0.2 0.4 0.3];
y4 = [0.2 0.2 0.4];
% build geometry description matrix (each column describes a shape)
p1 = [2 4 x1 y1];
p2 = [2 4 x2 y2];
p3 = [2 4 x3 y3];
p4 = [2 3 x4 y4 0 0];
gd = [p1' p2' p3' p4'];
figure
hold on
plot(polyshape(x1,y1));
plot(polyshape(x2,y2));
plot(polyshape(x3,y3));
plot(polyshape(x4,y4));
% example 1: combine P1, P2, P3, P4
d = decsg(gd);
pdem = createpde;
geometryFromEdges(pdem,d);
figure
pdegplot(pdem,'EdgeLabels','on','FaceLabels','on');
% example 2: combine P1, P2, P3 and leave void P4
d = decsg(gd,'P1-P4+P2+P3',char('P1','P2','P3','P4')');
pdem = createpde;
geometryFromEdges(pdem,d);
figure
pdegplot(pdem,'EdgeLabels','on','FaceLabels','on');
2 个评论
Coleman Barrie
2019-5-16
Perfect! This is exactly what I needed to hear, thank you very much. I figured out how to use descg earlier today and am now working towards building an adaptive mesh.
The next roadblock I forsee is recreating the fairly complex initial conditions of the aquifer I'm attempting to model. I have the data for "Pressure head of the aquifer" and need to figure out how to explain contours with functions in xy or just spatial input. Where there is a will there's a way.
Thank you!
Coleman Barrie
2019-5-16
for the record I exported the geometry information after the GUI was pulled up. I also did the same for boundary conditions. The method provided by Konstantin seems more streamlined.
Steven Lord
2019-5-15
You can look at the PlateHolePlanar.stl file being imported by that example.
edit PlateHolePlanar.stl
It looks to me like the key points that make this "2-D" are that the Z coordinates of each vertex are 0 and the facet normals point directly in the +Z direction.
Can you say a little more about what you mean by “subdomains for variable parameter input”?
2 个评论
qi wang
2023-7-9
Can you please tell me what is fname1 and how to make it? It seems that fname includes the information of contour.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Geometry and Mesh 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!