Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Add the script to Simulation Flow (Ctrl/Cmd + F2) > StepsPre.

The script deletes particles from a Dyverso domain ("DY_Domain01") when velocity is greater than a random value between 7.0 m/s and 9.0 m/s:

import random
 
dyversoDomain = scene.get_DY_Domain("DY_Domain01")
particles     = dyversoDomain.getParticles()
velocityMin   = 7.0
velocityMax   = 9.0
 
for particle in particles:
	particleVelocity = particle.getVelocity().module()
	randomLimit      = random.uniform(velocityMin, velocityMax)
 
	if (particleVelocity >= randomLimit):
		dyversoDomain.removeParticle(particle.getId())

  • No labels