iota.dataset

Description This module provides the methods to load, access, interrogate the data from the simulation datasets. It also provides methods to a new data (e.g. custom results) to a dataset.

Loading datasets

Accessing data

Interrogating the data

Adding and deleting data

Loads a dataset from an existent ANSYS Fluent simulation. The simulation can contain DPM dataset

Parameters

  • case_files: ([str]) a list of file path/s to the case file/s of the ANSYS Fluent simulation (Default: None)

  • data_files: ([str]) a list of file path/s to the data file/s of the ANSYS Fluent simulation (Default: None)

  • encase_files: ([str]) a list of file path/s to the encas Ensight file/s exported from the ANSYS Fluent simulation with the DPM data (Default: None)

  • metadata: (str) file path to the metadata for the dataset (Default: None)

  • calculate_minmax: (bool) enables the calculation of the global min and max value for each result when loading the dataset (Default: False)

Returns

Examples Loading a single case file and a single data file

my_dataset = iota.dataset.load_fluent(
    case_files = ['C:\Users\Stephen\MySimulation\my_fluent_simulation.cas.gz'],
    data_files = ['C:\Users\Stephen\MySimulation\my_fluent_simulation.dat.gz']
)

Loading a single case file and multiple data files

my_dataset = iota.dataset.load_fluent(
    case_files = ['C:\Users\Stephen\MySimulation\my_fluent_simulation.cas.gz'],
    data_files = ['C:\Users\Stephen\MySimulation\my_fluent_simulation-100.dat.gz',
        'C:\Users\Stephen\MySimulation\my_fluent_simulation-200.dat.gz',
        'C:\Users\Stephen\MySimulation\my_fluent_simulation-300.dat.gz']
)

Loading a single case file, a single data file and a encase file with the DPM data

