필터 지우기
필터 지우기

how to create a cylinder with minimal nodes and elements?

조회 수: 2 (최근 30일)
yonatan s
yonatan s 2017년 6월 12일
댓글: Ravi Kumar 2017년 6월 14일
hello,
im trying to create a solid cylinder to use in the pde toolbox, with radius and height of size 1.
i tried it in several ways with functions like multicylinder,cylinder and meshgrid, but the amount of nodes and elements is too big, of about 40,000-50,000, which causes my model to run very slow.
edit - i added some of the codes i tried:
gm=multicylinder (1,1);
model.Geometry=gm;
generateMesh(model);
----
[th,r,h]=meshgrid(linspace(0,2*pi,30),[0,1],[0,1]);
[x,y,z] = pol2cart(th,r,h);
shp = alphaShape(x(:),y(:),z(:),2.5);
% plot(shp);
% applying the geometry to the model
[elements,nodes] = boundaryFacets(shp);
nodes = nodes';
elements = elements';
geometryFromMesh(model,nodes,elements);
% pdegplot(model,'FaceLabels','on','FaceAlpha',1);
% Generate the mesh
generateMesh(model);
---
[x,y,z]=cylinder;
shp = alphaShape(x(:),y(:),z(:));
% plot(shp);
% applying the geometry to the model
[elements,nodes] = boundaryFacets(shp);
nodes = nodes';
elements = elements';
geometryFromMesh(model,nodes,elements);
pdegplot(model,'FaceLabels','on','FaceAlpha',1);
% Generate the mesh
generateMesh(model);
is there a better way? thank you
  댓글 수: 3
yonatan s
yonatan s 2017년 6월 13일
well there isn't much to see, since setting up the geometry is the first step when using the pde toolbox.
KSSV
KSSV 2017년 6월 13일
Why don't you post your code which generates your cylinder?

댓글을 달려면 로그인하십시오.

답변 (1개)

Ravi Kumar
Ravi Kumar 2017년 6월 13일
You can use 'Hmax' parameter to set the target maximum element size, as explained in this documentation page for generateMesh.
For example,
model = createpde;
gm=multicylinder (1,1);
model.Geometry=gm;
generateMesh(model,'Hmax',0.2);
gives a coarse mesh with less than 3000 elements. Note that the discretization error would increase as you coarsen the mesh, particularly for geometries with curved faces/edges.
  댓글 수: 2
yonatan s
yonatan s 2017년 6월 13일
thank you, but this mesh is too coarse for me
Ravi Kumar
Ravi Kumar 2017년 6월 14일
I did not suggest you should use the mesh I provided. I gave an example and link to documentation, using which you can obtain desired mesh. You need to try and find the right set of parameters that you can specify in generateMesh function call.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Geometry and Mesh에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by