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

조회 수: 2 (최근 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
Gabriel Madirolas 2019년 9월 2일
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