Skip to main content

Mesh optimization in Treble SDK

Mesh optimization

The volumetric meshing procedure used in the Treble engine is highly optimized for generating both accurate and optimized meshes for time domain calculations used in the Treble engine.

The Treble engine supports both interior holes in the mesh, corresponding to internal volumes, as well as interior surfaces in the mesh, corresponding to interior open surfaces. These will simply be resolved as interior boundary elements, where the boundary conditions assigned to the surface will be active on both sides of the boundary.

When modelling acoustics, the domain of interest is very often the interior of a space that is filled with a fluid, such as air. Therefore, the tetrahedral mesh quite often consists of a rather large interior volume, where tetrahedrons are mostly connected to other tetrahedrons. However, at the boundaries of the domain, there are "open" triangular surfaces, which represent the connection between the air and the surfaces of the space. These surfaces are the "boundary elements" of the volumetric mesh, on which material properties are applied.

The size and the shape of the elements matter both for the computational accuracy and efficiency of the calculation. Since the Treble engine solves the wave equation in the time domain, there are generally 3 important important metrics to have in mind when meshes are created:

  1. The average and maximum element edge length (from corner to corner).
  2. The total number of elements.
  3. The smallest height of an element (from base to tip).

Average edge length in tetrahedrons

The general sizing of the mesh is measured by the edge length of the elements in the mesh. The edge size of the tetrahedrons governs the acoustic response maximum frequency that can be computed from the mesh, following a linear correlation between the wavelength and the edge length. While the Treble engine takes care of choosing the right mesh sizing, it is still important to know for each doubling of frequency there will be an 8-fold increase in the number of tetrahedrons, since the edge length is halved in 3 dimensions.

Since it isn't possible to fill a domain with regular tetrahedrons (all edges with the same length), tetrahedrons generally have non-uniform edge sizes throughout the mesh.

The mesher used in the Treble engine is optimized to generate a tight distribution of edge lengths, as the longest edge length in the mesh governs the upper frequency limit.

Due to the non-uniform distribution of the mesh edge lengths, the cutoff between the valid and invalid frequency range and dispersion can accumulate at the frequencies where the mesh is not valid.

The Treble engine ensures that the mesh sizing and distribution always produces a valid response.

Number of elements

The total number of elements governs how much computation needs to be performed to compute one timestep in the simulation. As noted above, the number of elements scales quite dramatically with the frequency, but the number of elements will also scale linearly with the volume of the domain. The number of elements generally affects the computation time in a linear fashion: twice the number of elements requires twice as much computational effort.

Timestep and smallest tetrahedron height

The last, and probably most important, detail to consider is the relationship between time-step and computational stability. The stability of the computation is approximately derived from the sampling rate of the simulation and the smallest height of any tetrahedron in the mesh. The smallest height of a tetrahedron is measured from the base plane (side with the largest area) to the tip of the tetrahedron.

This means that the computational efficiency is very sensitive to small features and narrow gaps between objects in the mesh, in which almost flat tetrahedrons will appear. The Treble wave-solver compensates for small tetrahedrons to maintain stability constraints, so a small mesh element will not impact the accuracy of computation. However, in exchange, a single squashed tetrahedron in the mesh will significantly impact the computational efficiency.

Avoid flat tetrahedrons

There are a few options available to control the mesh in the Treble SDK. In the case of a flat tetrahedron, often times the best practice is to fix the input geometry. The flat tetrahedrons mostly occur where there are small distinct features in the mesh, such as a thin object (a kitchen countertop, a table) or a small gap between two objects. In these cases it is always recommended to go back to the input geometry, resolve these issues and reimport the geometry. See Geometry tips and tricks for more details on how to optimize input geometries (in SketchUp or any other modelling tools).

Local mesh sizing

When the issue is an over-simplification of the mesh (especially curves at low frequency since a low transition frequency entails a larger tetrahedron size), it is possible to apply a local mesh sizing to a given layer of the input geometry to control the meshing process. Use the local_mesh_sizing input to the SimulationDefinition to specify a specific mesh sizing on a layer. This is done by inputting a list of LocalMeshSizing to specify different sizings on different layers.

Note: This is very likely to introduce smaller-than-necessary tetrahedrons and therefore increase the simulation runtime. As it is an advanced option, you might have to tweak it few times to achieve the desired result.

If the issue is that some small yet required edges or features are removed in the import process, it is also possible to globally switch off the simplification of small edges by setting the parameter simulation_definition.mesher_settings.simplify_mesh to False. This will effectively switch the simplification of the mesh off, by lowering the simplification tolerances applied by the meshing algorithms dramatically.

Caution: This is likely to increase the simulation time by letting small edges stay in the mesh, therefore introducing sub-optimal tetrahedrons.

The Treble engine is designed to strike the balance between computation efficiency and accuracy, but if a challenging case arises with meshing, please don't hesitate to reach for Support.