11.2. 模块 dem

11.2.1. 子模块预览

core

CUDEM from 'SudoSim-DEM'

cudem

CUDEM from 'SudoSim-DEM'

rtdem

RTDEM from 'SudoSim-DEM'

11.2.2. 子模块 core API函数

CUDEM from ‘SudoSim-DEM’

class dem.core.Box

基类:WallData

Box with six walls, inheriting from WallData.

__init__(self: dem.core.Box, arg0: pySudoMath.Vector3f, arg1: pySudoMath.Vector3f) None
addWall(self: dem.core.WallData, arg0: pySudoMath.Vector3f, arg1: int, arg2: int) None

add a wall to the scene

back_wall(self: dem.core.Box) dem.core.Wall

Get the back wall

bottom_wall(self: dem.core.Box) dem.core.Wall

Get the bottom wall

front_wall(self: dem.core.Box) dem.core.Wall

Get the front wall

left_wall(self: dem.core.Box) dem.core.Wall

Get the left wall

right_wall(self: dem.core.Box) dem.core.Wall

Get the right wall

top_wall(self: dem.core.Box) dem.core.Wall

Get the top wall

class dem.core.DEMSimBase

The DEM solver base class. Users are not allowed to use this base class directly.

Pause(self: dem.core.DEMSimBase) None

force pause the simulation when running with RunPthread

RunPthread(self: dem.core.DEMSimBase, arg0: int) None

Run the simulation with n steps in a new thread

__init__(self: dem.core.DEMSimBase) None
property dt

time step

property elapsedTime

elapsed time [seconds]

freeMem(self: dem.core.DEMSimBase) None

free up GPU memory in the simulation.

getParNum(self: dem.core.DEMSimBase) int

get particle number in the simulation

getSystemInfo(self: dem.core.DEMSimBase) None

get the GPU info in the system.

property hooks

getHooks setHooks

init(self: dem.core.DEMSimBase) None

initialize the sim model before running.

isLoaded(self: dem.core.DEMSimBase) bool

check if the simulation is loaded from a checkpoint

isRunning(self: dem.core.DEMSimBase) bool

get the isRunnning flag to check if the core simulation is running

iter(self: dem.core.DEMSimBase) int

get the current time step

moveToNextTimeStep(self: dem.core.DEMSimBase) None
run(self: dem.core.DEMSimBase, arg0: int) None

Run the simulation with n steps

setFilePrefix(self: dem.core.DEMSimBase, arg0: str) None

set the prefixname of output file.

setLoadedFlag(self: dem.core.DEMSimBase, arg0: bool) None

set the loaded flag.

setOutputDir(self: dem.core.DEMSimBase, arg0: str) None

set the output directory.

property speed
writeVTK(self: dem.core.DEMSimBase, arg0: str) None

dump particle data into a VTK file.

class dem.core.Material

The basic material class. Future materials can be built based on this base class.

__init__(self: dem.core.Material) None
property density

density of the material

property friction

friction of the material

property kn

kn of the material

property ks

ks of the material

property poisson

poisson of the material

property vdamping

viscous damping of the material applied to contacts

property young

young of the material

class dem.core.PeriodicHook

The base class for periodic hook that can be injected into the simulation cycle. Users are not allowed to use this base class directly.

__init__(self: dem.core.PeriodicHook) None
property dead

the hook is dead (True) or not.

property iterLast

iteration of last run

property iterPeriod

iter Periodicity

property realLast

real time of last run

property realPeriod

real Periodicity

reset(self: dem.core.PeriodicHook, **kwargs) None

reset the period of the hook

property totalRuns

the total runs for the hook

property virtLast

virtual time of last run

property virtPeriod

virtual Periodicity

class dem.core.PyHook

基类:PeriodicHook

This hook can be used to call Python functions at the user end.

__init__(self: dem.core.PyHook) None
property command

command for the pyhook. WARNING: you cannot use the print function in the hook, or else it may encounter a crash in detached multi-threads. FIXEME in the future. As a workaround, we use app.print in GUI.

class dem.core.Wall

The infinite plane wall with its axes parallel to that of the world coordinate system.

__init__(self: dem.core.Wall) None
property axis

wall axis

