API Reference

cooldata.dgl_flow_field_dataset module

class cooldata.dgl_flow_field_dataset.DGLSurfaceFlowFieldDataset(*args, **kwargs)[source]

Bases: Dataset

Parameters:
  • cache_dir (str)

  • pyvista_dataset (PyvistaFlowFieldDataset | None)

  • normalize (bool)

  • patches_to_include (List[int] | None)

compute_aggregate_force(graph, object_id=None)[source]

Compute the aggregate force acting on the surface.

Parameters:

graph: dgl.DGLGraph

The graph to compute the aggregate force for.

object_id: Optional[int]

The object id to compute the aggregate force for. If None, the aggregate force for all objects is computed.

Returns:

torch.Tensor: The aggregate force acting on the surface.

Parameters:
  • graph (dgl.DGLGraph)

  • object_id (int | None)

Return type:

torch.Tensor

compute_edge_stats()[source]

Compute the mean and standard deviation of the edge features.

Return type:

tuple[dict[str, float], dict[str, float]]

compute_node_stats()[source]

Compute the mean and standard deviation of the node features.

Return type:

tuple[dict[str, float], dict[str, float]]

denormalize(graph)[source]

Denormalize the features of the graph.

Parameters:

graph: dgl.DGLGraph

The graph to denormalize.

Returns:

dgl.DGLGraph: The denormalized graph.

Parameters:

graph (dgl.DGLGraph)

Return type:

dgl.DGLGraph

denormalize_inplace(graph)[source]

Denormalize the features of the graph in place.

Parameters:

graph: dgl.DGLGraph

The graph to denormalize.

Parameters:

graph (dgl.DGLGraph)

Return type:

None

dgl_to_pyvista_polydata(graph)[source]

Convert a DGLGraph of the volume flow field to a Pyvista PolyData object. This will not be the original mesh since the graph only contains the cell centers and the connectivity, not the cell points

Parameters:

graph: dgl.DGLGraph

The DGLGraph to convert.

Returns:

pv.PolyData: The converted PolyData object.

Parameters:

graph (dgl.DGLGraph)

Return type:

pyvista.PolyData

classmethod l2_loss(graph1, graph2)[source]

Compute the L2 loss between two DGLGraphs.

Parameters:

graph1: dgl.DGLGraph

The first graph.

graph2: dgl.DGLGraph

The second graph.

Returns:

torch.tensor: The L2 loss between the two graphs.

Parameters:
  • graph1 (dgl.DGLGraph)

  • graph2 (dgl.DGLGraph)

normalize(graph)[source]

Normalize the features of the graph.

Parameters:

graph: dgl.DGLGraph

The graph to normalize.

Returns:

dgl.DGLGraph: The normalized graph.

Parameters:

graph (dgl.DGLGraph)

Return type:

dgl.DGLGraph

normalize_inplace(graph)[source]

Normalize the features of the graph in place.

Parameters:

graph: dgl.DGLGraph

The graph to normalize.

Parameters:

graph (dgl.DGLGraph)

Return type:

None

plot_surface(graph, scalar, object_id=None)[source]

Plot the surface of the graph.

Parameters:

graph: dgl.DGLGraph

The graph to plot.

Parameters:
  • graph (dgl.DGLGraph)

  • scalar (Literal['AreaMagnitude', 'HeatTransferCoefficient', 'Normal_0', 'Normal_1', 'Normal_2', 'Temperature', 'Pressure', 'WallShearStressMagnitude', 'WallShearStress_0', 'WallShearStress_1', 'WallShearStress_2'])

  • object_id (int | None)

classmethod pyvista_to_surface_dgl(sample, block_indices=None)[source]

Convert a Pyvista UnstructuredGrid object to a DGLGraph of the volume flow field.

Parameters:

grid: pv.UnstructuredGrid

The UnstructuredGrid object to convert.

Returns:

DGLGraph: The converted graph.

Parameters:
Return type:

dgl.DGLGraph

select_subset(indices)[source]

Select a subset of the dataset based on the given indices.

Parameters:

indices (List[int])

Return type:

DGLSurfaceFlowFieldDataset

shuffle()[source]

Shuffle the dataset.

Return type:

None

slice(start, end)[source]

Get a slice of the dataset.

