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

« Previous Version 10 Next »

Dyverso Domains

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

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

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

Hybrido Domains

Add the script to Simulation Flow (Ctrl/Cmd + F2) > 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:

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 and avoid illegal division by zero:  
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

Add script to Simulation Flow > FramesPre or StepsPre.

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

"for ... in" Method
standardEmitter   = scene.get_PB_Emitter("Circle01")
standardParticles = standardEmitter.getParticles()
 
for particle in standardParticles:
	if (particle.getVelocity().module() >= 5.0):
		standardEmitter.removeParticle(particle.getId())
"while ... next" Method
standardEmitter = scene.get_PB_Emitter("Circle01")
particle        = standardEmitter.getFirstParticle()
 
while (particle):
	if (particle.getVelocity().module() >= 5.0):
		standardEmitter.removeParticle(particle.getId())
 
	particle = particle.getNextParticle()
  • No labels