getPos(self: dem.core.Wall) pySudoMath.Vector3f

get the position of a wall

property id

wall id

property sense

wall sense

setPos(self: dem.core.Wall, arg0: pySudoMath.Vector3f) None

set wall position

class dem.core.WallData

Wall data can be accessed and managed through this class.

__init__(self: dem.core.WallData) None
addWall(self: dem.core.WallData, arg0: pySudoMath.Vector3f, arg1: int, arg2: int) None

add a wall to the scene

getNum(self: dem.core.WallData) int

get the wall number in the simulation.

property material

material attached to walls

class dem.core.async_spdlogger

async_logger

__init__(self: dem.core.async_spdlogger, arg0: str, arg1: dem.core.pysink) None

init function

critical(self: dem.core.async_spdlogger, arg0: str) None

Send a message at the level of CRITICAL.

info(self: dem.core.async_spdlogger, arg0: str) None

Send a message at the level of INFO.

warn(self: dem.core.async_spdlogger, arg0: str) None

Send a message at the level of WARN.

class dem.core.pysink

pysink.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dem.core.pysink) -> None

  2. __init__(self: dem.core.pysink, arg0: object) -> None

dem.core.register_async_logger(arg0: spdlog::async_logger) None

register logger

dem.core.register_logger(arg0: spdlog::logger) None

register logger

dem.core.set_async_logger(arg0: spdlog::async_logger) None

set the default logger.

dem.core.set_logger(arg0: spdlog::logger) None

set the default logger.

class dem.core.spdlogger

logger

__init__(self: dem.core.spdlogger, arg0: str, arg1: dem.core.pysink) None
critical(self: dem.core.spdlogger, arg0: str) None

Send a message at the level of CRITICAL.

info(self: dem.core.spdlogger, arg0: str) None

Send a message at the level of INFO.

warn(self: dem.core.spdlogger, arg0: str) None

Send a message at the level of WARN.

11.2.3. 子模块 cudem API函数

CUDEM from ‘SudoSim-DEM’

class dem.cudem.DEMSim

基类:DEMSimBase

The DEM solver by CUDEM.

ParRadii(self: dem.cudem.DEMSim) List[float]
PolysuperShapeParas(self: dem.cudem.DEMSim) object
PtsPos(self: dem.cudem.DEMSim) List[float]
__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dem.cudem.DEMSim) -> None

  2. __init__(self: dem.cudem.DEMSim, arg0: int) -> None

  3. __init__(self: dem.cudem.DEMSim, arg0: object) -> None

  4. __init__(self: dem.cudem.DEMSim, arg0: int, arg1: object) -> None

property digitalElevation

digital elevation data

property domain
property fcompute

compute contact forces

getPosOri(self: dem.cudem.DEMSim) object
getShapeGroupInfo(self: dem.cudem.DEMSim) list
property integrator

integrator for particle motion

load(self: dem.cudem.DEMSim, arg0: str) bool

load data

loadParticles(self: dem.cudem.DEMSim, arg0: str) None

load particle info from file

loadPthread(self: dem.cudem.DEMSim, arg0: str) None

load data

moveToNextTimeStep(self: dem.cudem.DEMSim) None
property nlist

neighbor list

property nlistUpdates

get iterations of updating neighbour list

particleScales(self: dem.cudem.DEMSim) object

scale factors of all particles in the scene

property pdata

particle data

printParInfo(self: dem.cudem.DEMSim, arg0: int) None

print the particle info with id

property reorderInterval

reorder data N nlist updates per time.

reorderParticles(self: dem.cudem.DEMSim) None

reorder particles in z-order pattern. [test only]

save(self: dem.cudem.DEMSim, arg0: str) bool

save data

saveParticles(self: dem.cudem.DEMSim, arg0: str) None

save particle info (pos and rad) into file.

savePthread(self: dem.cudem.DEMSim, arg0: str) None

save data

property useORT

use ORT or not.

property useReorder

turn on/off reorder.

vertsId(self: dem.cudem.DEMSim) object

ids for vertices

vertsNorms(self: dem.cudem.DEMSim) object

verts and norms of all shapes of polysuperellipsoids

property walls

wall container

class dem.cudem.DigitalElevation