Parameters:
  • start (int)

  • end (int)

Return type:

DGLSurfaceFlowFieldDataset

volume_dgl_to_pyvista(graph)[source]

Convert a DGLGraph of the volume flow field to a Pyvista PolyData object.

Parameters:

graph: dgl.DGLGraph

The DGLGraph to convert.

Returns:

pv.PolyData: The converted PolyData object.

Parameters:

graph (dgl.DGLGraph)

Return type:

pyvista.PolyData

class cooldata.dgl_flow_field_dataset.DGLVolumeFlowFieldDataset(*args, **kwargs)[source]

Bases: Dataset

Parameters:
compute_edge_stats()[source]

Compute the mean and standard deviation of the edge features.

Return type:

tuple[dict[str, float], dict[str, float]]

compute_node_stats()[source]

Compute the mean and standard deviation of the node features.

Return type:

tuple[dict[str, float], dict[str, float]]

denormalize()[source]
denormalize_inplace(graph)[source]

Denormalize the features of the graph.

Parameters:

graph: dgl.DGLGraph

The graph to denormalize.

Parameters:

graph (dgl.DGLGraph)

classmethod l2_loss(graph1, graph2)[source]

Compute the L2 loss between two DGLGraphs.

Parameters:

graph1: dgl.DGLGraph

The first graph.

graph2: dgl.DGLGraph

The second graph.

Returns:

float: The L2 loss between the two graphs.

Parameters:
  • graph1 (dgl.DGLGraph)

  • graph2 (dgl.DGLGraph)

normalize()[source]
normalize_inplace(graph)[source]

Normalize the features of the graph.

Parameters:

graph: dgl.DGLGraph

The graph to normalize.

Parameters:

graph (dgl.DGLGraph)

classmethod pyvista_to_volume_dgl(sample)[source]

Convert a Pyvista UnstructuredGrid object to a DGLGraph of the volume flow field.

Parameters:

grid: pv.UnstructuredGrid

The UnstructuredGrid object to convert.

Returns:

DGLGraph: The converted graph.

Parameters:

sample (PyvistaSample)

Return type:

dgl.DGLGraph

volume_dgl_to_pv(graph)[source]

Convert a DGLGraph of the volume flow field to a Pyvista PolyData object.

Parameters:

graph: dgl.DGLGraph

The DGLGraph to convert.

Returns:

pv.PolyData: The converted PolyData object.

Parameters:

graph (dgl.DGLGraph)

Return type:

pyvista.PolyData

cooldata.dgl_flow_field_dataset.process_sample(args)[source]
cooldata.dgl_flow_field_dataset.process_surface_sample(args)[source]

cooldata.pyg_flow_field_dataset module

class cooldata.pyg_flow_field_dataset.PyGSurfaceFlowFieldDataset(cache_dir, pyvista_dataset=None, normalize=True, patches_to_include=None)[source]

Bases: Dataset

Parameters:
  • cache_dir (str | Path)

  • pyvista_dataset (PyvistaFlowFieldDataset | None)

  • normalize (bool)

  • patches_to_include (List[int] | None)

PyG_to_pyvista_polydata(graph)[source]

Convert a PyGGraph of the volume flow field to a Pyvista PolyData object. This will not be the original mesh since the graph only contains the cell centers and the connectivity, not the cell points

Parameters:

graph: PyGGraph

The PyGGraph to convert.

Returns:

pv.PolyData: The converted PolyData object.

Parameters:

graph (torch_geometric.data.Data)

Return type:

pyvista.PolyData

compute_aggregate_force(graph, object_id=None)[source]

Compute the aggregate force acting on the surface.

Parameters:

graph: PyGGraph

The graph to compute the aggregate force for.

object_id: Optional[int]

The object id to compute the aggregate force for. If None, the aggregate force for all objects is computed.

Returns:

torch.Tensor: The aggregate force acting on the surface.

Parameters:
  • graph (torch_geometric.data.Data)

  • object_id (int | None)

Return type:

Tensor

compute_edge_stats()[source]

Compute the mean and standard deviation of the edge features.

Return type:

tuple[dict[str, float], dict[str, float]]

compute_node_stats()[source]

Compute the mean and standard deviation of the node features.

Return type:

tuple[dict[str, float], dict[str, float]]

