Export mesh to Comsol using iso2mesh

7 次查看(过去 30 天)
Kim
Kim 2020-10-13
编辑: Roya 2023-1-6
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).
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).
I would be happy if someone has an idea what I am doing wrong and how I can export the net cleanly.
  1 个评论
Roya
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 个)

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by