Boundary files

Collection of Obstruction objects. Offers extensive functionality for filtering and using obstructions as well as dependent such as Boundary.

Classes:

Boundary(quantity, cell_centered, times, ...)

Container for boundary data specific to one quantity.

Obstruction(oid, color_index, block_type, ...)

A box-shaped obstruction with specific surfaces (materials) on each side.

Patch(file_path, dimension, extent, ...)

Container for the actual data which is stored as rectangular plane with specific orientation

SubObstruction(side_surfaces, bound_indices, ...)

An Obstruction consists of 1 or more SubObstructions which can be hidden at specific points in time.

class fdsreader.bndf.obstruction.Boundary(quantity: Quantity, cell_centered: bool, times: Sequence[float], patches: List[Patch], lower_bounds: ndarray, upper_bounds: ndarray)[source]

Container for boundary data specific to one quantity.

Variables:
  • quantity – Quantity object containing information about the quantity calculated for this Obstruction with the corresponding short_name and unit.

  • times – Numpy array containing all times for which data has been recorded.

  • cell_centered – Indicates whether centered positioning for data is used.

  • lower_bounds – Dictionary with lower bounds for each timestep with meshes as keys.

  • upper_bounds – Dictionary with upper bounds for each timestep with meshes as keys.

  • n_t – Total number of time steps for which output data has been written.

Methods:

clear_cache()

Remove all data from the internal cache that has been loaded so far to free memory.

get_nearest_timestep(time)

Calculates the nearest timestep for which data has been output for this obstruction.

n_t([count_duplicates])

Get the number of timesteps for which data was output. :param count_duplicates: If true, return the total number of data points, even if there is duplicate data for a timestep. Duplicate data might be output when restarting the simulation in between the simulation run.

vmax([orientation])

Maximum value of all patches at any time.

vmin([orientation])

Minimum value of all patches at any time.

Attributes:

data

The Patch in each direction (-3=-z, -2=-y, -1=-x, 1=x, 2=y, 3=y).

orientations

Return all orientations for which there is data available.

clear_cache()[source]

Remove all data from the internal cache that has been loaded so far to free memory.

property data: Dict[int, Patch]

The Patch in each direction (-3=-z, -2=-y, -1=-x, 1=x, 2=y, 3=y).

get_nearest_timestep(time: float) int[source]

Calculates the nearest timestep for which data has been output for this obstruction.

n_t(count_duplicates=True) int[source]

Get the number of timesteps for which data was output. :param count_duplicates: If true, return the total number of data points, even if there is

duplicate data for a timestep. Duplicate data might be output when restarting the simulation in between the simulation run.

property orientations

Return all orientations for which there is data available.

vmax(orientation: Literal[-3, -2, -1, 0, 1, 2, 3] = 0) float[source]

Maximum value of all patches at any time.

Parameters:

orientation – Optionally filter by patches with a specific orientation.

vmin(orientation: Literal[-3, -2, -1, 0, 1, 2, 3] = 0) float[source]

Minimum value of all patches at any time.

Parameters:

orientation – Optionally filter by patches with a specific orientation.

class fdsreader.bndf.obstruction.Obstruction(oid: str, color_index: int, block_type: int, texture_origin: Tuple[float, float, float], rgba: Tuple | Tuple[float, float, float, float] = ())[source]

A box-shaped obstruction with specific surfaces (materials) on each side.

Variables:
  • id – ID of the obstruction.

  • color_index – Type of coloring used to color obstruction. -1 - default color -2 - invisible -3 - use red, green, blue and alpha (rgba attribute) n>0 - use n’th color table entry

  • block_type – Defines how the obstruction is drawn. -1 - use surface to obtain blocktype 0 - regular block 2 - outline

  • texture_origin – Origin position of the texture provided by the surface. When the texture does have a pattern, for example windows or bricks, the texture_origin specifies where the pattern should begin.

  • rgba – Optional color of the obstruction in form of a 4-element tuple (ranging from 0.0 to 1.0).

Attributes:

bounding_box

Extent object representing the bounding box around the Obstruction.

has_boundary_data

Whether boundary data has been output in the simulation.

meshes

Returns a list of all meshes this slice cuts through.

orientations

Return all orientations for which there is data available.

quantities

Get a list of all quantities for which boundary data exists.

times

Return all timesteps for which boundary data is available, if any.

Methods:

clear_cache()

Remove all data from the internal cache that has been loaded so far to free memory.

filter_by_orientation([orientation])

Filter all SubObstructions by a specific orientation.

get_boundary_data(quantity[, orientation])

Gets the boundary data for a specific quantity of all SubObstructions.

get_coordinates([ignore_cell_centered])

Returns a dictionary containing a numpy ndarray with coordinates for each dimension.

get_global_boundary_data_arrays(quantity)

Creates a global numpy ndarray from all subobstruction's boundary data for each orientation.

get_nearest_index(dimension, orientation, value)

Get the nearest mesh coordinate index in a specific dimension for a specific orientation.