denormalize(graph)[source]

Denormalize the features of the graph.

Parameters:

graph: PyGGraph

The graph to denormalize.

Returns:

PyGGraph: The denormalized graph.

Parameters:

graph (torch_geometric.data.Data)

Return type:

torch_geometric.data.Data

denormalize_inplace(graph)[source]

Denormalize the features of the graph in place.

Parameters:

graph: PyGGraph

The graph to denormalize.

Parameters:

graph (torch_geometric.data.Data)

Return type:

None

classmethod l2_loss(graph1, graph2)[source]

Compute the L2 loss between two PyGGraphs.

Parameters:

graph1: PyGGraph

The first graph.

graph2: PyGGraph

The second graph.

Returns:

torch.tensor: The L2 loss between the two graphs.

Parameters:
  • graph1 (torch_geometric.data.Data)

  • graph2 (torch_geometric.data.Data)

normalize(graph)[source]

Normalize the features of the graph.

Parameters:

graph: PyGGraph

The graph to normalize.

Returns:

PyGGraph: The normalized graph.

Parameters:

graph (torch_geometric.data.Data)

Return type:

torch_geometric.data.Data

normalize_inplace(graph)[source]

Normalize the features of the graph in place.

Parameters:

graph: PyGGraph

The graph to normalize.

Parameters:

graph (torch_geometric.data.Data)

Return type:

None

plot_surface(graph, scalar, object_id=None)[source]

Plot the surface of the graph.

Parameters:

graph: PyGGraph

The graph to plot.

Parameters:
  • graph (torch_geometric.data.Data)

  • scalar (Literal['AreaMagnitude', 'HeatTransferCoefficient', 'Normal_0', 'Normal_1', 'Normal_2', 'Temperature', 'Pressure', 'WallShearStressMagnitude', 'WallShearStress_0', 'WallShearStress_1', 'WallShearStress_2'])

  • object_id (int | None)

classmethod pyvista_to_surface_PyG(sample, block_indices=None)[source]

Convert a Pyvista UnstructuredGrid object to a PyGGraph of the volume flow field.

Parameters:

grid: pv.UnstructuredGrid

The UnstructuredGrid object to convert.

Returns:

PyGGraph: The converted graph.

Parameters:
Return type:

torch_geometric.data.Data

select_subset(indices)[source]

Select a subset of the dataset based on the given indices.

Parameters:

indices (List[int])

Return type:

PyGSurfaceFlowFieldDataset

shuffle()[source]

Shuffle the dataset.

Return type:

None

slice(start, end)[source]

Get a slice of the dataset.

Parameters:
  • start (int)

  • end (int)

Return type:

PyGSurfaceFlowFieldDataset

class cooldata.pyg_flow_field_dataset.PyGVolumeFlowFieldDataset(cache_dir, pyvista_dataset=None, parallel_conversion=True)[source]

Bases: Dataset

Parameters:
compute_edge_stats()[source]

Compute the mean and standard deviation of the edge features.

Return type:

tuple[dict[str, float], dict[str, float]]

compute_node_stats()[source]

Compute the mean and standard deviation of the node features.

Return type:

tuple[dict[str, float], dict[str, float]]

denormalize()[source]
denormalize_inplace(graph)[source]

Denormalize the features of the graph.

Parameters:

graph: PyG.PyGGraph

The graph to denormalize.

Parameters:

graph (torch_geometric.data.Data)

classmethod l2_loss(graph1, graph2)[source]

Compute the L2 loss between two PyGGraphs.

Parameters:

graph1: PyGGraph

The first graph.

graph2: PyGGraph

The second graph.

Returns:

float: The L2 loss between the two graphs.

Parameters:
  • graph1 (torch_geometric.data.Data)

  • graph2 (torch_geometric.data.Data)

normalize()[source]
normalize_inplace(graph)[source]

Normalize the features of the graph.

Parameters:

graph: PyGGraph

The graph to normalize.

Parameters:

graph (torch_geometric.data.Data)

classmethod pyvista_to_volume_PyG(sample)[source]

Convert a Pyvista UnstructuredGrid object to a PyGGraph of the volume flow field.

Parameters:

grid: pv.UnstructuredGrid

The UnstructuredGrid object to convert.