my_dataset = iota.dataset.load_fluent(
    case_files = ['C:\Users\Stephen\MySimulation\my_fluent_simulation.cas.gz'],
    data_files = ['C:\Users\Stephen\MySimulation\my_fluent_simulation.dat.gz'],
    encase_files = [''C:\Users\Stephen\MySimulation\my_dpm_data.new.encas']
)

Loading a single case file, multiple data files and specifying the path for the metadata file to be generated

my_dataset = iota.dataset.load_fluent(
    case_files = ['C:\Users\Stephen\MySimulation\my_fluent_simulation.cas.gz'],
    data_files = ['C:\Users\Stephen\MySimulation\my_fluent_simulation-100.dat.gz',
        'C:\Users\Stephen\MySimulation\my_fluent_simulation-200.dat.gz',
        'C:\Users\Stephen\MySimulation\my_fluent_simulation-300.dat.gz'],
    metadata = 'C:\Users\Stephen\MySimulation\my_fluent_simulation_metadatafile.json'
)

Loading the dataset using an existing metadata file previously generated by Iota

my_dataset = iota.dataset.load_fluent(
   metadata = 'C:\Users\Stephen\MySimulation\my_fluent_simulation_metadatafile.json'
)

Loading a single case file and multiple data files with goblal min and max calculation for the results enabled

my_dataset = iota.dataset.load_fluent(
    case_files = ['C:\Users\Stephen\MySimulation\my_fluent_simulation.cas.gz'],
    data_files = ['C:\Users\Stephen\MySimulation\my_fluent_simulation-100.dat.gz',
        'C:\Users\Stephen\MySimulation\my_fluent_simulation-200.dat.gz',
        'C:\Users\Stephen\MySimulation\my_fluent_simulation-300.dat.gz'],
    calculate_minmax=True
)

Loads a dataset from an existent EDEM simulation

Parameters

  • edem_file: (str) file path to the .dem file of the EDEM simulation (Default: None)

  • metadata: (str) file path to the metadata for the dataset (Default: None)

  • calculate_minmax: (bool) enables the calculation of the global min and max value for each result when loading the dataset (Default: False)

Returns

Examples Loading a EDEM simulation

my_dataset = iota.dataset.load_edem(
    edem_file = 'C:\Users\Stephen\MyEDEMSimulation\my_edem_simulation.dem',
)

Loading a EDEM simulation and specifying the path for the metadata file to be generated

my_dataset = iota.dataset.load_edem(
    edem_file = 'C:\Users\Stephen\MyEDEMSimulation\my_edem_simulation.dem',
    metadata = 'C:\Users\Stephen\MyEDEMSimulation\my_edem_simulation_metadatafile.json
)

Loading the dataset using an existing metadata file previously generated by Iota

my_dataset = iota.dataset.load_edem(
   metadata = 'C:\Users\Stephen\MyEDEMSimulation\my_edem_simulation_metadatafile.json'
)

Loading a EDEM simulation with goblal min and max calculation for the results enabled

my_dataset = iota.dataset.load_edem(
    edem_file = 'C:\Users\Stephen\MyEDEMSimulation\my_edem_simulation.dem',
    calculate_minmax=True
)

Loads dataset in Particle Analytics format: coarse-graining (pacg) or DEM (padem)

Parameters

  • metadata: (str) file path to the metadata for the dataset

Returns

Examples Loading a coarse-graining dataset

my_dataset = iota.dataset.load_pa(
    metadata = 'C:\Users\Stephen\MyPACGDataset\my_coarse_graining_dataset.json',
)

Loading a DEM dataset in Particle Analytics formart

my_dataset = iota.dataset.load_pa(
    metadata = 'C:\Users\Stephen\MyPADEMDataset\my_padem_dataset.json',
)

Dataset class object. This is returned by all the iota.dataset.load_ methods*

Parameters

  • filename: (str) file path of the dataset (extension .meta required)

  • mode: (IO_Type) access mode: WRITE or READ_ONLY. (Default: iota.IO_Type.WRITE)

Example

my_dataset = iota.dataset.Dataset(
    filename = 'C:\Users\Stephen\MyDatasets\my_new_dataset.meta',
    mode = iota.IO_Type.WRITE
)

Methods

Get the name of the dataset

Returns

  • A string with name of the dataset

Example

name = my_dataset.name()
print(name)

Get the software of the dataset

Returns

  • A string with name of the software of the dataset

Example

dataset_software = my_dataset.software()
print(dataset_software)

Get type of the dataset

Returns

  • A value of type iota.DatasetType

Example

dataset_type = my_dataset.type()
print(dataset_type)

Get the format of the dataset reader

Returns

  • A string with the internal reader format

Example

dataset_reader_format = my_dataset.reader_format()
print(dataset_reader_format)

Get the list of timesteps of the dataset

Returns

  • A list of strings that contains the timesteps of the dataset

Example

dataset_timesteps = my_dataset.timesteps()
print(dataset_timesteps)

Check the existence of a given step on a given mesh

Parameters

  • timestep : (int) timestep index to be checked

  • mesh : (str) name of the mesh to be checked

Returns

  • A boolean value True if timestep exists, or False otherwise

Example

mesh_exists_at_timestep = my_dataset.timestep_exists(timestep=0, mesh='my_mesh')
print(mesh_exists_at_timestep)

Get the number of timesteps for a given mesh

Parameters

  • mesh : (str) name of the mesh

Returns

  • The number of timesteps as an integer

Example

Number_timesteps_for_mesh = my_dataset.timesteps_count(mesh='my_mesh')
print(Number_timesteps_for_mesh)

Get the global maximum value for a given result and analysis for the whole simulation dataset

Parameters

  • result : (str) name of the result

  • analysis : (str) name of the analysis

Returns

  • A float if the result type is scalar, or a numpy.ndarray of floats if the result have more than one component

Example

result_max = my_dataset.result_max(result='Density', analysis='none')
print(result_max)

Get the global minimum value for a given result and analysis for the whole simulation dataset

Parameters

  • result : (str) name of the result

  • analysis : (str) name of the analysis

Returns

  • A float if the result type is scalar, or a numpy.ndarray of floats if the result have more than one component

Example

result_min = my_dataset.result_min(result='Density', analysis='none')
print(result_min)

Get the type of the result for a given result and analysis

Parameters

  • result : (str) name of the result

  • analysis : (str) name of the analysis

Returns

  • A value of type iota.ResultType representing the type of the result

Example

result_type = my_dataset.result_max(result='Density', analysis='none')
print(result_type)

Get the list of all results in the dataset for all the meshes, or for a given mesh

Parameters

  • mesh : (str) name of the mesh (Default: None)

Returns

  • A list of strings if none mesh name is provided , or a list of (string,string) pairs with result name and analysis if a mesh name is provided*

Example

results_list = my_dataset.results()
print(results_list)

result_list_mesh = my_dataset.results(mesh='my_mesh')
print(results_list_mesh)

Get the number of results for for a specific mesh

Parameters

  • mesh : (str) name of the mesh

Returns

  • An integer that corresponds to the number of results for the specified mesh

Example

Number_results_mesh = my_dataset.results_count(mesh='my_mesh')
print(Number_results_mesh)

Check the existence of a given result and analysis at a given timestep and mesh

Parameters

  • step : (int) timestep index

  • mesh : (str) mesh name

  • result : (str) result name

  • analysis : (str) analysis name

Returns

  • A bool indicating if the result exists at the given timestep and mesh

Example

result_exists = my_dataset(ste0=0, mesh='my_mesh',result='Density', analysis='none')
print(result_exists)

Get the list of values per vertex/particle of a given result,analysis and component at a given step and mesh

Parameters

  • step : (int) timestep index

  • mesh : (str) mesh name

  • result : (str) result name

  • analysis : (str) analysis name

  • component : (int) component index

Returns

  • A value of type numpy.ndarray of floats that contains the values of the component of the result. If component is iota.ALL_COMPONENTS, all components of the result are returned.

Example

result_component_values = my_dataset.get_result_component(step=1, mesh='my_mesh', result='Velocity',analysis='none', component=2)
print(result_component_values)

Get the minimum value of a result and analysis at a given step and mesh

Parameters

  • step : (int) timestep index

  • mesh : (str) mesh name

  • result : (str) result name

  • analysis : (str) analysis name

Returns

  • A float if the result type is scalar, or a numpy.ndarray of floats if the result have more than one component .

Example

result_min_value = my_dataset.get_result_min(step=1, mesh='my_mesh', result='Velocity', analysis='none')
print(result_min_value)

Get the maximum value of a result and analysis at a given step and mesh

Parameters

  • step : (int) timestep index

  • mesh : (str) mesh name

  • result : (str) result name

  • analysis : (str) analysis name

Returns

  • A float if the result type is scalar, or a numpy.ndarray of floats if the result have more than one component .

Example

result_max_value = my_dataset.get_result_max(step=1, mesh='my_mesh', result='Velocity', analysis='none')
print(result_max_value)

Get the values of the component of a result and analysis at given step and mesh ad result/analysis. It also calculates the minimum and maximum values

Parameters

  • step : (int) timestep index

  • mesh : (str) mesh name

  • result : (str) result name

  • analysis : (str) analysis name

  • component : (int) component index

Returns

  • A tuple composed of

    • A numpy.ndarray of floats with the values of the component of the result

    • A float that corresponds to the minimum value of the component of the result, float)**

    • A float that corresponds to the maximum value of the component of the result, float)**

