Main Content

fegeometry

Geometry object for finite element analysis

Since R2023a

Description

An fegeometry object contains a geometry for use in a finite element analysis with an femodel object.

Creation

Description

example

gm = fegeometry(geometry) creates an fegeometry object that you can use in a finite element analysis with an femodel object. Alternatively, you can assign a geometry directly to the Geometry property of femodel, for example, femodel.Geometry = geometry.

gm = fegeometry(geometry,MaxRelativeDeviation=d) controls the accuracy of the geometry import from a STEP file by specifying the relative sag.

gm = fegeometry(nodes,elements) creates an fegeometry object from a mesh defined by nodes and elements.

gm = fegeometry(nodes,elements,ElementIDToRegionID) creates a multidomain geometry. ElementIDToRegionID specifies the domain IDs for each element of the mesh.

Input Arguments

expand all

Geometry description, specified as one of these values:

  • String scalar or character vector that contains a path to an STL or STEP file. The path must end with the file extension ".stl", ".STL", ".stp", ".STP", ".step", ".STEP", or any combinations of uppercase and lowercase letters in this extension.

  • Decomposed geometry matrix or a handle to a geometry function. For details about a decomposed geometry matrix, see decsg. A geometry function must return the same result for the same input arguments in every function call. Thus, it must not contain functions and expressions designed to return a variety of results, such as random number generators.

  • DiscreteGeometry object. See DiscreteGeometry Properties for details.

  • AnalyticGeometry object. See AnalyticGeometry Properties for details.

Relative sag for importing a STEP geometry, specified as a number in the range [0.1, 10]. A relative sag is the ratio between the local absolute sag and the local mesh edge length. The absolute sag is the maximal gap between the mesh and the geometry.

Gap between the curved geometry edge and the straight mesh edge represents the local absolute sag.

Example: gm = fegeometry("AngleBlock.step",MaxRelativeDeviation=5)

Data Types: double

Mesh nodes, specified as an Nnodes-by-2 or Nnodes-by-3 matrix for a 2-D or 3-D geometry, respectively. Nnodes is the number of nodes in the mesh. Each row of the matrix contains x-, y-, and, if applicable, z- coordinates of one node.

Data Types: double

Mesh elements, specified as an integer matrix with Nelements rows and 3, 4, 6, or 10 columns, where Nelements is the number of elements in the mesh.

  • Linear planar mesh or linear mesh on the geometry surface has size Nelements-by-3. Each row of elements 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 the generateMesh function.

  • Linear elements have size Nelements-by-4. Each row of elements contains the indices of the tetrahedral corner nodes for an element.

  • Quadratic planar mesh or quadratic mesh on the geometry surface has size Nelements-by-6. Each row of elements 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 the generateMesh function.

  • Quadratic elements have size Nelements-by-10. Each row of elements contains the indices of the tetrahedral corner nodes and the tetrahedral edge midpoint nodes for an element.

For details on node numbering for linear and quadratic elements, see Mesh Data.

Data Types: double

Domain information for each mesh element, specified as a vector of positive integers. Each mesh element is an ID of a geometric region for an element of the mesh. The length of this vector equals the number of elements in the mesh.

Data Types: double

Properties

expand all

This property is read-only.

Number of geometry cells, returned as a nonnegative integer.

Data Types: double

This property is read-only.

Number of geometry faces, returned as a positive integer.

Data Types: double

This property is read-only.

Number of geometry edges, returned as a nonnegative integer.

Data Types: double

This property is read-only.

Number of geometry vertices, returned as a nonnegative integer.

Data Types: double

This property is read-only.

Coordinates of geometry vertices, returned as an N-by-2 or N-by-3 numeric matrix for a 2-D or 3-D geometry, respectively. Here, N is the number of vertices.

Data Types: double

Mesh for solution, specified as an FEMesh object. See FEMesh Properties for details.

Object Functions

addCellCombine two geometries by adding one inside a cell of another
addFaceFill void regions in 2-D and split cells in 3-D geometry
addVertexAdd vertex on geometry boundary
addVoidCreate void regions inside 3-D geometry
cellEdgesFind edges belonging to boundaries of specified cells
cellFacesFind faces belonging to specified cells
extrudeVertically extrude 2-D geometry or specified faces of 3-D geometry
faceEdgesFind edges belonging to specified faces
facesAttachedToEdgesFind faces attached to specified edges
nearestEdgeFind edges nearest to specified point
nearestFaceFind faces nearest to specified point
pdegplotPlot PDE geometry
pdemeshPlot PDE mesh
rotateRotate geometry
scaleScale geometry
translateTranslate geometry

Examples

collapse all

Create an fegeometry object from a DiscreteGeometry object by assigning it to an femodel object for a finite element analysis.

Create and plot a 3-D geometry consisting of three nested cuboids of the same height.

gm = multicuboid([2 3 5],[4 6 10],3);
pdegplot(gm,CellLabels="on",FaceAlpha=0.3)

Nested cuboids of the same height represented by cells C1, C2, and C3

Create an femodel object for solving a static structural problem and assign the geometry to the model.

model = femodel(AnalysisType="structuralStatic", ...
                Geometry=gm);
model.Geometry
model.Geometry

ans = 

  fegeometry with properties:

       NumFaces: 18
       NumEdges: 36
    NumVertices: 24
       NumCells: 3
       Vertices: [24×3 double]
           Mesh: []

Create an fegeometry object from an STL file representing a forearm link, and use it for a finite element analysis with an femodel object.

Create an femodel object for solving a static structural problem, and assign the geometry to the model.

model = femodel(AnalysisType="structuralStatic", ...
                Geometry="ForearmLink.stl");
model.Geometry
ans = 

  fegeometry with properties:

       NumFaces: 147
       NumEdges: 329
    NumVertices: 213
       NumCells: 1
       Vertices: [213×3 double]
           Mesh: []

Plot the geometry.

pdegplot(model,FaceAlpha=0.3)

Forearm link geometry plot

Create an fegeometry object from a function handle.

gm = fegeometry(@cardg)
gm = 

  fegeometry with properties:

       NumFaces: 1
       NumEdges: 4
    NumVertices: 4
       NumCells: 0
       Vertices: [4×2 double]
           Mesh: []

Plot the geometry with the edge labels.

pdegplot(gm,EdgeLabels="on");

Cardioid geometry plot with the edges labeled from E1 to E4

Create an fegeometry object from a geometry description matrix.

g = [3 4 0 1 1 0 0 0 1.0 1.0];
sf = 'S1'; 
ns = 'S1';
gm = fegeometry(decsg(g',sf,ns'))
gm = 

  fegeometry with properties:

       NumFaces: 1
       NumEdges: 4
    NumVertices: 4
       NumCells: 0
       Vertices: [4×2 double]
           Mesh: []

Plot the geometry with the edge labels.

pdegplot(gm,EdgeLabels="on");
xlim([-0.1 1.1])
ylim([-0.1 1.1])

Unit square with the edges labeled from E1 to E4

Version History

Introduced in R2023a