How to create a geometry consisting of a prism, with an inner inclined plane, for a diffusion pde problem?

1 次查看(过去 30 天)
For example, the nodes could be placed at (0, 0 ,0), (1, 0 ,0), (1, 1 ,0), (0, 1 ,0), (0, 0 ,1), (1, 0 ,1), (1, 1 ,1), (0, 1 ,1). The plane could go from the upper left edge to the lower right edge, so its nodes would be (0, 0 ,1), (0, 1 ,0), (1, 0, 0), (1, 1, 0).
Everytime I tried
model = createpde(); geometryFromMesh(model,nodes,elements); or importGeometry(model,'PrismAndPlane.stl');
I have gotten all kinds of error messages (no matter how I generated the nodes and elements), including
'The input mesh does not form a closed volume. This may be due to missing faces or gaps in the input.' and 'Failed to create geometry. The stl file is invalid, more than two facets share an edge.'
I cannot include specific code, because I have literally tried a dozen different solutions (alpha shapes, geometry from meshes, create and import stl files, etc). The only one that worked provided a double inner plane, which is not ok to solve a diffusion pde.
So take it as a quiz. Glory for the one who solves it!
Thanks in advance,
Gabriel
  5 个评论
Simone Galante
Simone Galante 2018-10-11
Hello Gabriel,
Have you been able to solve your problem? Have you found the method to merge your inner face F3 and F9? I have found a similar problem with the edges about two cyilindical solids that I show you in the attached immage file. Thanks in advance, Simone
Gabriel Madirolas
Gabriel Madirolas 2018-10-15
Hi Simone,
Unfortunately, I couldn't manage a solution to my problem. I think Matlab's pde is still not working smoothly enough with multi-region 3D geometries.
What I finally did is to write my own pde solver code, using finite differences method.
Gabriel Madirolas

请先登录,再进行评论。

采纳的回答

Konstantin Kovalev
Konstantin Kovalev 2019-6-18
Hello Gabriel,
Please find below a script that does the job. Feel free to comment back should you have any questions.
Best Regards,
Konstantin
close all
clear variables
% columns 5 and 6 belong to upper wedge only, 7 and 8 - lower
x = [0 0 1 1 1 1 0 0];
y = [0 1 0 1 0 1 0 1];
z = [1 1 0 0 1 1 0 0];
% create delaunay triangulation for upper wedge
w1 = delaunayTriangulation(x(1:6)',y(1:6)',z(1:6)');
% copy elements (the copy will be lower wedge)
e1 = w1.ConnectivityList;
e2 = e1;
% update nodes 5-6 with nodes 7-8 (lower elements are inverted, V<0)
e2(e2==5) = 7;
e2(e2==6) = 8;
% combine both wedges' elements
% (1st two nodes of lower elements are swapped to undo inversion)
e = [e1; e2(:,[2 1 3:end])]';
% domain IDs - elements 1-3 are upper wedge, 4-6 lower
d = [1 1 1 2 2 2]';
pdem = createpde;
g = geometryFromMesh(pdem, [x; y; z], e, d);
pdegplot(pdem,'FaceLabels','on','CellLabels','on','FaceAlpha',0.75);
return

更多回答(1 个)

Gabriel Madirolas
Hi Konstantin,
Sorry for the late reply. Thanks a lot for the code. It works nicely!
Best regards,
Gabriel

类别

Help CenterFile Exchange 中查找有关 Geometry and Mesh 的更多信息

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by