Example

result_min_max = my_dataset.get_result_component_minmax(step=1, mesh='my_mesh', result='Velocity', analysis='none', component=2)
print(result_min_max)

Get the metadata information of a given result and analysis. The information includes the result type, the result name, the analysis name and the list of meshes that have the given result-analysis.

Parameters

  • result : (str) result name

  • analysis : (str) analysis name

Returns

  • A dictionary containing the metadata information of the result

Example

result_info = my_dataset.result_info(result='Velocity', analysis='none')
print(result_info)

Get the label for the components of a given result-analysis

  • result : (str) result name

  • analysis : (str) analysis name

Returns

  • A list of strings with the label for each of the components of the result-analysis

Example

result_interpreter = my_dataset.result_interpreter(result='Velocity', analysis='none')
print(result_interpreter)

Get the title of the legend of a given result, analysis and component.

Parameters

  • result : (str) result name

  • analysis : (str) analysis name

  • component : (int or iota.ALL_COMPONENTS) component index or all components type

Returns

  • A string with the title of the legend the label for a given result/analysis, including result name, component and units (if available). If component is iota.ALL_COMPONENTS, a list of strings with legend for each component is returned.

Examples

Getting the title of the legend for only one component of a result-analysis

result_legend = my_dataset.result_legend(result='Velocity', analysis='none', component=0)
print(result_legend)

Getting the title of the legends for all the components of a result-analysis