get_nearest_patch([x, y, z])

Gets the patch of the SubObstruction that has the least distance to the given point.

get_nearest_timestep(time[, visible_only])

Calculates the nearest timestep for which data has been output for this obstruction.

get_visible_times(times)

Returns an ndarray filtering all time steps when theSubObstruction is visible/not hidden.

n_t([count_duplicates])

Returns the number of timesteps for which boundary data is available. :param count_duplicates: If true, return the total number of data points, even if there is duplicate data for a timestep. Duplicate data might be output when restarting the simulation in between the simulation run.

vmax(quantity[, orientation])

Maximum value of all patches at any time for a specific quantity.

vmin(quantity[, orientation])

Minimum value of all patches at any time for a specific quantity.

property bounding_box: Extent

Extent object representing the bounding box around the Obstruction.

clear_cache()[source]

Remove all data from the internal cache that has been loaded so far to free memory.

filter_by_orientation(orientation: Literal[-3, -2, -1, 0, 1, 2, 3] = 0) List[SubObstruction][source]

Filter all SubObstructions by a specific orientation. All returned SubObstructions will contain boundary data in the specified orientation.

get_boundary_data(quantity: Quantity | str, orientation: Literal[-3, -2, -1, 0, 1, 2, 3] = 0) Dict[str, Boundary][source]

Gets the boundary data for a specific quantity of all SubObstructions.

Parameters:
  • quantity – The quantity to filter by.

  • orientation – Optionally filter by a specific orientation as well (-3=-z, -2=-y, -1=-x, 1=x, 2=y, 3=z). A value of 0 indicates to no filter.

get_coordinates(ignore_cell_centered: bool = False) Dict[int, Dict[Literal['x', 'y', 'z'], ndarray]][source]

Returns a dictionary containing a numpy ndarray with coordinates for each dimension. For cell-centered boundary data, the coordinates can be adjusted to represent cell-centered coordinates.

Parameters:

ignore_cell_centered – Whether to shift the coordinates when the bndf is cell_centered or not.

get_global_boundary_data_arrays(quantity: str | Quantity) Dict[int, ndarray | Tuple[ndarray, ndarray]][source]

Creates a global numpy ndarray from all subobstruction’s boundary data for each orientation.

Parameters:

quantity – The quantity’s name or short name for which to load the global arrays.

get_nearest_index(dimension: Literal['x', 'y', 'z'], orientation: int, value: float) int[source]

Get the nearest mesh coordinate index in a specific dimension for a specific orientation.

get_nearest_patch(x: float = None, y: float = None, z: float = None)[source]

Gets the patch of the SubObstruction that has the least distance to the given point. If there are multiple patches with the same distance, a random one will be selected.

get_nearest_timestep(time: float, visible_only: bool = False) int[source]

Calculates the nearest timestep for which data has been output for this obstruction.

get_visible_times(times: Sequence[float])[source]

Returns an ndarray filtering all time steps when theSubObstruction is visible/not hidden.

property has_boundary_data

Whether boundary data has been output in the simulation.

property meshes: List[Mesh]

Returns a list of all meshes this slice cuts through.

n_t(count_duplicates=True) int[source]

Returns the number of timesteps for which boundary data is available. :param count_duplicates: If true, return the total number of data points, even if there is

duplicate data for a timestep. Duplicate data might be output when restarting the simulation in between the simulation run.

property orientations

Return all orientations for which there is data available.

property quantities: List[Quantity]

Get a list of all quantities for which boundary data exists.

property times

Return all timesteps for which boundary data is available, if any.

vmax(quantity: str | Quantity, orientation: Literal[-3, -2, -1, 0, 1, 2, 3] = 0) float[source]

Maximum value of all patches at any time for a specific quantity.

Parameters:

orientation – Optionally filter by patches with a specific orientation.

vmin(quantity: str | Quantity, orientation: Literal[-3, -2, -1, 0, 1, 2, 3] = 0) float[source]

Minimum value of all patches at any time for a specific quantity.

Parameters:

orientation – Optionally filter by patches with a specific orientation.

class fdsreader.bndf.obstruction.Patch(file_path: str, dimension: Dimension, extent: Extent, orientation: int, cell_centered: bool, patch_offset: int, initial_offset: int, n_t: int, mesh: Mesh)[source]
Container for the actual data which is stored as rectangular plane with specific orientation

and extent.

Variables:
  • dimensionDimension object containing information about steps in each dimension.

  • extentExtent object containing 3-dimensional extent information.

  • orientation – The direction the patch is facing (x={-1;1}, y={-2;2}, z={-3;3}).

  • cell_centered – Indicates whether centered positioning for data is used.

  • _n_t – Total number of time steps for which output data has been written.

Methods:

clear_cache()

Remove all data from the internal cache that has been loaded so far to free memory.

get_coordinates([ignore_cell_centered])

Returns a dictionary containing a numpy ndarray with coordinates for each dimension.

n_t([count_duplicates])

