Export mesh to Comsol using iso2mesh
조회 수: 10 (최근 30일)
이전 댓글 표시
Hello,
I am trying to transfer a geometry I created in Matlab into a FE program. For this application I found the toolbox ISO2MESH. I'm able to export the provided examples and import them into Comsol. Since there were some issues with my application, I tried it with a smaller but similar example (provided by https://de.mathworks.com/help/matlab/ref/tetramesh.html) and encountered difficulties:
d = [-1 1];
[x,y,z] = meshgrid(d,d,d); % a cube
x = [x(:);0];
y = [y(:);0];
z = [z(:);0];
DT = delaunayTriangulation(x,y,z);
tetramesh(DT);
camorbit(20,0)
M=meshgrid(x,y,z);% change to volumetric binary image
%%iso2mesh
[node,elem,face]=vol2mesh(M,1:size(M,1),1:size(M,2),1:size(M,3),0.1,2,1);
savemphtxt(node,face,elem,'test_mesh_export_comsol.mphtxt');
This code compiles with the warning "You are meshing the surface with sub-pixel size. If this is not your intent, please check if you set "opt.radbound" correctly for the default meshing method. "
I get a result readable by Comsol, but it does not share the dimensions of the original and is too finely meshed (see below).
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/378836/image.png)
I change the parameters in the line
[node,elem,face]=vol2mesh(M,1:size(M,1),1:size(M,2),1:size(M,3),2,2,1);
so I don't get a warning anymore, the imported result is very bad (see below).
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/378841/image.jpeg)
I would be happy if someone has an idea what I am doing wrong and how I can export the net cleanly.
댓글 수: 1
Roya
2023년 1월 6일
편집: Roya
2023년 1월 6일
Hi Kim
in comsol you can import your mesh from component > mesh > import, after that from mesh tab click on create geometry from mesh , it makes new geometry in new component ,then you could remesh it from mesh tab > build >mesh2 >settings > element size and choose appropriate mesh size from extremely fine to extremely coarse.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!