Data extraction

turbulucid.core.data_extraction.edge_lengths(case, name)

Compute the lengths of boundary edges.

Parameters:
  • case (Case) – The case to extract data from.
  • name (str) – The name of the boundary.
Returns:

The lengths of each edge of the boundary.

Return type:

ndarray

turbulucid.core.data_extraction.isoline(case, field, value)

Extract an isoline of a scalar field.

The cell data is first interpolated to points in order to use vtkContourFilter to extract the isoline.

Parameters:
  • case (Case) – The case to draw the boundaries for.
  • field (string) – The field to extract the contour from.
  • value (float) – The value associated with the contour.
Returns:

Points defining the isoline.

Return type:

ndarray

turbulucid.core.data_extraction.dist(case, name, corrected=True)

Compute the distances between the boundary and the adjacent cell-centre.

Parameters:
  • case (Case) – The case to extract data from.
  • name (str) – The name of the boundary.
  • corrected (bool) – If true, projects the distance between face center and cell center onto the wall-normal direction.
Returns:

The value of the distance for each adjacent cell.

Return type:

ndarray

turbulucid.core.data_extraction.normals(case, name)

Compute outward unit normal vectors for a given boundary.

Parameters:
  • case (Case) – The case to extract data from.
  • name (str) – The name of the boundary.
Returns:

The outward normal vectors

Return type:

ndarray

turbulucid.core.data_extraction.profile_along_line(case, p1, p2, correctDistance=False, excludeBoundaries=False)

Extract a linear profile from the data.

Returns the data itself and the its location in a coordinate system tangential to the line.

Parameters:
  • case (Case) – The case to extract data from.
  • p1 (2-tuple) – Start point defining the line.
  • p2 (2-tuple) – End point defining the line.
  • correctDistance (bool) – Whether to place the origo of the coordinate system at p1 or at the point where the the line first intersects the geometry.
  • excludeBoundaries (bool) – Exclude boundary data when extracting the profile, default is False.
  • Returns
  • dictionary) ((ndarray,) – The first element of the tuple is an array of coordinates along the line where the data is located. The second element is a dictionary with the case’s fields as keys and arrays of values of these fields as values.
turbulucid.core.data_extraction.sample_by_plane(case, resolution)

Sample the field values by a Cartesian grid.

Parameters:
  • case (Case) – The case to extract data from.
  • resolution (pair) – The resolution of the plane, (number of rows, number of cols).
Returns:

The first element of the tuple is an array of coordinates of the points on the plane. The second is a dictionary with the case’s fields as keys and arrays of values of these fields as values.

Return type:

(ndarray, dictionary)

turbulucid.core.data_extraction.sort_indices(case, name, axis)

Compute indices sorting the values on a boundary along an axis.

Parameters:
  • case (Case) – The case to extract data from.
  • name (str) – The name of the boundary.
  • axis ({'x', 'y'}) – Axis to sort along.
Returns:

The array of indices.

Return type:

ndarray

turbulucid.core.data_extraction.tangents(case, name)

Compute unit tangent vectors for a given boundary.

Parameters:
  • case (Case) – The case to extract data from.
  • name (str) – The name of the boundary.
Returns:

The tangent vectors

Return type:

ndarray