The Case class

class turbulucid.Case(fileName, clean=False, pointData=False)

A class representing a simulation case.

blockData

the multiblock data assembled by the reader.

Type:vtkMultiBlockDataSet
boundaries

A list of names of the boundaries present the case.

Type:list
boundary_cell_data(boundary, sort=None)

Return cell-centre coordinates and data from cells adjacent to a specific boundary.

Parameters:
  • boundary (str) – The name of the boundary.
  • sort ({None, 'x', 'y'}, optional) – Whether to sort the data along a coordinate. Use ‘x’ and ‘y’ to sort along x and y, respectively. Default is no sorting.
Returns:

Return type:

Two ndarrays

boundary_data(boundary, sort=None)

Return cell-center coordinates and data from a boundary.

Parameters:
  • boundary (str) – The name of the boundary.
  • sort (str) – Whether to sort the data along a coordinate. Use “x” and “y” to sort along x and y, respectively. Default is no sorting.
Returns:

The coordinates of the boundary face centres. The corresponding data.

Return type:

Two ndarrays

bounds

(min(x), max(x), min(y), max(y)).

Type:tuple
cellCentres

the cell centres of the read data

Type:wrapped VTKArray
extract_block_by_name(name)

Extract a block from the case by a given name.

extract_boundary_cells(boundary)

Extract cells adjacent to a certain boundary.

Parameters:boundary (str) – The name of the boundary.
Returns:
Return type:vtkExtractSelection
fields

The names of the fields present in the case.

Type:list of str
read(clean, pointData)

Read in the data from a file.

Parameters:
  • clean (bool) – Whether to attempt cleaning the case of degenerate cells upon read.
  • pointData (bool) – Whether the file contains point data instead of cell data. Cell data will be computed by interpolation.
Raises:

ValueError – If the provided file does not exist.

rotate(angle)

Rotate the geometry of the case around the z axis.

Parameters:dx (angle) – Rotation angle in degrees.
scale(scaleX, scaleY)

Scale the geometry of the case.

The coordinates get divided by the scaling factors.

Parameters:
  • scaleX (float) – The scaling factor along x.
  • scaleY (float) – The scaling factor along y.
translate(dx, dy)

Translate the geometry of the case.

Parameters:
  • dx (float) – The translation along the x axis.
  • dy (float) – The translation along the y axis.
vtkData

The actual data read by the reader.

Type:wrapped PolyData
write(writePath)

Save the case to a .vtm format.

Parameters:writePath (str) – The name of the file.
xlim

The x limits that cover the geometry of the case, plus small a margin.

Type:list of two floats
ylim

The y limits that cover the geometry of the case, plus a small margin.

Type:list of two floats