Returns:

PyGGraph: The converted graph.

Parameters:

sample (PyvistaSample)

Return type:

torch_geometric.data.Data

volume_PyG_to_pv(graph)[source]

Convert a PyGGraph of the volume flow field to a Pyvista PolyData object.

Parameters:

graph: PyG.PyGGraph

The PyGGraph to convert.

Returns:

pv.PolyData: The converted PolyData object.

Parameters:

graph (torch_geometric.data.Data)

Return type:

pyvista.PolyData

cooldata.pyg_flow_field_dataset.process_sample(args)[source]
cooldata.pyg_flow_field_dataset.process_surface_sample(args)[source]

cooldata.metadata module

class cooldata.metadata.Cylinder(temperature, position, radius, height)[source]

Bases: object

Represents a cylinder with its properties.

Parameters:
  • temperature (float)

  • position (Position)

  • radius (float)

  • height (float)

class cooldata.metadata.MetadataFilter(metadata_path)[source]

Bases: object

Explore and download cooldata-v2 samples by metadata — no downloading needed until you call .load().

Expects metadata.parquet which contains the 60,848 simulated samples with columns: design_id, run, batch, T1-T6, x1-x6, y1-y6, xs1-xs4, ys1-ys4, zs1-zs6, r5, r6, V.

Generate it once with trim_metadata.py if you only have the original metadata.parquet and sample_index.json.

Quick start

>>> from cooldata.metadata import MetadataFilter
>>> f = MetadataFilter("Cooldataset/metadata.parquet")
>>> f.summary()

Download by filter: >>> ds = f.velocity(min=4.0).temperature(body=1, min=50.0).load(num_samples=50)

Download by design ID: >>> ds = f.load_by_ids([125002, 125037, 212515])

Download randomly: >>> ds = f.load_random(n=20)

Download by run: >>> ds = f.load_by_run(“run_1”, num_samples=100)

count()[source]

Number of samples matching the current filter.

Return type:

int

custom(expr)[source]

Apply a raw pandas query string on the metadata columns. Available: design_id, run, batch, T1–T6, x1–x6, y1–y6,

xs1–xs4, ys1–ys4, zs1–zs6, r5, r6, V

Example: f.custom(“V > 4.5 and T1 < 80”)

Parameters:

expr (str)

Return type:

MetadataFilter

get_dataframe()[source]

Return filtered metadata as a DataFrame.

Return type:

pandas.DataFrame

get_design_ids()[source]

Return design IDs matching the current filter.

Return type:

list[int]

load(num_samples=None, data_dir='Cooldataset')[source]

Download samples matching the current filter.

Parameters:
  • num_samples (cap on number of samples. Downloads all matches if None.)

  • data_dir (local directory for downloaded files.)

Parameters:
  • num_samples (int)

  • data_dir (str | Path)

load_by_ids(design_ids, data_dir='Cooldataset')[source]

Download specific samples by design ID.

Example

>>> ds = f.load_by_ids([125002, 125037, 212515])
Parameters:
  • design_ids (list[int])

  • data_dir (str | Path)

load_by_run(run_name, num_samples=None, data_dir='Cooldataset')[source]

Download samples from a specific run. Available runs: run_1, run_3, run_4, run_6, run_7

Parameters:
  • run_name (e.g. “run_1”)

  • num_samples (optional cap.)

Parameters:
  • run_name (str)

  • num_samples (int)

  • data_dir (str | Path)

load_random(n, data_dir='Cooldataset', seed=None)[source]

Download n randomly selected samples (respects active filters).

Parameters:
  • n (number of samples to download.)

  • seed (optional random seed for reproducibility.)

Parameters:
  • n (int)

  • data_dir (str | Path)

  • seed (int)

n_bodies(exactly=None, min=None, max=None)[source]

Filter by total number of active bodies (quads + cylinders). A body is inactive when y == 1.0.

Parameters:
  • exactly (int)

  • min (int)

  • max (int)

Return type:

MetadataFilter

n_cylinders(exactly=None, min=None, max=None)[source]

Filter by number of active cylinders (bodies 5–6). A body is inactive when y == 1.0.

Parameters:
  • exactly (int)

  • min (int)

  • max (int)

Return type:

MetadataFilter