result_legend = my_dataset.result_legend(result='Velocity', analysis='none', component=iota.ALL_COMPONENTS)
print(result_legend)

Get the titles of the legend for all components of a given result, analysis.

Parameters

  • result : (str) result name

  • analysis : (str) analysis name

Returns

  • A list of strings with the titles of the legend for each component.

Example

result_legends = my_dataset.result_legends(result='Velocity', analysis='none')
print(result_legends)

Get result type Returns a variable of type iota.ResultType

  • result : (str) result name

  • analysis : (str) analysis name

Example

result_type = my_dataset.get_result_type('Velocity','none')
print(result_type)

Get the values of a given result and analysis at a given step and mesh

Parameters

  • step : (int) timestep index

  • mesh : (str) mesh name

  • result : (str) result name

  • analysis : (str) analysis name

Returns

  • A numpy.ndarray of floats with the values of the result

Example

result_values = my_dataset.get_result(step=5, mesh='my_mesh', result='Velocity', analysis='none')

Get the type of a given mesh contained in the dataset

Parameters

  • mesh : (str) mesh name

Returns

  • A variable of type iota.MeshType

Example

mesh_type = my_dataset.mesh_type(mesh='my_mesh')
print(mesh_type)

Get the list of meshes in the dataset

Returns

  • A list of strings with the name of the meshes

Example

meshes_name = my_dataset.meshes()
print(meshes_name)

Get a mesh for a given mesh name and step in the dataset

Parameters

  • mesh : (str) mesh name

  • step : (int) timestep index

Returns

  • A variable of type iota.mesh.Mesh

Example

mesh = my_dataset.get_mesh(mesh='my_mesh', step=0)
print(mesh)

Get the position (x,y,z) of the vertices of mesh at a given step

Parameters

  • mesh : (str) mesh name

  • step : (int) timestep index

Returns

  • An numpy.ndarray of floats array containing the position [x,y,z] of each vertex in the mesh

Example

mesh_vertices = my_dataset.get_mesh_vertices(mesh='my_mesh', step=0)
print(mesh_vertices)

Get the metadata information on a given mesh. This includes the mesh name, mesh type and if the mesh is dynamic.

Parameters

  • mesh : (str) mesh name

Returns

  • A dictionary containing the metadata information

Example

mesh_info = my_dataset.get_mesh_info(mesh='my_mesh')
print(mesh_info)

Get the value of an attribute/variable of mesh of particles at a given step

Parameters

  • step : (int) timestep index

  • mesh : (str) particles mesh name

  • variable : (str) name of one of the following variables of a particles mesh:

    • 'id': particles identifier

    • 'group': particles group identifier

    • 'position': position (x,y,z) of the center of the particles

    • 'orientation': orientation of the particles as a quaternion (q0, q1, q2, q3)

    • 'diameter': diameter of the particles

    • 'mass': mass of the particles

    • 'volume': volume of the particles

    • 'velocity': velocity (vx,vy, vz) of the particles

    • 'spheres': position (x,y,z) and radius of the spheres of the particles

Returns

  • A numpy.ndarray of floats with the values of the variable for each particle in the mesh

Example

particle_mesh_variable = my_dataset.get_particles_mesh(step=3, mesh='my_particles_mesh', variable='position')

Get the value of the component of a result and analysis at a given point (x,y,z) in the space and at a given step/s in the dataset

Parameters

  • mesh : (str) mesh name

  • point : (list of floats or numpy.ndarray of floats) point (x,y,z) to evaluate the result

  • result : (str) result name

  • analysis : (str) analysis name

  • component : (int) component index

  • step : (int or iota.ALL_STEPS) timestep index (Default: iota.ALL_STEPS)

Returns

  • A tuple that contains:

    • A list of floats with the values of the timestep/s

    • A list that contains a list of floats with the values of component of the result-analysis at the given point and at each timestep

Example

Getting the value of the magnitude of the velocity in the mesh named 'my_mesh', at point (0,0.1,0.5) and at the 5th step of the dataset

ts, y = my_dataset.statistics_evolution(mesh='my_mesh', point=[0,0.1,0.5], result='Velocity', analysis='none', component=3, step=4)
print(x)
print(y)

Getting the values of the magnitude of the velocity in the mesh named 'my_mesh' and over all timesteps of the dataset at point (0,0.1,0.5)