The digital elevation model (DEM) that can be used to model terrains.

__init__(self: dem.cudem.DigitalElevation) None
loadData2d(self: dem.cudem.DigitalElevation, arg0: numpy.ndarray[numpy.float32]) None

load data from 2d numpy array

property material

material attached to the mesh

setCellSize(self: dem.cudem.DigitalElevation, arg0: float) None

set cell size of each element

class dem.cudem.Domain

The simulation domain that controls the model size. It is only required for the cell-based method.

__init__(self: dem.cudem.Domain) None
getMins(self: dem.cudem.Domain) pySudoMath.Vector3f

get the lower-left corner

getSize(self: dem.cudem.Domain) pySudoMath.Vector3f

get the AABB size of the domain

printInfo(self: dem.cudem.Domain) None

print the domain info.

setAABB(*args, **kwargs)

Overloaded function.

  1. setAABB(self: dem.cudem.Domain, arg0: float, arg1: float, arg2: float) -> None

set the AABB of the domain box with the lower-left corner at the origin

  1. setAABB(self: dem.cudem.Domain, arg0: float, arg1: float, arg2: float, arg3: float, arg4: float, arg5: float) -> None

set the AABB of the domain box

setCellSize(self: dem.cudem.Domain, arg0: float) None

set cell size in the domain (cubic cell with x=y=z).

setDim(self: dem.cudem.Domain, arg0: int, arg1: int, arg2: int) None

set Dim for subcells to partition the whole domain.

class dem.cudem.ForceCompute

Solver for inter-object forces.

Compute(self: dem.cudem.ForceCompute, arg0: bool, arg1: bool) None

Compute contact forces.

__init__(self: dem.cudem.ForceCompute) None
property pdata

particle data pointer [read only]

printInfo(self: dem.cudem.ForceCompute) None

print the ForceCompute info

class dem.cudem.Integrator

Integration of particle motion. The Newton integrator is applied.

Integrate(self: dem.cudem.Integrator) cudaError

run integration of particle motion.

__init__(self: dem.cudem.Integrator) None
property alpha

update neighborlist when particle displacement exceeds alpha*radius with repect to the reference.

property damping
property gravity
printInfo(self: dem.cudem.Integrator) None

print the integrator info

class dem.cudem.NeighborList

The neighbor searching is controled by this class. Also, some debug functions are provided.

property ORTextend

aabb extend when using ORT

__init__(self: dem.cudem.NeighborList) None
build(self: dem.cudem.NeighborList, arg0: bool) None

build a neighbor list

property delta

threshold for potential contacts

launchTest(self: dem.cudem.NeighborList) None

test launch RT time, debug ongly

printInfo(self: dem.cudem.NeighborList) None

print the nlist info.

rebuildAS(self: dem.cudem.NeighborList) None

rebuild AS for debug only

testORT(self: dem.cudem.NeighborList) int

test ORT for bvh

updateAS(self: dem.cudem.NeighborList) None

update AS for debug only

class dem.cudem.ParticleData

Particle data can be accessed and managed through this class.

__init__(self: dem.cudem.ParticleData) None
fixParById(self: dem.cudem.ParticleData, arg0: int) None

fix a particle/wall by its global id.

fixParticlesbyIds(self: dem.cudem.ParticleData, arg0: std::vector<int, std::allocator<int> >) bool

fix particles by specified ids

generatePacking(self: dem.cudem.ParticleData, arg0: pySudoMath.Vector3f, arg1: pySudoMath.Vector2f, arg2: int) tuple

Generate a random packing in the domain.

getAngVelById(self: dem.cudem.ParticleData, arg0: int) pySudoMath.Vector3f

particle’s angular velocity by a specific id, for debug only.

getForceTorqueById(self: dem.cudem.ParticleData, arg0: int) numpy.ndarray[numpy.float32]

get resultant contact force and torque by body id.

getGravPotentialEnergy(self: dem.cudem.ParticleData, arg0: float, arg1: float) float

get the gravitational potential energy of all particles [reference position, grav_g].

getKineticEnergy(self: dem.cudem.ParticleData) float

get the kinetic energy of all particles.

getShapeType(self: dem.cudem.ParticleData) int

get the shape type of particles.