n_quads(exactly=None, min=None, max=None)[source]

Filter by number of active quads (bodies 1–4). A body is inactive when y == 1.0.

Parameters:
  • exactly (int)

  • min (int)

  • max (int)

Return type:

MetadataFilter

position(body, x_min=None, x_max=None, y_min=None, y_max=None)[source]

Filter by position of a specific body (1–6).

Parameters:
  • body (int)

  • x_min (float)

  • x_max (float)

  • y_min (float)

  • y_max (float)

Return type:

MetadataFilter

radius(cylinder, min=None, max=None)[source]

Filter by radius of a cylinder body (5 or 6).

Parameters:
  • cylinder (int)

  • min (float)

  • max (float)

Return type:

MetadataFilter

reset()[source]

Clear all filters.

Return type:

MetadataFilter

run(*run_names)[source]

Restrict to samples from specific runs. Available runs: run_1, run_3, run_4, run_6, run_7

Example: f.run(“run_1”, “run_3”)

Parameters:

run_names (str)

Return type:

MetadataFilter

size(quad, xs_min=None, xs_max=None, ys_min=None, ys_max=None)[source]

Filter by x/y size of a quad body (1–4).

Parameters:
  • quad (int)

  • xs_min (float)

  • xs_max (float)

  • ys_min (float)

  • ys_max (float)

Return type:

MetadataFilter

summary()[source]

Print a summary of the dataset and current filter match count.

Return type:

None

temperature(body=None, min=None, max=None)[source]

Filter by temperature (range: 20.0 – 80.0). body=None : at least one body must satisfy the range. body=1–6 : only that specific body is checked.

Parameters:
  • body (int)

  • min (float)

  • max (float)

Return type:

MetadataFilter

velocity(min=None, max=None)[source]

Filter by inlet velocity V (range: 1.0 – 7.0).

Parameters:
  • min (float)

  • max (float)

Return type:

MetadataFilter

Parameters:

metadata_path (str | Path)

class cooldata.metadata.Position(x, y, z)[source]

Bases: NamedTuple

Represents a 3D position. Is always the center of a body.

Parameters:
  • x (float)

  • y (float)

  • z (float)

x: float

Alias for field number 0

y: float

Alias for field number 1

z: float

Alias for field number 2

class cooldata.metadata.Quader(temperature, position, size_x, size_y, size_z)[source]

Bases: object

Represents a quader (rectangular prism) with its properties.

Parameters:
  • temperature (float)

  • position (Position)

  • size_x (float)

  • size_y (float)

  • size_z (float)

class cooldata.metadata.SystemParameters(quads, cylinders, inflow_velocity)[source]

Bases: object

Holds the parameters for a system of quaders, cylinders, and inflow velocity.

Parameters:
  • quads (List[Quader])

  • cylinders (List[Cylinder])

  • inflow_velocity (float)

static from_dataframe_row(row)[source]

Creates a SystemParameters object from a pandas DataFrame row. Columns expected: T1-T6, x1-x6, y1-y6, xs1-xs4, ys1-ys4,

zs1-zs6, r5-r6, V.

z-positions default to 0.0 if not present.

Parameters:

row (pandas.Series)

Return type:

SystemParameters

cooldata.metadata.df_row_to_system_parameters(df, design_id)[source]

Create a SystemParameters object for a given design_id from a DataFrame. Expects a ‘design_id’ column.

Parameters:
  • df (pandas.DataFrame)

  • design_id (int)

Return type:

SystemParameters

cooldata.pyvista_flow_field_dataset module

class cooldata.pyvista_flow_field_dataset.PyvistaFlowFieldDataset(samples)[source]

Bases: object

The main class for working with the cooldata dataset.

Parameters:

samples (list[PyvistaSample])

add_metadata(metadata_df)[source]

Adds metadata to the samples from a pandas DataFrame. The DataFrame should have a column ‘design_id’ that matches the design ID of the samples.

Parameters:

metadata_df (pandas.DataFrame)

Return type:

None

get_bounds()[source]

Returns the bounding box of the volume data. The bounding box is a six-tuple (xmin, xmax, ymin, ymax, zmin, zmax).

classmethod load_from_huggingface(data_dir, num_samples=3)[source]

