フィルターのクリア

Extrude 2D Domain into 3D

9 ビュー (過去 30 日間)
Paul Safier
Paul Safier 2023 年 12 月 6 日
コメント済み: Paul Safier 2023 年 12 月 13 日
I am having trouble extruding a 2D domain into a 3D domain for use in the PDE Toolbox. Perhaps I cannot use decsg to create the initial 2D domain, but, if not, how can I?
R1 = [3,4,-1,1,1,-1,-.4,-.4,.4,.4]';
C1 = [1,.5,0,.2]';
C1 = [C1;zeros(length(R1)-length(C1),1)];
C2 = C1;
C2(2,1) = -0.5;
geom = [R1,C1,C2];
ns = (char('R1','C1','C2'))';
% Set formula
sf = 'R1 + C1 + C2';
% Create geometry
gd = decsg(geom,sf,ns);
% View geometry
pdegplot(gd, ...
"FaceLabels","on")
xlim([-1.1 1.1])
axis equal
h = extrude(gd,2,10); % This does not work. How can I extrude this 2D domain into 3D. I want to extrude only face 2...
The error is this:
Undefined function 'extrude' for input arguments of type 'double'.
The first image I uploaded is the original 2D domain. The second image is what I want my final 3D domain to look like. Any suggestions?
Thanks.
This is what I need:

回答 (1 件)

Aiswarya
Aiswarya 2023 年 12 月 13 日
Hi,
I understand that you want to extrude a 2D domain into a 3D domain. You are trying to extrude only the second face by a height of 10.
Firstly, you can only extrude a particular face of a 3D geometry, not 2D geometry (as mentioned in https://www.mathworks.com/help/pde/ug/pde.discretegeometry.extrude.html#description) . You can first extrude your 2D geometry to 3D by using extrude(g, height) and then extrude 2nd face of the resultant 3D geometry by using (g,2,height).
Also the input of "extrude" can be only of these types: fegeometry, DiscreteGeometry or AnalyticGeometry object (https://www.mathworks.com/help/pde/ug/pde.discretegeometry.extrude.html#mw_eb61fe69-2246-44c8-91d4-b5be3e4cff40). So you may use the function 'geometryFromEdges' to convert it to an Analytical Geometry object( https://www.mathworks.com/help/pde/ug/pde.pdemodel.geometryfromedges.html )
You may refer to the below code and make adjustments in the face number to obtain your desired geometry:
R1 = [3,4,-1,1,1,-1,-.4,-.4,.4,.4]';
C1 = [1,.5,0,.2]';
C1 = [C1;zeros(length(R1)-length(C1),1)];
C2 = C1;
C2(2,1) = -0.5;
geom = [R1,C1,C2];
ns = (char('R1','C1','C2'))';
% Set formula
sf = 'R1 + C1 + C2';
% Create geometry
gd = decsg(geom,sf,ns);
% View geometry
pdegplot(gd,"FaceLabels","on");
xlim([-1.1 1.1]);
axis equal;
model = createpde("thermal","transient");
ge = geometryFromEdges(model,gd);
% 2D -> 3D extrusion
gd1 = extrude(ge,0.5);
figure
pdegplot(gd1,"FaceLabels","on")
% 3D face extrusion
gd2 = extrude(gd1,2,10);
figure
pdegplot(gd2,"FaceLabels","on","FaceAlpha",.5)
Hope this helps!
  1 件のコメント
Paul Safier
Paul Safier 2023 年 12 月 13 日
Hi @Aiswarya . Thanks for taking the time to look at this!
My issue with the final result is that there are now extra cells and faces that need to be removed. The final geometry looks quite a bit different from what I need. Attached is what the geometry looks like after your code suggestions. The original post shows what the final geometry needs to look like. Can I have the circular faces only on the bottom of the geometry? Can I delete the other faces and cell? I do not see a function in Matlab to remove faces...
Note that it seems even though we asked to extrude only one face in the second call to extrude(), we still have the circular faces getting extruded...
This is what the final geometry (ideally) would look like. Note that the circular faces are only on the bottom of the geometry. Is this possible?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGeometry and Mesh についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by