coexist.Simulation#
- class coexist.Simulation[source]#
Bases:
ABC
Abstract class defining the interface a DEM simulation engine must implement to be used by the Coexist and Access algorithms.
This interface is needed in order to manage a DEM simulation whose parameters will be modified dynamically as the algorithms learn them.
Alternatively, this interface has enough features to allow setting up, running, and analysing DEM simulations in Python.
Each method required is described below. As an example of an implemented LIGGGHTS front-end, see LiggghtsSimulation.
- __init__(*args, **kwargs)#
Methods
__init__
(*args, **kwargs)copy
()Create a deep copy of the simulation, along with all its state.
load
(filename)Load the full state of a simulation from a file.
Return the number of simulated particles.
Return a 2D numpy array of the particle positions at the current timestep, where the columns represent the cartesian coordinates.
radii
()A 1D numpy array listing the radius of each particle.
save
(filename)Save the full state of a simulation to a file.
set_position
(particle_index, position)Set the 3D position of the particle at an index (indexed from 0).
set_velocity
(particle_index, velocity)Set the 3D velocity of the particle at an index (indexed from 0).
step
(num_steps)Move the simulation forward in time for num_steps steps.
step_time
(duration)Move the simulation forward in time for duration seconds.
step_to
(step)Move the simulation forward in time up to timestep step.
step_to_time
(time)Move the simulation forward up to time time.
time
()Return the current simulation time.
timestep
()Return the current simulation timestep.
Return the 2D numpy array of the particle velocities at the current timestep, where the columns represent the velocity in the x-, y-, and z-dimensions.
Attributes
A coexist.Parameters class instance containing the free simulation parameters, along with their bounds.
The time duration of a single simulated step.
- abstract property parameters#
A coexist.Parameters class instance containing the free simulation parameters, along with their bounds.
- abstract property step_size#
The time duration of a single simulated step.
- abstract step_time(duration: float)[source]#
Move the simulation forward in time for duration seconds.
- abstract positions() ndarray [source]#
Return a 2D numpy array of the particle positions at the current timestep, where the columns represent the cartesian coordinates.
- abstract velocities() ndarray [source]#
Return the 2D numpy array of the particle velocities at the current timestep, where the columns represent the velocity in the x-, y-, and z-dimensions.
- abstract set_position(particle_index: int, position: ndarray)[source]#
Set the 3D position of the particle at an index (indexed from 0).
- abstract set_velocity(particle_index: int, velocity: ndarray)[source]#
Set the 3D velocity of the particle at an index (indexed from 0).