Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Get all particles from "DY_Domain01" and delete them when their velocity is greater than 4.0 m/s.

 

Code Block
languageperl
dyversoDomain    = scene.get_DY_Domain("DY_Domain01")
dyversoParticles = dyversoDomain.getParticles()
 
for particle in dyversoParticles:
	if (particle.getVelocity().module() > 4.0):
	dyversoDomain.removeParticle(particle.getId())

 

Hybrido Domains

Add script to Simulation Flow > FramesPre or StepsPre.

Most attributes of Hybrido core fluid particles are controlled by the solver and cannot be changed, but it is possible to trigger certain events, e.g. to increase the Hybrido emitter's "Speed" parameter dynamically:

 

Code Block
languagepy
hybridoDomain    = scene.get_HY_GridDomain("HY_Domain01")
hybridoEmitter   = scene.get_HY_Emitter("HY_Emitter01")
hybridoParticles = hybridoDomain.getParticles()
emitterSpeed     = hybridoEmitter.getParameter("@ Speed")
numOfParticles   = len(hybridoParticles)
currentVelocity  = 0.0
maxSpeed         = 5.0

# Sum up all velocities
for particle in hybridoParticles:
	currentVelocity += particle.getVelocity().module()

# Calculate average velocity  
if (numOfParticles > 0):
	averageVelocity = currentVelocity / float(numOfParticles)
# Check, if average velocity greater than current emitter speed and smaller than the given speed limit "maxSpeed" 
if (averageVelocity > emitterSpeed and averageVelocity <= maxSpeed):
	hybridoEmitter.setParameter("@ Speed", averageVelocity)

 

Standard Particle Fluid Emitters