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
Dataset
: a dataset object
Examples Loading a single case file and a single data file
Loading a single case file and multiple data files
Loading a single case file, a single data file and a encase file with the DPM data
Loading a single case file, multiple data files and specifying the path for the metadata file to be generated
Loading the dataset using an existing metadata file previously generated by Iota
Loading a single case file and multiple data files with goblal min and max calculation for the results enabled
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
Dataset
: a dataset object
Examples Loading a EDEM simulation
Loading a EDEM simulation and specifying the path for the metadata file to be generated
Loading the dataset using an existing metadata file previously generated by Iota
Loading a EDEM simulation with goblal min and max calculation for the results enabled
Loads dataset in Particle Analytics format: coarse-graining (pacg) or DEM (padem)
Parameters
metadata
: (str) file path to the metadata for the dataset
Returns
Dataset
: a dataset object
Examples Loading a coarse-graining dataset
Loading a DEM dataset in Particle Analytics formart
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
Methods
Get the name of the dataset
Returns
A string with name of the dataset
Example
Get the software of the dataset
Returns
A string with name of the software of the dataset
Example
Get type of the dataset
Returns
A value of type iota.DatasetType
Example
Get the format of the dataset reader
Returns
A string with the internal reader format
Example
Get the list of timesteps of the dataset
Returns
A list of strings that contains the timesteps of the dataset
Example
Check the existence of a given step on a given mesh
Parameters
timestep
: (int) timestep index to be checkedmesh
: (str) name of the mesh to be checked
Returns
A boolean value True if timestep exists, or False otherwise
Example
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
Get the global maximum value for a given result and analysis for the whole simulation dataset
Parameters
result
: (str) name of the resultanalysis
: (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
Get the global minimum value for a given result and analysis for the whole simulation dataset
Parameters
result
: (str) name of the resultanalysis
: (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
Get the type of the result for a given result and analysis
Parameters
result
: (str) name of the resultanalysis
: (str) name of the analysis
Returns
A value of type iota.ResultType representing the type of the result
Example
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
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
Check the existence of a given result and analysis at a given timestep and mesh
Parameters
step
: (int) timestep indexmesh
: (str) mesh nameresult
: (str) result nameanalysis
: (str) analysis name
Returns
A bool indicating if the result exists at the given timestep and mesh
Example
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 indexmesh
: (str) mesh nameresult
: (str) result nameanalysis
: (str) analysis namecomponent
: (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
Get the minimum value of a result and analysis at a given step and mesh
Parameters
step
: (int) timestep indexmesh
: (str) mesh nameresult
: (str) result nameanalysis
: (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
Get the maximum value of a result and analysis at a given step and mesh
Parameters
step
: (int) timestep indexmesh
: (str) mesh nameresult
: (str) result nameanalysis
: (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
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 indexmesh
: (str) mesh nameresult
: (str) result nameanalysis
: (str) analysis namecomponent
: (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
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 nameanalysis
: (str) analysis name
Returns
A dictionary containing the metadata information of the result
Example
Get the label for the components of a given result-analysis
result
: (str) result nameanalysis
: (str) analysis name
Returns
A list of strings with the label for each of the components of the result-analysis
Example
Get the title of the legend of a given result, analysis and component.
Parameters
result
: (str) result nameanalysis
: (str) analysis namecomponent
: (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
Getting the title of the legends for all the components of a result-analysis
Get the titles of the legend for all components of a given result, analysis.
Parameters
result
: (str) result nameanalysis
: (str) analysis name
Returns
A list of strings with the titles of the legend for each component.
Example
Get result type Returns a variable of type iota.ResultType
result
: (str) result nameanalysis
: (str) analysis name
Example
Get the values of a given result and analysis at a given step and mesh
Parameters
step
: (int) timestep indexmesh
: (str) mesh nameresult
: (str) result nameanalysis
: (str) analysis name
Returns
A numpy.ndarray of floats with the values of the result
Example
Get the type of a given mesh contained in the dataset
Parameters
mesh
: (str) mesh name
Returns
A variable of type iota.MeshType
Example
Get the list of meshes in the dataset
Returns
A list of strings with the name of the meshes
Example
Get a mesh for a given mesh name and step in the dataset
Parameters
mesh
: (str) mesh namestep
: (int) timestep index
Returns
A variable of type iota.mesh.Mesh
Example
Get the position (x,y,z) of the vertices of mesh at a given step
Parameters
mesh
: (str) mesh namestep
: (int) timestep index
Returns
An numpy.ndarray of floats array containing the position [x,y,z] of each vertex in the mesh
Example
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
Get the value of an attribute/variable of mesh of particles at a given step
Parameters
step
: (int) timestep indexmesh
: (str) particles mesh namevariable
: (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
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 namepoint
: (list of floats or numpy.ndarray of floats) point (x,y,z) to evaluate the resultresult
: (str) result nameanalysis
: (str) analysis namecomponent
: (int) component indexstep
: (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
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)
Get the temporal evolution of different statistical variables at the nodes/vertices of a given mesh, result, analysis and component
Parameters
mesh
: (str) mesh nameresult
: (str) result nameanalysis
: (str) analysis namecomponent
: (int) component indexstep
: (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
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
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 namepoint_start
: (list of floats or numpy.ndarray of floats) point (x,y,z) that defined the start of the linepoint_end
: (list of floats or numpy.ndarray of floats) point (x,y,z) that defined the end of the linenum_points
: (int) number of points along the line to extract the valuesresult
: (str) result nameanalysis
: (str) analysis namecomponent
: (int) component indexstep
: (int) timestep indexx_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)
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 nameresult
: (str) result nameanalysis
: (str) analysis namecomponent
: (int) component indexstep
: (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
Getting the temporal evolution of the integral of the magnitude of the velocity over the mesh called 'my_mesh'
Set the name of the dataset
Parameters
name
: (str) new name for the dataset
Example
Adds a mesh of particles to an existing step in the dataset
Parameters
step
: (int) timestep indexmesh
: (iota.mesh.DEM_Mesh) a mesh of particles objectname
: (str) name for the mesh of particles (Default: 'particles')
Example
Adding a new mesh of particles to the 1st step of the dataset
Adding a new mesh of particles to be called 'my_new_particles' to the 1st step of the dataset
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 staticmesh
: (iota.mesh.Mesh) mesh to be added to the dataset
Examples
Adding a new mesh to the 6th timestep of the dataset
Adding a static mesh to the dataset
Add a result to an existing mesh and step in the dataset
Parameters
step
: (int) timestep indexmesh
: (str) mesh nameresult
: (str) result nameanalysis
: (str) analysis namedata
: (numpy.ndarray of floats) array of results to be added.
Example
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 cutnormal
: (list of floats or a numpy.ndarray of floats) vector (nx,ny,nz) representing the normal direction to define the slice/cut-planeorigin
: (iota.Vector3d) vector contained in the slice/cut-plane planeresult
: (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
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'
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'
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
Delete an existing mesh from the dataset
Parameters
mesh
: (str) mesh name
Example
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
Last updated
Was this helpful?