- 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 views (last 30 days)
Show older comments
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 Comments
Answers (2)
Konstantin Kovalev
on 16 May 2019
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 Comments
Coleman Barrie
on 16 May 2019
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
on 16 May 2019
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
on 15 May 2019
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 Comments
qi wang
on 9 Jul 2023
Can you please tell me what is fname1 and how to make it? It seems that fname includes the information of contour.
See Also
Categories
Find more on Geometry and Mesh in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!