ToElementMesh
ToElementMesh[r]
generates an ElementMesh object from a region r.
ToElementMesh[r,{{xmin,xmax},…}]
generates an ElementMesh object from a region r restricted to the bounding box .
ToElementMesh[rules]
generates an ElementMesh object from a set of rules specifying coordinates and elements.
ToElementMesh[emesh]
generates a new ElementMesh object from an existing ElementMesh, MeshRegion, or BoundaryMeshRegion.
更多信息和选项
- ToElementMesh[r] generates an ElementMesh object that approximates a possibly symbolic region r.
- The specification for regions r includes objects described by geometric regions and ImplicitRegion.
- The region r should be a constant region for which ConstantRegionQ gives True.
- To generate an approximation to the region r, ToElementMesh first calls ToBoundaryMesh.
- In ToElementMesh[rules], the following rules should be given in this order:
-
"Coordinates"->{c1,c2,…} required to specify the coordinates to be c1, c2, … "MeshElements"->{e1,…} required to specify the elements in the mesh to be e1, … "BoundaryElements"->{b1,…} optionally specify the boundary elements in the mesh to be b1, … "PointElements"->{p1,…} optionally specify the point elements in the mesh to be p1, … - For a 1D element mesh, "MeshElements" are LineElement. "BoundaryElements" and "PointElements" are, if specified, PointElement.
- For a 2D element mesh, "MeshElements" can be TriangleElement and QuadElement. "BoundaryElements", if specified, are LineElement, and "PointElements" are PointElement.
- For a 3D element mesh, "MeshElements" can be TetrahedronElement or HexahedronElement. "BoundaryElements", if specified, are TriangleElement and QuadElement, and "PointElements" are PointElement.
- ToElementMesh has the same options as ToBoundaryMesh, with the following additions:
-
"CheckQuality" Automatic compute a quality assessment "ElementMeshGenerator" Automatic function to generate an ElementMesh object from a boundary ElementMesh object "ImproveBoundaryPosition" Automatic improve the position of the boundary nodes "MeshElementBlocks" 1 number of blocks of mesh elements "MeshElementConstraint" Automatic additional constraints for mesh elements "MeshElementType" Automatic element type used to mesh input "MeshOrder" Automatic order of the element mesh MeshQualityGoal Automatic specify a mesh element quality goal MeshRefinementFunction Automatic control element refinement in 2D and 3D "NodeReordering" Automatic reorder nodes to generate minimal bandwidth matrices "SteinerPoints" Automatic control the insertion of Steiner points "RegionMarker" None specify region markers - ToElementMesh[emesh,opts] may be used to modify an ElementMesh object emesh in various ways by specifying any of the options for ToElementMesh.
- If ToElementMesh cannot generate an ElementMesh, then $Failed is returned.
- Invoking ToElementMesh on an EmptyRegion will return an EmptyRegion.
- Options given to ToElementMesh can be given to NDSolve by specifying "MeshOptions". »
- Setting options for ToElementMesh from NDSolve and related functions is explained in NDSolve Finite Element Options.
范例
打开所有单元关闭所有单元基本范例 (4)
Scope (29)
Generate a mesh in the region between two circles:
Generate a mesh in the region between two circles using a BooleanRegion:
Convert an ImplicitRegion with an explicit bounding box:
Convert an ImplicitRegion computed from a RegionDistance with an explicit bounding box:
Convert a GraphicsComplex to an element mesh:
Convert a TransformedRegion to an element mesh:
Convert a 3D Sphere to an element mesh:
Convert a 3D GraphicsComplex to an element mesh:
Create a mesh from a 3D ImplicitRegion:
Create a mesh from a 3D BooleanRegion:
Convert a 3D TransformedRegion to an element mesh:
Create an element mesh from four coordinates and two elements:
For a set of points, ToElementMesh will return a Delaunay triangulation:
1D Line Element Meshes (3)
Create a 1D ElementMesh with region holes from an ImplicitRegion:
Create an ElementMeshRegionProduct from a 1D ElementMesh :
2D Triangle Element Meshes (2)
Create a triangle element mesh:
Create an ElementMeshRegionProduct from a 2D ElementMesh and a 1D ElementMesh:
2D Quad Element Meshes (2)
3D Tetrahedron Element Meshes (1)
Region Markers (1)
Region marker are useful to specify multiple materials in a region and are explained further in the section Markers in the Element Mesh Generation.
Boundary Markers (1)
Boundary markers are useful to specify NeumannValue on a region boundary and are explained further in the section Markers in the Element Mesh Generation.
Point Markers (1)
Point markers are useful to specify DirichletCondition on a region boundary and are explained further in the section Markers in the Element Mesh Generation.
Options (40)
"BoundaryMarkerFunction" (2)
Boundary markers are useful to specify NeumannValue on a region boundary and are explained further in the section Markers in the Element Mesh Generation.
Compute integer markers for edges depending on the coordinates of the edge elements:
Inspect the boundary elements:
If "PointElementMarkers" are also computed, those are accessible as the second argument in the function given to "BoundaryMarkerFunction".
"BoundaryMeshGenerator" (2)
The "Continuation" method uses a curve continuation method that can in many cases resolve corners, cusps, and sharp changes quite well:
The "RegionPlot" method is based on improving output from RegionPlot and can sometimes be faster:
More information on the "BoundaryMeshGenerator" option can be found on the ToBoundaryMesh reference page.
The "OpenCascade" boundary mesh generator is well suited for 3D BooleanRegion expressions consisting of Graphics3D primitives.
Use "OpenCascade" as a boundary mesh generator:
Generate colors for the boundary markers:
Visualize the element mesh with highlighted boundary markers:
"ElementMeshGenerator" (1)
Replace the internal mesh generator with a custom mesh generator:
The numerical region given to the custom mesh generators will contain a "BoundaryMesh". If the interface to the external mesh generator does not need a boundary mesh representation because the mesh generator interface works with a symbolic representation the generation of the boundary mesh can be avoided by setting "BoundaryMeshGenerator"->None.
"ImproveBoundaryPosition" (1)
Approximation of an ImplicitRegion is generally not exact. The "ImproveBoundaryPosition" option helps to improve the position of boundary nodes:
The sum of the squares of the boundary nodes is not necessarily all at value 1:
Automatic improvement is the default in 2D, and the results are better:
When the "ImproveBoundaryPosition" option is set to False, quadratic elements will not have their middle nodes on the boundary of a curved part of the region.
"IncludePoints" (2)
Specify a circle of additional points:
Create a mesh with the include points:
Points added with "IncludePoints" will be addressable with DirichletCondition. Additionally, if the predicate in DirichletCondition is True, then the boundary condition will take effect at the include points.
"MaxBoundaryCellMeasure" (2)
"MaxCellMeasure" (4)
With MaxCellMeasure->m, a cell size is chosen and a boundary cell size is set to be appropriate for good-quality cells in the embedding dimension:
Find the maximum mesh element area:
Set a smaller max cell measure:
Find the maximum mesh element area:
The max cell measure targets linear elements. In the case of a higher-order mesh for a curved boundary, the actual cell measure may be higher.
A specific length can be specified using MaxCellMeasure->{"Length"->len}:
If a specific length and area are specified using MaxCellMeasure->{"Length"->len,"Area"->area}, the more stringent requirement is satisfied:
"MeshElementBlocks" (1)
"MeshElementConstraint" (2)
For two-dimensional meshes based on TriangleElement, a minimum triangle angle can be specified via the "MeshElementConstraint" option:
The minimum angle specified must be smaller then 33 degrees. Theoretically, the algorithm is guaranteed to terminate for minimum angles smaller than 22.7 degrees, but in practice it often succeeds for minimum angles up to 33 degrees.
For three-dimensional TetrahedronElement meshes, a minimum ratio of the tetrahedral radius to edge length can be specified via the "MeshElementConstraint" option:
The radius-edge ratio must be larger than . Theoretically, the algorithm is guaranteed to terminate for a radius-edge ratio of 2, but in practice it often succeeds for radius-edge ratios down to .
"MeshElementType" (1)
"MeshOrder" (1)
Create a second-order element mesh for a region:
Integrate over the mesh and assess the accuracy of the integration:
Mesh the same region with a first-order mesh:
Integrate over the mesh and assess the accuracy of the integration:
More information about the "MeshOrder" option can be found in this section of the Element Mesh Generation tutorial and this section of the Element Mesh Generation tutorial.
"MeshQualityGoal" (1)
"MeshRefinementFunction" (9)
Create a function that returns True if a specific 2D triangle element needs to be refined:
Create a full mesh of the boundary mesh with the refinement function:
Compare to a mesh generated without refinement:
Create a compiled function that returns True if a specific 2D triangle element needs to be refined:
Create a mesh of a disk with the refinement function:
Create a gradual refinement toward the center:
Create a gradual refinement toward the boundary:
Create a refinement in a subregion:
Visualize the mesh with the refinement contour:
Use an image as a refinement function:
Create a distance transform of that image:
Visualize the distance transform of the image:
Create an interpolation function from the image distance transform:
Create a compiled refinement function calling the interpolation function:
Create a triangle mesh with a given refinement:
Create a function that returns True if a specific 2D triangle element needs to be refined:
Create a compiled function that returns True or False :
Create a full mesh of the boundary mesh with the compiled refinement function:
Create a compiled function that returns True if a specific 3D tetrahedron element needs to be refined:
Create a full mesh of the boundary mesh with the refinement function:
In 1D use DiscretizeRegion to do the refinement:
"NodeReordering" (2)
Create an ElementMesh from a region:
Visualize the incidences of the mesh elements:
Create a mesh from the same region with node reordering:
The pattern of the incidences is much more organized:
A function for the node reordering can be provided:
"NodeReordering" is also known as matrix bandwidth reduction.
"PointMarkerFunction" (1)
Point markers are useful to specify DirichletCondition on a region boundary and are explained further in the section Markers in the Element Mesh Generation.
Compute integer markers for edges depending on the coordinates of the edge nodes:
Create an element mesh with the point markers:
Inspect the boundary elements:
The point marker values of the mid-side nodes for second-order meshes are derived from the boundary element markers. Since none are given here, the values are arbitrary:
If "BoundaryMarkerFunction" is also computed, middle nodes will have values derived from the boundary element markers:
"PointMarkers" (1)
Point markers are useful to specify DirichletCondition on a region boundary and are explained further in the section Markers in the Element Mesh Generation.
The way point markers are set up in a mesh can be done in different ways. One possible option is to derive point markers from boundary markers.
Mesh the region and deduce the point markers from the boundary markers:
Select from which surfaces the point markers should be constructed:
Visualize the points with the selected point marker:
Find the intersection such that only points connected to all surfaces are considered. Boundary element marker ID 7 is the large cylinder body surface:
"RegionHoles" (4)
Create a boundary mesh with an internal region:
Create a full mesh from the boundary mesh:
Create a full mesh from the boundary mesh, with the interior specified as a region hole:
Create an element mesh with a hole in the middle:
Mesh the region, including the hole:
Mesh the region without the hole by explicitly giving a coordinate in the region that is a hole:
Create and visualize a region with holes:
Generate a full mesh from the boundary mesh:
Specify a region hole and a region marker:
Visualize the boundary mesh and a point inside the interior box:
"RegionMarker" (2)
The boundary element containing {1/2,3/4} should use the marker 1, and the region containing {1/2,1/4} should use the marker 2:
Additionally, a refinement parameter for the region with marker 1 is given to the markers:
Create the full element mesh with subregions inside that follow different refinements:
Properties & Relations (5)
An ElementMesh can be part of an InterpolatingFunction returned by NDSolve:
Pass an ElementMesh to NDSolve:
Pass an ElementMesh to NDEigensystem:
Pass options for ToElementMesh to NDSolve to solve a stationary PDE:
Inspect the mesh used to solve the equation:
Pass options for ToElementMesh to NDSolve to solve a time-dependent PDE:
Possible Issues (10)
If the input symbolic region is unbounded, a default bounding box from is assumed in each space direction:
By specifying an explicit bounding box, the default can be overridden:
Some features of the region may be too small to be represented:
Specifying a smaller boundary size may help:
An ImplicitRegion must not have unspecified symbolic parameters:
If the bounding box intersects with the region specification, low-quality or wrong meshes may result:
Possibly enlarging the bounding box is an option:
The mesh elements in an ElementMesh need to be of the same order:
The element incidents must be given in counterclockwise order:
Mesh elements in an element mesh may not intersect:
Also, combinations of clockwise ordering and self-intersection are detected:
A conversion of a MeshRegion to an ElementMesh may not always be done in a direct mesh conversion:
The reason for this is that ToElementMesh needs to be able to respect mesh options given to it. It is not possible to deduce parameters that were used to generate a MeshRegion and check if ToElementMesh options are satisfied. It may be possible to do a direct conversion of the MeshRegion to an ElementMesh:
The arguments to ToElementMesh are specified as rules and need to be given in the correct order: "Coordinates", "MeshElements" and optionally "BoundaryElements" and "PointElements":
Neat Examples (2)
To convert an image to an element mesh, first the image is converted to a distance function:
The image data is extracted and converted into an interpolation function:
Convert the interpolation function to an element mesh:
Convert the orbiter of the Space Shuttle to an ElementMesh:
文本
Wolfram Research (2014),ToElementMesh,Wolfram 语言函数,https://reference.wolfram.com/language/FEMDocumentation/ref/ToElementMesh.html (更新于 2021 年).
CMS
Wolfram 语言. 2014. "ToElementMesh." Wolfram 语言与系统参考资料中心. Wolfram Research. 最新版本 2021. https://reference.wolfram.com/language/FEMDocumentation/ref/ToElementMesh.html.
APA
Wolfram 语言. (2014). ToElementMesh. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/FEMDocumentation/ref/ToElementMesh.html 年