getVelById(self: dem.cudem.ParticleData, arg0: int) pySudoMath.Vector3f

particle velocity by a specific id, for debug only.

property material
printInfo(self: dem.cudem.ParticleData, arg0: int) None

print particle info by id

setVelById(self: dem.cudem.ParticleData, arg0: pySudoMath.Vector3f, arg1: int) None

set particle translational velocity by id. Only for several-time usage!

updatePosById(self: dem.cudem.ParticleData, arg0: pySudoMath.Vector3f, arg1: int) None

update particle position by id

property wallMaterial

material of the wall

class dem.cudem.PolySuperellipsoidData

基类:ParticleData

Particle data can be accessed and managed through this class.

PtsPos(self: dem.cudem.PolySuperellipsoidData) List[float]
__init__(self: dem.cudem.PolySuperellipsoidData) None
getN(self: dem.cudem.PolySuperellipsoidData) int
getPosById(self: dem.cudem.PolySuperellipsoidData, arg0: int) pySudoMath.Vector3f

get particle position by id

getVertIndex(self: dem.cudem.PolySuperellipsoidData) List[pySudoMath.Vector3i]

get vertex index of discreted surfaces for visualization.

loadPos(self: dem.cudem.PolySuperellipsoidData, arg0: str) None

load particle positions from file [test only]

property material
savePos(self: dem.cudem.PolySuperellipsoidData, arg0: str) None

save particle positions into file

setPosOri(self: dem.cudem.PolySuperellipsoidData, arg0: List[pySudoMath.Vector3f], arg1: List[pySudoMath.Quaternionr]) bool

particle positions and orientations (list of positions and list of orientations).

setShapePara(*args, **kwargs)

Overloaded function.

  1. setShapePara(self: dem.cudem.PolySuperellipsoidData, arg0: List[pySudoMath.Vector2f], arg1: List[pySudoMath.Vector2f], arg2: List[pySudoMath.Vector2f], arg3: List[pySudoMath.Vector2f]) -> bool

shape parameters (list of (eps1, eps2), list of (rx+, rx-), list of (ry+, ry-) and list of (rz+, rz-)).

  1. setShapePara(self: dem.cudem.PolySuperellipsoidData, arg0: List[pySudoMath.Vector2f], arg1: List[pySudoMath.Vector2f], arg2: List[pySudoMath.Vector2f], arg3: List[pySudoMath.Vector2f], arg4: List[int]) -> bool

shape parameters (list of (eps1, eps2), list of (rx+, rx-), list of (ry+, ry-), list of (rz+, rz-)) and list of particle number in each shape group.

  1. setShapePara(self: dem.cudem.PolySuperellipsoidData, arg0: List[pySudoMath.Vector2f], arg1: List[pySudoMath.Vector2f], arg2: List[pySudoMath.Vector2f], arg3: List[pySudoMath.Vector2f], arg4: List[int], arg5: List[float]) -> bool

shape parameters (list of (eps1, eps2), list of (rx+, rx-), list of (ry+, ry-), list of (rz+, rz-)), list of particle number in each shape group, and list of scale factors for all particles.

class dem.cudem.SphereData

基类:ParticleData

Particle data can be accessed and managed through this class.

PtsPos(self: dem.cudem.SphereData) List[float]
__init__(self: dem.cudem.SphereData) None
createParticles(*args, **kwargs)

Overloaded function.

  1. createParticles(self: dem.cudem.SphereData, arg0: List[pySudoMath.Vector3f], arg1: List[float]) -> bool

create particles in the simulation.

  1. createParticles(self: dem.cudem.SphereData, arg0: List[pySudoMath.Vector3f], arg1: List[float], arg2: List[int]) -> bool

create particles in the simulation.

getN(self: dem.cudem.SphereData) int
getPosById(self: dem.cudem.SphereData, arg0: int) pySudoMath.Vector3f

get particle position by id

getRadii(self: dem.cudem.SphereData) List[float]
loadPos(self: dem.cudem.SphereData, arg0: str) None

load particle positions from file [test only]

property material
property radius

Radii of all particles

savePos(self: dem.cudem.SphereData, arg0: str) None

save particle positions into file

11.2.4. 子模块 rtdem API函数