ts, y = my_dataset.statistics_evolution(mesh='my_mesh', point=[0,0.1,0.5], result='Velocity', analysis='none', component=3, step=iota.ALL_STEPS)
print(x)
print(y)

Get the temporal evolution of different statistical variables at the nodes/vertices of a given mesh, result, analysis and component

Parameters

  • mesh : (str) mesh name

  • result : (str) result name

  • analysis : (str) analysis name

  • component : (int) component index

  • step : (int) timestep index (Default: iota.ALL_STEPS)

  • data : (list[str]) list of statistical values to be evaluated (Default: []):

    • 'min': minimum value

    • 'max': maximum value

    • 'mean': arithmetic mean value

    • 'stdev': standard deviation value

    • 'median': median value

    • 'cov': coefficient of variance value

Returns

  • A tuple that contains:

    • A list of floats with the values of the timestep/s

    • A list that contains a list of floats with the values of statistical variables at each timestep/s.

Example

Getting the minimum, maximum and mean value of the magnitude of the velocity at the nodes/vertices of the mesh named 'my_mesh' and at the 5th step of the dataset

ts, y = my_dataset.statistics_evolution(mesh='my_mesh', result='Velocity', analysis='none', component=3, step=4, data=['min','max', 'mean'])
print(x)
print(y)

Getting the minimum, maximum and mean value of the magnitude of the velocity at the nodes/vertices of the mesh named 'my_mesh' over all the timesteps of the dataset

ts, y = my_dataset.statistics_evolution(mesh='my_mesh', result='Velocity', analysis='none', component=3, step=iota.ALL_STEPS,data=['min','max', 'mean'])
print(x)
print(y)

Extract the values of the component of result-analysis along a line defined by a given start and end point and at given timestep and mesh in the dataset

Parameters

  • mesh : (str) mesh name

  • point_start : (list of floats or numpy.ndarray of floats) point (x,y,z) that defined the start of the line

  • point_end : (list of floats or numpy.ndarray of floats) point (x,y,z) that defined the end of the line

  • num_points : (int) number of points along the line to extract the values

  • result : (str) result name

  • analysis : (str) analysis name

  • component : (int) component index

  • step : (int) timestep index

  • x_type : (str) defines the variable to be used to represent the position of the points in the line (Default: 'dist'):

    • 'x': uses the x-position of the points

    • 'y': uses the y-position of the points

    • 'z': uses the z-position of the points

    • 'dist': uses the distance from the point to the start point

Returns

  • A tuple that contains:

    • A list of floats with the values that represent the position of the points in the line

    • A list that contains a list of floats with the values of the component of the result-analysis at the points along the defined line

Example

Getting the values of the magnitude of the velocity for the mesh called 'my_mesh' at the 6th timestep in the dataset and along a line that goes from (0,0,0) to (0,0,2.5)

x, y = my_dataset.line_variation(mesh='my_mesh', point_start=[0,0,0], point_end=[0,0,2.5], num_points=50, result='Velocity', analysis='none', component=3, step=5, x_type = 'z')
print(x)
print(y)

Get the temporal evolution integral of the component of a result-analysis over a given mesh. Volume integral is calculated for the volumetric meshes. In the case of surface meshes, the surface integral is computed.

Parameters

  • mesh : (str) mesh name

  • result : (str) result name

  • analysis : (str) analysis name

  • component : (int) component index

  • step : (int) timestep index (Default: iota.ALL_STEPS)

Returns

  • A tuple that contains:

    • A list of floats with the values of the timestep/s

    • A list that contains a list of floats with the values of the integral of the component of the result-analysis over the specified mesh at the timestep/s

Example

Getting the value of the integral of the magnitude of the velocity over the mesh called 'my_mesh' and at the 6th timestep in the dataset

x, y = my_dataset.mesh_integral(mesh='my_mesh', result='Velocity', analysis='none', component=3, step=5)
print(x)
print(y)

Getting the temporal evolution of the integral of the magnitude of the velocity over the mesh called 'my_mesh'

x, y = my_dataset.mesh_integral(mesh='my_mesh', result='Velocity', analysis='none', component=3)
print(x)
print(y)

Set the name of the dataset

Parameters

  • name : (str) new name for the dataset

Example

