You are on page 1of 19

Inspecting Meshes in

COMSOL Multiphysics®
Hanna Gothäll
Product Specialist
Geometry and Mesh
COMSOL
Agenda

▪ Meshing in COMSOL Multiphysics®


▪ Mesh element quality and usability
▪ Resolving the geometry
▪ Demo
▪ Q&A
Why Do We Need a Mesh?

▪ FEM is based on discretization of the geometry into small units called mesh elements
▪ The finite element mesh serves two purposes:
Represents the solution field
Represents the geometry

▪ Using more mesh elements leads to:


More accurate approximation and solution
Longer solution time and more required memory

▪ In terms of numerical stability, the mesh should result in a well-conditioned stiffness


matrix
Largely depends on size and shape of the mesh elements (mesh quality is a good indication)
Meshing in COMSOL Multiphysics®

▪ The mesh operation discretizes the domains into domain mesh elements
Their faces, edges, and corners are called mesh faces, mesh edges, and mesh vertices,
respectively

▪ The boundaries defined in the geometry are discretized into mesh elements, referred
to as boundary elements
Default: Must conform with the mesh elements of the adjacent domains

▪ For curved boundaries, the boundary elements represent an approximation of the


original geometry
▪ For 3D meshing, platforms handle floating-point operations differently
Can result in slight differences between identical model files that are generated on two
different computers
2D and 3D Elements

Triangles Tetrahedrons Hexahedrons

Quadrilaterals Pyramids Prisms


Handling Small Features

▪ Built-in detection for small features and


narrow regions in a geometry
▪ Automatic element size adjustment to small
features, narrow regions, and curved
boundaries
▪ Detected edges and faces are highlighted in
the geometry and can be used as input for
further CAD defeaturing or virtual geometry
operations
Mesh Statistics

▪ Quick overview of the mesh


▪ Choice of geometric entities, quality
measure, and element type
▪ Minimum and average quality
▪ Histogram plot of element quality
Mesh Plot

▪ Plot various element types separately


▪ Color elements according to quality
▪ Show elements based on logical
expressions
▪ Shrink elements for better visualization

Element color: quality Logical expression: x>0 Criterion: worst quality


Fraction: 0.03
Mesh Element Quality

▪ Value between 0 and 1


▪ Quality = 1 if element is
equilateral/equiangular
▪ Measures the regularity of the mesh
elements’ shape
▪ Available quality measures and the
corresponding variable names
Skewness (qualskewness)
Maximum angle (qualmaxangle)
Volume versus circumradius (qual)
Volume versus length (qualvollength)
Condition number (qualcondition)
Growth rate (qualgrowth)
Inverted Mesh Elements
3

▪ Indicated by a negative element quality


measure
▪ An inverted mesh element is wrapped inside
out or has zero volume
Rarely happens when generating meshes
Can happen when modifying an existing mesh
• Boundary layer meshing 1 2
• Moving mesh
Imported meshes: Not following the
numbering convention leads to inverted 1 2
elements
Inverted element
▪ Visualize inverted mesh elements
3
Mesh plot using logical expression: qual < eps
How Many Elements Do We Need?

▪ Rarely known at the beginning


▪ Fine enough to represent the geometry adequately
▪ Fine enough to resolve all gradients of the solution

Solution Mesh convergence

Control «probe»

Number of elements
When Is a Mesh Usable?

▪ Low mesh element quality can lead to inaccurate results


Aim for a reasonably high average element quality and minimum
element quality > 0.1 (3D)
Use mesh warnings as guidance to improve the overall quality

▪ Solve and evaluate the results


Leave warnings when the quality of the mesh is good enough

▪ Perform a mesh convergence study


Re-solve the model on progressively finer meshes
Compare the results

H-bend waveguide. The


coarse mesh doesn’t resolve
Gain confidence in the accuracy of your model the solution (upper) while a
fine mesh does (lower).
Resolving the Geometry: The Geometry Shape Order

▪ Available in the Settings for the Component


▪ Default: Automatic
The highest discretization order that all participating
physics interfaces can agree on
Quadratic used in most cases

▪ A higher geometry shape order creates a more accurate


representation of smoothly curved boundaries
▪ Manually increasing the geometry shape order above the
discretization order does not improve solution accuracy
▪ Manually lowering the geometry shape order can make a
model more stable at the cost of geometric resolution
Robust Generation of Curved Elements

▪ The solver automatically curves interior domain elements


to avoid inverting curved elements along the boundary
Also improves quality of domain elements

▪ Available with COMSOL Multiphysics version 5.5


▪ Enable this setting on the Component when opening
models saved in previous versions
Deviation of Curved Elements from Geometry

▪ Plot geomapproxdist
Maximum distance to the geometry from a node point in the element
Useful if the solver log reports that node points of curved elements have been moved to
avoid inverting curved elements

▪ Allow for smaller elements on curved boundaries for more accurate representation

The color indicates how much the node points deviate from the After refining the mesh, the node points lie on the geometry. A Full geometry where the rectangle
geometry. The wireframe shows the relatively coarse mesh. single colored plot, here blue, indicates zero deviation. represents the zoomed in part.
Linearized Geometry Shape

▪ Automatic linearization of curved


elements to avoid element inversion if:
Using COMSOL® versions before 5.5
When the setting Avoid inverted
elements by curving interior domain
elements is turned off

▪ Plot linearizedelem if the Messages log


reports linear geometry shape order is
used to avoid inverting curved elements

Plot of linearizedelem. True if


element has been linearized (red).
Poll Question

▪ What is the typical source of the geometries for your simulations?


Created with drawing tools in COMSOL
CAD files (STEP, IGES, CATIA®, NX™, SOLIDWORKS®, etc.)
Surface mesh data files (3MF, PLY, STL, VRML)
Mesh files (NASTRAN®, COMSOL®)
ECAD files (GDS, ODB++, IPC-2581)
Other, please specify in comments

Trademarks are the property of their respective owners. See www.comsol.com/tm. Support for implementation of the ODB++ Format was provided by Mentor
Graphics Corporation pursuant to the ODB++ Solutions Development Partnership General Terms and Conditions (http://www.odb-sa.com).
Online Resources

▪ Blog posts:
How to Inspect Your Mesh in COMSOL Multiphysics®
How to Automatically Remove Small Details in Your Model Geometry
Best Practices for Meshing Domains with Different Size Settings

▪ Knowledge Base:
Performing a Mesh Refinement Study

▪ Related tutorials in the Application Gallery:


Free Tetrahedral Meshing of a Piston Geometry
Swept Mesh of a Bracket Geometry
Using Meshing Sequences
Virtual Operation on a Wheel Rim Geometry
Further Resources
for Inspiration
comsol.com

You might also like