Get the number of timesteps for which data was output. :param count_duplicates: If true, return the total number of data points, even if there is duplicate data for a timestep. Duplicate data might be output when restarting the simulation in between the simulation run.

Attributes:

data

Method to load the quantity data for a single patch.

shape

Convenience function to calculate the shape of the array containing data for this patch.

size

Convenience function to calculate the number of data points in the array for this patch.

clear_cache()[source]

Remove all data from the internal cache that has been loaded so far to free memory.

property data

Method to load the quantity data for a single patch.

get_coordinates(ignore_cell_centered: bool = False) Dict[Literal['x', 'y', 'z'], ndarray][source]

Returns a dictionary containing a numpy ndarray with coordinates for each dimension. For cell-centered boundary data, the coordinates can be adjusted to represent cell-centered coordinates.

Parameters:

ignore_cell_centered – Whether to shift the coordinates when the bndf is cell_centered or not.

n_t(count_duplicates=True) int[source]

Get the number of timesteps for which data was output. :param count_duplicates: If true, return the total number of data points, even if there is

duplicate data for a timestep. Duplicate data might be output when restarting the simulation in between the simulation run.

property shape: Tuple

Convenience function to calculate the shape of the array containing data for this patch.

property size: int

Convenience function to calculate the number of data points in the array for this patch.

class fdsreader.bndf.obstruction.SubObstruction(side_surfaces: Tuple, bound_indices: Tuple[int, int, int, int, int, int], extent: Extent, mesh: Mesh)[source]

An Obstruction consists of 1 or more SubObstructions which can be hidden at specific points in time.

Variables:
  • extentExtent object containing 3-dimensional extent information.

  • bound_indices – Indices used to define obstruction bounds in terms of mesh locations.

  • side_surfaces – Tuple of six Surface s for each side of the cuboid.

  • hide_times – List with points in time from when on the SubObstruction will be hidden.

  • show_times – List with points in time from when on the SubObstruction will be shown.

Methods:

clear_cache()

Remove all data from the internal cache that has been loaded so far to free memory.

get_coordinates([ignore_cell_centered])

Returns a dictionary containing a numpy ndarray with coordinates for each dimension.

get_data(quantity)

get_nearest_index(dimension, orientation, value)

Get the nearest mesh coordinate index in a specific dimension for a specific orientation.

get_visible_times(times)

Returns a ndarray filtering all time steps when the SubObstruction is visible/not hidden.

n_t([count_duplicates])

Returns the number of timesteps for which boundary data is available. :param count_duplicates: If true, return the total number of data points, even if there is duplicate data for a timestep. Duplicate data might be output when restarting the simulation in between the simulation run.

vmax(quantity[, orientation])

Maximum value of all patches at any time for a specific quantity.

vmin(quantity[, orientation])

Minimum value of all patches at any time for a specific quantity.

Attributes:

has_boundary_data

orientations

Return all orientations for which there is data available.

times

Return all timesteps for which boundary data is available, if any.

clear_cache()[source]

Remove all data from the internal cache that has been loaded so far to free memory.

get_coordinates(ignore_cell_centered: bool = False) Dict[int, Dict[Literal['x', 'y', 'z'], ndarray]][source]

Returns a dictionary containing a numpy ndarray with coordinates for each dimension. For cell-centered boundary data, the coordinates can be adjusted to represent cell-centered coordinates.

Parameters:

ignore_cell_centered – Whether to shift the coordinates when the bndf is cell_centered or not.

get_data(quantity: str | Quantity)[source]
get_nearest_index(dimension: Literal['x', 'y', 'z'], orientation: int, value: float) int[source]

Get the nearest mesh coordinate index in a specific dimension for a specific orientation.

get_visible_times(times: Sequence[float]) ndarray[source]

Returns a ndarray filtering all time steps when the SubObstruction is visible/not hidden.

property has_boundary_data
n_t(count_duplicates=True) int[source]

Returns the number of timesteps for which boundary data is available. :param count_duplicates: If true, return the total number of data points, even if there is

duplicate data for a timestep. Duplicate data might be output when restarting the simulation in between the simulation run.

property orientations

Return all orientations for which there is data available.

property times

Return all timesteps for which boundary data is available, if any.

vmax(quantity: str | Quantity, orientation: Literal[-3, -2, -1, 0, 1, 2, 3] = 0) float[source]

Maximum value of all patches at any time for a specific quantity.

Parameters:

orientation – Optionally filter by patches with a specific orientation.

vmin(quantity: str | Quantity, orientation: Literal[-3, -2, -1, 0, 1, 2, 3] = 0) float[source]

Minimum value of all patches at any time for a specific quantity.

Parameters:

orientation – Optionally filter by patches with a specific orientation.

Functions:

sort_patches_cartesian(patches_in)

Returns all patches (of same orientation!) sorted in cartesian coordinates.

fdsreader.bndf.utils.sort_patches_cartesian(patches_in: List[Patch])[source]

Returns all patches (of same orientation!) sorted in cartesian coordinates.