RTDEM from ‘SudoSim-DEM’

class dem.rtdem.Bound

AABB bound.

__init__(self: dem.rtdem.Bound) None
center(self: dem.rtdem.Bound) pySudoMath.Vector3f

center of the Bound

span(self: dem.rtdem.Bound) pySudoMath.Vector3f

span of the Bound

class dem.rtdem.DEMSim

基类:DEMSimBase

The DEM solver by RTDEM.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dem.rtdem.DEMSim) -> None

  2. __init__(self: dem.rtdem.DEMSim, arg0: int) -> None

  3. __init__(self: dem.rtdem.DEMSim, arg0: object) -> None

  4. __init__(self: dem.rtdem.DEMSim, arg0: int, arg1: object) -> None

getInstanceInfo(self: dem.rtdem.DEMSim) object
getMeshNum(self: dem.rtdem.DEMSim) int

get mesh number (immovable particles such as walls) in the simulation

getMeshPosOri(self: dem.rtdem.DEMSim, arg0: int) object

get pos and ori of a mesh by mesh id.

getOri(self: dem.rtdem.DEMSim) object
getPos(self: dem.rtdem.DEMSim) object
getPosOri(self: dem.rtdem.DEMSim) object
property integrator

integrator for particle motion

load(self: dem.rtdem.DEMSim, arg0: str) bool

load data

loadPthread(self: dem.rtdem.DEMSim, arg0: str) None

load data

moveMesh(self: dem.rtdem.DEMSim, arg0: int, arg1: pySudoMath.Vector3f) None

verts of all polyhedrons in the scene

moveToNextTimeStep(self: dem.rtdem.DEMSim) None
particleScales(self: dem.rtdem.DEMSim) object

scale factors of all polyhedrons in the scene

property pdata
printParInfo(self: dem.rtdem.DEMSim, arg0: int) None

print the particle info with id

rebuildIAS_debug(self: dem.rtdem.DEMSim) None

rebuild IAS for debug only

save(self: dem.rtdem.DEMSim, arg0: str) bool

save data

savePthread(self: dem.rtdem.DEMSim, arg0: str) None

save data

updatedMeshGUI(self: dem.rtdem.DEMSim) bool

if we need to update meshes in GUI

verts(self: dem.rtdem.DEMSim) object

verts of all polyhedrons in the scene

vertsId(self: dem.rtdem.DEMSim) object

ids for vertices

vertsIdMesh(self: dem.rtdem.DEMSim, arg0: int) object

ids for vertices

vertsMesh(self: dem.rtdem.DEMSim, arg0: int) object

verts of all polyhedrons in the scene

vertsNormal(self: dem.rtdem.DEMSim) object

normals for vertices

vertsNormalDist(self: dem.rtdem.DEMSim) object

normals * ray length for vertices

vertsNormalMesh(self: dem.rtdem.DEMSim, arg0: int) object

normals for vertices

class dem.rtdem.Integrator

Integration of particle motion.

Integrate(self: dem.rtdem.Integrator) cudaError

run integration of particle motion.

__init__(self: dem.rtdem.Integrator) None
property alpha

update neighborlist when particle displacement exceeds alpha*radius with repect to the reference.

calmSystem(self: dem.rtdem.Integrator) None

calm down all particles in the system. All velocities will be reset to zeros.

property damping
property dead

dead or not

property densityScaling

density scaling for rotation only.

property gravity
printInfo(self: dem.rtdem.Integrator) None

print the integrator info

property viscousDamping

viscous damping at contact

class dem.rtdem.ParticleData

Particle data can be accessed and managed through this class.

__init__(self: dem.rtdem.ParticleData) None
addObject(self: dem.rtdem.ParticleData, arg0: rtr::PolyhedronData) None

add an object into the scene

fixParById(self: dem.rtdem.ParticleData, arg0: int) None

fix a particle/wall by its global id.

getAngVelById(self: dem.rtdem.ParticleData, arg0: int) pySudoMath.Vector3f

particle’s angular velocity by a specific id, for debug only.

getForceTorqueById(self: dem.rtdem.ParticleData, arg0: int) numpy.ndarray[numpy.float32]

get resultant contact force and torque by body id.

