geometryFromMesh
从网格创建2-D或3D几何形状
Syntax
描述
几何流行(
创建一个多域几何形状。这里,模型
,nodes
,元素
,ElementIDToRegionID
)ElementIDToRegionID
specifies the subdomain IDs for each element of the mesh.
例子
体积网格的几何形状
Import a tetrahedral mesh into a PDE model.
将四面体网眼装入工作空间。这tetmesh
file ships with your software. Put the data in the correct shape forgeometryFromMesh
。
loadtetmeshnodes = X'; elements = tet';
Create a PDE model and import the mesh into the model.
模型= createpde(); geometryFromMesh(model,nodes,elements);
查看几何图形和面部数字。
PDEGPLOT(模型,'FaceLabels','on','FaceAlpha',0.5)
几何形状Convex Hull
从点网格的凸壳创建一个几何块。
创建一个3-D网格。
[x, y, z] = meshgrid(-2:4:2);
Create the convex hull.
x = x(:);y = y(:);z = z(:);k = convhull(x,y,z);
将数据以正确的形状geometryFromMesh
。
nodes = [x'; y'; z'];元素= k';
创建PDE模型并导入网格。
模型= createpde(); geometryFromMesh(model,nodes,elements);
查看几何图形和面部数字。
PDEGPLOT(模型,'FaceLabels','on','FaceAlpha',0.5)
几何形状Alphashape
使用MATLAB创建3D几何形状Alphashape
function. First, create anAlphashape
带有圆柱孔的块的对象。然后将几何形状导入从Alphashape
boundary.
创建一个2D网格。
[xg,yg] = meshgrid(-3:0.25:3); xg = xg(:); yg = yg(:);
Create a unit disk. Remove all the mesh grid points that fall inside the unit disk, and include the unit disk points.
t = (pi/24:pi/24:2*pi)'; x = cos(t); y = sin(t); circShp = alphaShape(x,y,2); in = inShape(circShp,xg,yg); xg = [xg(~in); cos(t)]; yg = [yg(~in); sin(t)];
创建其余网格点的3-D副本,z
- 坐标范围从0到1。将点结合到一个Alphashape
目的。
zg = ones(numel(xg),1); xg = repmat(xg,5,1); yg = repmat(yg,5,1); zg = zg*(0:.25:1); zg = zg(:); shp = alphaShape(xg,yg,zg);
获得一个表面网格Alphashape
目的。
[元素,节点] = BoundareFacets(SHP);
将数据以正确的形状geometryFromMesh
。
nodes = nodes'; elements = elements';
创建PDE模型并导入表面网格。
模型= createpde(); geometryFromMesh(model,nodes,elements);
查看几何图形和面部数字。
PDEGPLOT(模型,'FaceLabels','on','FaceAlpha',0.5)
要在分析中使用几何形状,请创建一个音量网。
Generatemesh(model);
2-D Multidomain Geometry
Create a 2-D multidomain geometry from a mesh.
Load information about nodes, elements, and element-to-domain correspondence into your workspace. The fileMultidomainMesh2D
使用您的软件发货。
loadMultidomainMesh2D
Create a PDE model.
模型= createpde;
Import the mesh into the model.
几何流行(模型,nodes,elements,ElementIdToRegionId);
查看几何图形和面部数字。
PDEGPLOT(模型,'FaceLabels','on')
3-D多域几何形状
Create a 3-D multidomain geometry from a mesh.
Load information about nodes, elements, and element-to-domain correspondence into your workspace. The fileMultidomainMesh3D
使用您的软件发货。
loadMultidomainMesh3D
Create a PDE model.
模型= createpde;
Import the mesh into the model.
几何流行(模型,nodes,elements,ElementIdToRegionId);
查看几何图形和单元格数。
PDEGPLOT(模型,“牢房”,'on')
输入参数
模型
—Model object
pdemodel
object|这rmalModel
object|StructuralModel
object|ElectromagneticModel
object
Model object, specified as apdemodel
目的,这rmalModel
目的,StructuralModel
对象或ElectromagneticModel
目的。
例子:模型= createpde(3)
例子:ThermalModel = CreatePde('Thermal','Steadystate')
例子:structuralModel = createpde('structural','static-solid')
例子:emagmodel = createpde('electromagnetic','electrostatic')
nodes
—网状节点
matrix of real numbers
网状节点, specified as a matrix of real numbers. The matrix size is 2-by-Nnodes
对于二维案例和3 by-Nnodes
for a 3-D case.Nnodes
是the number of nodes in the mesh.
Nodej
hasx,y, 和z列中的坐标j
的nodes
。
Data Types:双倍的
元素
—Mesh elements
3-by-nelements
integer matrix|4乘nelements
integer matrix|6乘nelements
integer matrix|10-by-nelements
integer matrix
Mesh elements, specified as an integer matrix with 3, 4, 6, or 10 rows, andnelements
列,哪里nelements
是网格中的元素数。
Linear planar mesh or linear mesh on the geometry surface has size 3-by-
nelements
。Each column of元素
contains the indices of the triangle corner nodes for a surface element. In this case, the resulting geometry does not contain a full mesh. Create the mesh using theGeneratemesh
function.线性元素的大小为4乘
nelements
。Each column of元素
包含一个元素的四面体角节点的索引。几何表面上的二次平面网格或二次网格的尺寸为6 by-
nelements
。Each column of元素
contains the indices of the triangle corner nodes and edge centers for a surface element. In this case, the resulting geometry does not contain a full mesh. Create the mesh using theGeneratemesh
function.二次元素的尺寸为10厘米
nelements
。Each column of元素
包含四面体角节点和四面体边缘中点节点的索引。
有关线性和二次元素的节点编号的详细信息,请参见Mesh Data。
Data Types:双倍的
ElementIDToRegionID
—每个元素的域信息
vector of positive integers
每个网格元素的域信息,指定为正整数的向量。每个元素都是网格元素的几何区域的ID。该矢量的长度等于网格中元素的数量。
Data Types:双倍的
Output Arguments
G
- 几何学
handle to模型。Geometry
Geometry, returned as a handle to模型。Geometry
。This geometry is of classDiscreteGeometry Properties。
网
- 有限元网格
handle to模型。Mesh
有限元网格,作为手柄返回模型。Mesh
。
如果
元素
是3乘nelements
matrix representing a surface mesh, then网
是[]
。在这种情况下,使用该几何形状创建网格Generatemesh
function.如果
元素
是a matrix with more than three rows representing a volume mesh, then网
has the same nodes and elements as the inputs. You can get a different mesh for the geometry by using theGeneratemesh
function.
matlab命令
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择一个网站
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select:。
您还可以从以下列表中选择一个网站:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
美洲
- AméricaLatina(Español)
- 加拿大(英语)
- 美国(英语)