Download the given number of samples from huggingface to data_dir. Args: - data_dir: The directory to download the data to. - num_samples: The number of samples to download

Parameters:

data_dir (str | Path)

Return type:

PyvistaFlowFieldDataset

load_to_memory()[source]

Load all samples into memory.

shuffle()[source]

Shuffles the dataset in place.

slice(start, end)[source]

Returns a slice of the dataset.

Parameters:
  • start (int)

  • end (int)

classmethod try_from_directory(data_dir, num_samples)[source]
Parameters:
  • data_dir (str | Path)

  • num_samples (int)

Return type:

None | PyvistaFlowFieldDataset

unload()[source]

Unload all samples from memory.

class cooldata.pyvista_flow_field_dataset.PyvistaSample(volume_path, surface_path, metadata=None)[source]

Bases: object

A PyVista sample representing a 3D flow field dataset. The data is stored on disk and can be loaded to a PyVista object when needed

Parameters:
  • volume_path (str | Path)

  • surface_path (str | Path)

  • metadata (SystemParameters | None)

property design_id: int

Returns the design ID of the sample, which is extracted from the file name. The design ID is assumed to be the second last part of the file name, split by underscores.

get_bounding_box()[source]

Returns the bounding box of the volume data. The bounding box is a six-tuple (xmin, xmax, ymin, ymax, zmin, zmax).

get_labeled_surface_points()[source]

Returns the surface points of the dataset with their block index as a numpy array.

Returns:

np.ndarray: The labeled points of the dataset. Shape: (n_points, 4)

Return type:

numpy.ndarray

get_points()[source]

Returns the points of the dataset as a numpy array.

Returns:

np.ndarray: The points of the dataset. Shape: (n_points, 3)

Return type:

numpy.ndarray

get_surface_points(block_index)[source]

Returns the points of the surface dataset as a numpy array.

Returns:

np.ndarray: The points of the surface dataset. Shape: (n_points, 3)

Parameters:

block_index (int)

Return type:

numpy.ndarray

property is_loaded: bool

Returns True if the volume and surface data are loaded, False otherwise.

load()[source]
plot_surface(field)[source]
Parameters:

field (Literal['AreaMagnitude', 'HeatTransferCoefficient', 'Normal_0', 'Normal_1', 'Normal_2', 'Temperature', 'Pressure', 'WallShearStressMagnitude', 'WallShearStress_0', 'WallShearStress_1', 'WallShearStress_2'])

plot_volume(field)[source]
Parameters:

field (Literal['Velocity_0', 'Velocity_1', 'Velocity_2', 'Pressure', 'Temperature', 'TurbulentKineticEnergy', 'TurbulentDissipationRate'])

property surface_data
unload()[source]
property volume_data
cooldata.pyvista_flow_field_dataset.get_sample_bounds(sample)[source]

cooldata.voxel_flow_field_dataset module

class cooldata.voxel_flow_field_dataset.DefaultVoxelDataset(ds)[source]

Bases: Dataset

Parameters:

ds (VoxelFlowFieldDataset)

cooldata.voxel_flow_field_dataset.Normalization

A dictionary that maps field names to tuples of (mean, std) for normalization.

alias of dict[Literal[‘Pressure’, ‘Temperature’, ‘Velocity’, ‘Position’, ‘TurbulentKineticEnergy’, ‘TurbulentDissipationRate’], tuple[list[float], list[float]] | tuple[float, float]]

class cooldata.voxel_flow_field_dataset.VoxelFlowFieldDataset(cache_dir, config=None, resume_loading_from_cache=True)[source]

Bases: Dataset

Parameters:
compute_normalization()[source]
Return type:

dict[Literal[‘Pressure’, ‘Temperature’, ‘Velocity’, ‘Position’, ‘TurbulentKineticEnergy’, ‘TurbulentDissipationRate’], tuple[list[float], list[float]] | tuple[float, float]]

get_default_loadable_dataset()[source]

Get a dataset that returns the mask as X and all flow features concatenated as Y

normalize()[source]

Normalizes the dataset in place.

prediction_to_sample(mask, Y)[source]

Converts a prediction to a sample. The mask is used to create a new sample with the same bounding box and resolution as the original dataset.

