spectre.Visualization.GenerateTetrahedralConnectivity

Functions

generate_tetrahedral_connectivity(h5file, ...)

Generate tetrahedral connectivity using scipy.spatial.Delaunay

spectre.Visualization.GenerateTetrahedralConnectivity.generate_tetrahedral_connectivity(h5file, subfile_name: str, relative_paths: bool = True, start_time: float | None = None, stop_time: float | None = None, stride: int = 1, coordinates: str = 'InertialCoordinates', force: bool = False)

Generate tetrahedral connectivity using scipy.spatial.Delaunay

Given the coordinates, this generates a tetrahedral connectivity that can be read in by ParaView or other visualization software (e.g. VisIt or yt). It uses the scipy.spatial.Delaunay class to generate the connectivity, which uses the Qhull library (github.com/qhull/qhull/), which uses the quickhull algorithm and scales as O(n^2) in the worst case. Thus, generating the connectivity can take several minutes per temporal ID. Unfortunately, depending on the particular grid point distribution, generating the connectivity may even fail in qhull, which is unfortunately difficult to fix.

You should combine the volume HDF5 files into one before running this in order to get a fully connected domain.

Note that while ParaView has a Delaunay3D filter, it is much slower than qhull, needs to be rerun every time ParaView is opened while the qhull output is stored, and the Delaunay3D filter sometimes produces nonsense connectivity that is very difficult to debug and fix.

After the tetrahedral connectivity has been written you can run ‘generate-xdmf’ with the flag ‘–use-tetrahedral-connectivity’. ParaView volume renderings are sometimes nicer with tetrahedral connectivity and this can be used to fill gaps between finite-difference or Gauss elements.

If this algorithm is too slow, one possible improvement is to apply qhull to each block of the domain and then connect the blocks to each other separately. This keeps the number of grid points lower for each invocation of qhull, which likely reduces total runtime and may also reduce or eliminate failure cases. In the ideal case we would apply qhull to each element and then connect elements that are using FD or Gauss points to their neighbors.

Parameters:
  • h5file – The HDF5 file on which to run.

  • subfile_name – Volume data subfile in the H5 files.

  • start_time – Optional. The earliest time at which to start visualizing. The start-time value is included.

  • stop_time – Optional. The time at which to stop visualizing. The stop-time value is not included.

  • stride – Optional. View only every stride’th time step.

  • coordinates – Optional. Name of coordinates dataset. Default: “InertialCoordinates”.

  • force – Optional. Overwrite the existing tetrahedral connectivity. Default: False