my_dataset.set_name('new name')
print(my_dataset.name())

Adds a mesh of particles to an existing step in the dataset

Parameters

  • step : (int) timestep index

  • mesh : (iota.mesh.DEM_Mesh) a mesh of particles object

  • name : (str) name for the mesh of particles (Default: 'particles')

Example

Adding a new mesh of particles to the 1st step of the dataset

my_dataset.add_dem_mesh(step=0, mesh=my_DEM_particles_mesh)

Adding a new mesh of particles to be called 'my_new_particles' to the 1st step of the dataset

my_dataset.add_dem_mesh(step=0, mesh=my_DEM_particles_mesh, name='my_new_particles')

Add a mesh to an existing step in the dataset

Parameters

  • step : (int) timestep index or iota.STATIC_MESH if the mesh to be added is static

  • mesh : (iota.mesh.Mesh) mesh to be added to the dataset

Examples

Adding a new mesh to the 6th timestep of the dataset

my_dataset.add_mesh(step=5, mesh=my_mesh)

Adding a static mesh to the dataset

my_dataset.add_mesh(step=iota.STATIC_MESH, mesh=my_static_mesh)

Add a result to an existing mesh and step in the dataset

Parameters

  • step : (int) timestep index

  • mesh : (str) mesh name

  • result : (str) result name

  • analysis : (str) analysis name

  • data : (numpy.ndarray of floats) array of results to be added.

Example

my_dataset.add_result(step=5, mesh='my_mesh', result='my_new_result', analysis='none', data=my_new_result_data)

Creates a slice/cut-plane of an existing mesh in the dataset. The slice is defined by the vector (nx, ny, nz) representing the normal direction to the plane of the slice and the position (x,y,z) of the point that defines the origin of the slice. The values of the results-analyses present in the dataset are interpolated at the nodes of the mesh of the slice. The mesh of the slice and its interpolated results are automatically added to the dataset as new mesh

Parameters

  • mesh : (str) name of the mesh to be cut

  • normal : (list of floats or a numpy.ndarray of floats) vector (nx,ny,nz) representing the normal direction to define the slice/cut-plane

  • origin : (iota.Vector3d) vector contained in the slice/cut-plane plane

  • result : (str) name of an existing result in the dataset to be interpolated on the slice/cut-plane. If empty, all results in the dataset are included (Default: '')

  • analysis : (str) name of the analysis of an existing result in the dataset. If empty, all analysis are included (Default: '')

  • step : (int) timestep index (Default: iota.ALL_STEPS)

Returns

  • A string that corresponds to the name of the new mesh that represents the slice

Examples

Creating a slice of the mesh called 'my_mesh', with normal vector pointing the z-axis and centered at position (0,0,0) for all timesteps and results-analyses

my_dataset.add_slice(mesh='my_mesh', normal=[0,0,1], origin=[0,0,0])

Creating a slice of the mesh called 'my_mesh', with normal vector pointing the z-axis and centered at position (0,0,0) for all timesteps and only for the result velocity of the analysis 'phase-1'

my_dataset.add_slice(mesh='my_mesh', normal=[0,0,1], origin=[0,0,0], result='Velocity', analysis='phase-1')

Creating a slice of the mesh called 'my_mesh', with normal vector pointing the z-axis and centered at position (0,0,0) for only the 4th timestep and the result velocity of the analysis 'phase-1'

my_dataset.add_slice(mesh='my_mesh', normal=[0,0,1], origin=[0,0,0], result='Velocity', analysis='phase-1', step=3)

Add a new timestep to the dataset

Parameters

  • timestep : (str) timestep to be added

Returns

  • An integer that corresponds to the index of the new timestep in the dataset

Example

ts_index = my_dataset.add_timestep(timestep='15.65')
print(ts_index)
print(my_dataset.timesteps())

Delete an existing mesh from the dataset

Parameters

  • mesh : (str) mesh name

Example

my_dataset.delete_mesh(mesh='my_mesh')

Check if a mesh deletion process in the dataset has finished

Returns

  • A tuple that contains:

    • A bool with the status of the mesh deletion process. If the process finished correctly, the bool is True.

    • A string with a message in case an error occurred during the mesh deletion process.

Example

status, msg = my_dataset.delete_mesh_finished()
print(status, msg)

Last updated