Args: - mask: The mask of the prediction. Shape: (resolution_x, resolution_y, resolution_z) - Y: The prediction. Shape: (resolution_x, resolution_y, resolution_z, 5)

Parameters:
  • mask (Tensor)

  • Y (Tensor)

samples: list[VoxelFlowFieldSample]
shuffle()[source]

Shuffles the dataset in place.

slice(start, end)[source]

Returns a slice of the dataset.

Args: - start: The start index of the slice. - end: The end index of the slice.

Returns: A new VoxelFlowFieldDataset containing the specified slice.

Parameters:
  • start (int)

  • end (int)

unnormalize()[source]

Unnormalizes the dataset in place.

class cooldata.voxel_flow_field_dataset.VoxelFlowFieldDatasetConfig(pyvista_dataset, resolution=(32, 32, 32))[source]

Bases: object

Configuration for creating a VoxelFlowFieldDataset from a PyvistaFlowFieldDataset.

Parameters:
pyvista_dataset: PyvistaFlowFieldDataset
resolution: tuple[int, int, int] = (32, 32, 32)
class cooldata.voxel_flow_field_dataset.VoxelFlowFieldSample(path, bounding_box, resolution, normalization=None)[source]

Bases: object

Parameters:
  • path (str)

  • bounding_box (tuple[float, float, float, float, float, float])

  • resolution (tuple[int, int, int])

  • normalization (dict[Literal['Pressure', 'Temperature', 'Velocity', 'Position', 'TurbulentKineticEnergy', 'TurbulentDissipationRate'], tuple[list[float], list[float]] | tuple[float, float]] | None)

property Y
property data
classmethod from_mask_y(mask, Y, bounding_box, resolution, save_path, normalization=None)[source]
Parameters:
  • mask (Tensor)

  • Y (Tensor)

  • bounding_box (tuple[float, float, float, float, float, float])

  • resolution (tuple[int, int, int])

  • save_path (str)

  • normalization (dict[Literal['Pressure', 'Temperature', 'Velocity', 'Position', 'TurbulentKineticEnergy', 'TurbulentDissipationRate'], tuple[list[float], list[float]] | tuple[float, float]] | None)

Return type:

VoxelFlowFieldSample

classmethod from_pyvista(sample, save_path, resolution, bounding_box)[source]

Interpolates the volume data from the sample to a voxel grid and saves it to a file.

Parameters:
  • sample (PyvistaSample)

  • save_path (str)

  • resolution (tuple[int, int, int])

  • bounding_box (tuple[float, float, float, float, float, float])

Return type:

VoxelFlowFieldSample

get_field(field, normalized=True)[source]

Returns the specified field of the flow field as a torch.Tensor. Shape: - Pressure, Temperature: (resolution_x, resolution_y, resolution_z) - Velocity, Position: (resolution_x, resolution_y, resolution_z, 3)

Parameters:

field (Literal['Pressure', 'Temperature', 'Velocity', 'Position', 'TurbulentKineticEnergy', 'TurbulentDissipationRate'])

Return type:

Tensor

load()[source]
property mask
plot(field)[source]
Parameters:

field (Literal['Pressure', 'Temperature', 'Velocity', 'Position', 'TurbulentKineticEnergy', 'TurbulentDissipationRate'])

plot_slice(field, slice_idx=None, axis='z')[source]

Plots a slice of the field at the specified index along the specified axis. Args: - field: The field to plot. - slice_idx: The index of the slice to plot. If None, the middle slice is used. - axis: The axis along which to plot the slice. Can be “x”, “y”, or “z”.

Parameters:
  • field (Literal['Pressure', 'Temperature', 'Velocity', 'Position', 'TurbulentKineticEnergy', 'TurbulentDissipationRate'])

  • slice_idx (int | None)

  • axis (Literal['x', 'y', 'z'])

plot_slice_interactively(field, axis='z')[source]

Plots a slice of the field at the specified index along the specified axis. Args: - field: The field to plot. - axis: The axis along which to plot the slice. Can be “x”, “y”, or “z”.

Parameters:
  • field (Literal['Pressure', 'Temperature', 'Velocity', 'Position', 'TurbulentKineticEnergy', 'TurbulentDissipationRate'])

  • axis (Literal['x', 'y', 'z'])

to_pyvista()[source]
unload()[source]