Reading Particle data

Particle information (positions, velocities, and so on.) for a given particle type in a given Time Step is contained in a ParticleType object.

The particle information is obtained as follows:

# The last timestep's index is one less than the number of timesteps
last_timestep = deck.numTimesteps - 1
# A particle type can be referred to either by name or by its index
particle_type = "New Particle 1"
particle_data = deck.timestep[last_timestep][particle_type] 

This object can then be used to get particle data in the form of NumPy arrays:

positions = particle_data.getPositions()
velocities = particle_data.getVelocities()
ang_velocities = particle_data.getAngularVelocities()
orientations = particle_data.getOrientation()
scales = particle_data.getScales()
ids = particle_data.getIds()
count = particle_data.numParticles

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(c) 2023 Altair Engineering Inc. All Rights Reserved.

Intellectual Property Rights Notice | Technical Support