sparseSpatialSampling.sparse_spatial_sampling module

Implements the \(S^3\) algorithm to generate grids for CFD data.

class sparseSpatialSampling.sparse_spatial_sampling.SparseSpatialSampling(coordinates, metric, geometry_objects, save_path, save_name, grid_name='grid_s_cube', uniform_levels=5, n_cells_max=None, min_metric=0.75, max_delta_level=False, n_cells_iter_start=None, n_cells_iter_end=None, n_jobs=1, relTol=0.001, reach_at_least=0.75, pre_select_cells=False)[source]

Bases: object

Class for executing the \(S^3\) algorithm.

Note

The parameter geometry_objects needs to have at least one entry containing information about the domain.

Parameters:
  • coordinates (pt.Tensor) – Coordinates of the original grid

  • metric (pt.Tensor) – Quantity used as an indicator for refinement of a cell

  • geometry_objects (list) – Information about the domain and geometries in it; each geometry is passed as instance of class within the geometry module

  • save_path (str) – Path where the interpolated grid and data should be saved

  • save_name (str) – Base name of the files (grid & data)

  • grid_name (str) – Name of the grid (used in XDMF file)

  • uniform_levels (int) – Number of uniform refinement cycles to perform

  • n_cells_max (int | float | None) – Maximum number of cells of the grid; if not set, early stopping based on captured variance will be used

  • min_metric (float) – Percentage of variance of the metric the generated grid should capture w.r.t. the original grid. If None, the max. number of cells will be used as stopping criterion. If n_cells_max is also provided, min_metric will be ignored.

  • max_delta_level (bool) – Constraint that two adjacent cells should have a maximum level difference of one

  • n_cells_iter_start (int | None) – Number of cells to refine per iteration at the beginning; if None, defaults to 1% of the number of vertices in the original grid

  • n_cells_iter_end (int | None) – Number of cells to refine per iteration at the end; if None, defaults to 5% of n_cells_iter_start

  • n_jobs (int) – Number of CPUs to use; if None, all available CPUs will be used

  • relTol (int | float) – Minimum improvement between two consecutive iterations

  • reach_at_least (float) – Minimum percentage of the target metric / number of cells to reach before activating the relTol stopping criterion

  • pre_select_cells (bool) – Optimization for geometry objects (e.g., GeometrySTL3D, GeometryCoordinates2D) that reduces runtime when bounding box volume is close to geometry volume

Returns:

None

Return type:

None

execute_grid_generation()[source]

Execute the \(S^3\) algorithm.

Returns:

None

Return type:

None

sparseSpatialSampling.sparse_spatial_sampling.list_geometries()[source]

List all available geometry objects along with a short description of each.

Returns:

None

Return type:

None