getGravPotentialEnergy(self: dem.rtdem.ParticleData, arg0: float, arg1: float) float

get the gravitational potential energy of all particles [reference position, grav_g].

getKineticEnergy(self: dem.rtdem.ParticleData) float

get the kinetic energy of all particles.

getVelById(self: dem.rtdem.ParticleData, arg0: int) pySudoMath.Vector3f

particle velocity by a specific id, for debug only.

property material
printInfo(self: dem.rtdem.ParticleData, arg0: int) None

print particle info by id

setVelById(self: dem.rtdem.ParticleData, arg0: pySudoMath.Vector3f, arg1: int) None

set particle translational velocity by id. Only for several-time usage!

updatePosById(self: dem.rtdem.ParticleData, arg0: pySudoMath.Vector3f, arg1: int) None

update particle position by id

property wallMaterial

material of the wall

class dem.rtdem.PolyhedronData

Mesh data can be accessed and managed through this class. Differing from ParticleData, this class is specific for particle shape.

__init__(self: dem.rtdem.PolyhedronData) None
property bounds
computGeometry(self: dem.rtdem.PolyhedronData) None

compute geometric info such as moments of inertia, volume and center.

getParNum(self: dem.rtdem.PolyhedronData) int

get the number of particles that are generated based on the polyhedron model.

getVertexNum(self: dem.rtdem.PolyhedronData) int

vertex number of the polyhedron model

property label

Label for this group of particles.

loadBox(self: dem.rtdem.PolyhedronData, arg0: float, arg1: float, arg2: float) None

load an axis-aligned box with a size of (length_x, length_y and length_z). The bottom-left corner is at the origin.

loadPlane(self: dem.rtdem.PolyhedronData, arg0: float, arg1: float, arg2: int) None

load a plane with its size (length and width) and direction (1: yz, 2: xz, 3:xy; and minus for the negative direction of the axis).

loadRectangle(self: dem.rtdem.PolyhedronData, arg0: numpy.ndarray[numpy.float32]) None

load vertices and facets

loadSTL(*args, **kwargs)

Overloaded function.

  1. loadSTL(self: dem.rtdem.PolyhedronData, arg0: str) -> None

load a STL file to the model

  1. loadSTL(self: dem.rtdem.PolyhedronData, arg0: str, arg1: float) -> None

load a STL file to the model

  1. loadSTL(self: dem.rtdem.PolyhedronData, arg0: str, arg1: float, arg2: bool) -> None

load a STL file to the model

  1. loadSTL(self: dem.rtdem.PolyhedronData, arg0: str, arg1: pySudoMath.Vector3f) -> None

load a STL file to the model

  1. loadSTL(self: dem.rtdem.PolyhedronData, arg0: str, arg1: pySudoMath.Vector3f, arg2: bool) -> None

load a STL file to the model

loadVertFacet(self: dem.rtdem.PolyhedronData, arg0: numpy.ndarray[numpy.float32], arg1: numpy.ndarray[numpy.int32]) None

load vertices and facets

property material
setMovable(self: dem.rtdem.PolyhedronData, arg0: bool) None

set if the object is movable or not

setPosOri(self: dem.rtdem.PolyhedronData, arg0: List[pySudoMath.Vector3f], arg1: List[pySudoMath.Quaternionr]) None

set position and orientations

setPosition(self: dem.rtdem.PolyhedronData, arg0: List[pySudoMath.Vector3f]) None

set positions

setRayPara(self: dem.rtdem.PolyhedronData, arg0: bool, arg1: float) None

set the ray parameters (useBVH (different length), weight parameter for the ray length if using different lengths).

setScaleFactors(self: dem.rtdem.PolyhedronData, arg0: numpy.ndarray[numpy.float32]) None

scale factors for each particle with respect to the reference particle

verts(self: dem.rtdem.PolyhedronData) object

vertices

vertsId(self: dem.rtdem.PolyhedronData) object

ids for vertices

vertsNormal(self: dem.rtdem.PolyhedronData) object

normals for vertices

property writeVTKflag

true for writing vtk files when DEMSim calls writeVTK.

write_stl(self: dem.rtdem.PolyhedronData) None

write the normalized template mesh into a stl file.