mesh - surface meshes in waLBerla

Detailed Description

How is the mesh module laid out?

More precisely, the mesh module consists of two modules - the mesh_common module, providing basic mesh support, and the mesh module, which includes deep integration of meshes into waLBerla. Both operate in the same "mesh" namespace.

mesh_common - Essentials

The mesh_common module consists of an OpenMesh wrapper (detailed further down), VTK output, distance octree, IO handling, arithmetic operations (i.e. calculation of inertia tensor), and MPI extensions.

mesh - waLBerla integrations

To enable the usage of meshes in certain parts of waLBerla, the more waLBerla-specific "mesh" module contains extensions for the BlockForest, boundaries, the Physics engine, python and conversion to the waLBerla-own TriangleMesh geometry.

How are meshes handled in the mesh module?

OpenMesh

We use OpenMesh (https://www.openmesh.org/) for loading, storing and manipulating meshes in waLBerla. OpenMesh is a C++-library developed at RWTH Aachen based on the halfedge data structure. Details can be found at the documentation of OpenMesh.

Mesh data types

To make things easy, we have predefined some OpenMesh types in TriangleMeshes.h. mesh::TriangleMesh is the default and should be used as first choice. Points and normals use walberla::real_t as the scalar type while everything else sticks to OpenMesh's defaults. FloatTriangleMesh uses float as the scalar type used in points and normals. You can use mesh::FloatTriangleMesh to save some memory if you have large meshes. mesh::PythonTriangleMesh matches the mesh definition used by OpenMesh's python module. So if you want to fiddle with meshes from C++ and Python mesh::PythonTriangleMesh might be the right choice.

Loading meshes

Meshes can be loaded from any file format supported by OpenMesh including obj, off, ply, stl and a custom om format. To load a mesh at large scale simulations waLBerla provides the function readAndBroadcast() which reads a file from disk on a single process and broadcasts it. This way the pressure on the file system is kept to a minimum.

Conversion between OpenMesh and waLBerla data types

OpenMesh and waLBerla use different vector data types. The file MatrixVectorOperations.h provides the functions toWalberla() and toOpenMesh() to convert between both vector data types. Additionally, it provides a multiplication operator for OpenMesh's vector and waLBerla's math::Matrix3 class.

Additional to the OpenMesh support, waLBerla has a geometry::TriangleMesh class in its geometry module. This class has a simple, adjacency-style data structure. If the use of this mesh type is still required, conversion routines convertOpenMeshToWalberla() and convertWalberlaToOpenMesh() can be found in MeshConversion.h.

How can I setup my simulation using the mesh module?

Initialization of mesh distance data structures

To set up the simulation using a surface mesh, waLBerla needs to compute distances to the surface and determine the location of points relative to mesh. The necessary data structure is called mesh::TriangleDistance and is defined in DistanceComputations.h. It adds the necessary information to the mesh's triangles and offers functions to compute a signed point<->triangle distance. It also offers to compute a assigned point<->mesh distance but this is only recommended for smaller meshes with only a few triangles. Larger meshes should use a mesh::DistanceOctree which reduces the number of evaluated point<->mesh distances significantly from \(\mathcal O(n)\) to \(\mathcal O(\log n)\). If you are only interested whether a point is contained in the mesh you can use the mesh::DistanceOctree with geometry::ContainmentOctree to get faster results.

Files

file  BlockExclusion.h
 
file  BlockForestInitialization.cpp
 
file  BlockForestInitialization.h
 
file  BlockWorkloadMemory.h
 
file  RefinementSelection.h
 
file  BoundaryInfo.h
 
file  BoundaryInfo.h
 
file  BoundaryLocationFunction.h
 
file  BoundarySetup.cpp
 
file  BoundarySetup.h
 
file  BoundarySetup.h
 
file  ColorToBoundaryMapper.h
 
file  mesh_module.dox
 
file  MeshConversion.h
 
file  DefaultTesselation.h
 
file  Box.h
 
file  ConvexPolyhedron.h
 
file  CommonDataSources.h
 
file  PeVTKMeshWriter.h
 
file  BranchNode.h
 
file  DistanceOctree.h
 
file  LeafNode.h
 
file  Node.h
 
file  DistanceComputations.h
 
file  DistanceFunction.h
 
file  MatrixVectorOperations.h
 
file  MeshIO.h
 
file  MeshOperations.h
 
file  OpenMeshBufferTypeExtensions.h
 
file  TriangleMeshes.h
 
file  QHull.h
 
file  TriangleMeshes.h
 
file  CommonDataSources.h
 
file  CommonFilters.h
 
file  DistributedVTKMeshWriter.h
 
file  VTKMeshWriter.h