# Object bouncers¶

Bouncers prevent particles from crossing boundaries of objects (maintaining no-through boundary conditions). The idea of the bouncers is to move the particles that crossed the object boundary after integration step back to the correct side. Particles are moved such that they appear very close (about $$10^{-5}$$ units away from the boundary). Assuming that the objects never come too close to each other or the walls, this approach ensures that recovered particles will not penetrate into a different object or wall. In practice maintaining separation of at least $$10^{-3}$$ units between walls and objects is sufficient. Note that particle velocities are also altered, which means that objects experience extra force from the collisions.

## Summary¶

 Bouncer() Base class for bouncing particles off the objects. Capsule() This bouncer will use the analytical capsule representation of the rigid objects to perform the bounce. Cylinder() This bouncer will use the analytical cylinder representation of the rigid objects to perform the bounce. Ellipsoid() This bouncer will use the analytical ellipsoid representation of the rigid objects to perform the bounce. Mesh() This bouncer will use the triangular mesh associated with objects to detect boundary crossings. Rod() This bouncer will use the analytical representation of enlarged segments by a given radius.

## Details¶

class Bouncer

Bases: object

Base class for bouncing particles off the objects. Take bounce kernel as argument:

• kernel = “bounce_back”:

Bounces back the particle. The new velocity of the particle is given by:

$\mathbf{u}_\text{new} = \mathbf{u}_\text{wall} - \left( \mathbf{u}_\text{old} - \mathbf{u}_\text{wall} \right).$
• kernel = “bounce_maxwell”:

Reinsert particle at the collision point with a velocity drawn from a maxwellian distribution. Need the additional parameter kBT (real). The new velocity of the particle is given by:

$\mathbf{u}_\text{new} = \mathbf{u}_\text{wall} + \sqrt{\frac {k_BT} {m}} \xi,$

where $$\xi \sim \mathcal{N}\left(0, 1\right)$$.

__init__()

Initialize self. See help(type(self)) for accurate signature.

class Capsule

This bouncer will use the analytical capsule representation of the rigid objects to perform the bounce. No additional correction from the Object Belonging Checker is usually required. The velocity of the particles bounced from the cylinder is reversed with respect to the boundary velocity at the contact point.

__init__(name: str, kernel: str, verbosity: int=0, **kwargs) → None
Parameters: name – name of the checker kernel – the kernel used to bounce the particles (see Bouncer) verbosity – 0 for no warning, 1 to display rescue failures, 2 to display all warnings
class Cylinder

This bouncer will use the analytical cylinder representation of the rigid objects to perform the bounce. No additional correction from the Object Belonging Checker is usually required. The velocity of the particles bounced from the cylinder is reversed with respect to the boundary velocity at the contact point.

__init__(name: str, kernel: str, verbosity: int=0, **kwargs) → None
Parameters: name – name of the checker kernel – the kernel used to bounce the particles (see Bouncer) verbosity – 0 for no warning, 1 to display rescue failures, 2 to display all warnings
class Ellipsoid

This bouncer will use the analytical ellipsoid representation of the rigid objects to perform the bounce. No additional correction from the Object Belonging Checker is usually required. The velocity of the particles bounced from the ellipsoid is reversed with respect to the boundary velocity at the contact point.

__init__(name: str, kernel: str, verbosity: int=0, **kwargs) → None
Parameters: name – name of the checker kernel – the kernel used to bounce the particles (see Bouncer) verbosity – 0 for no warning, 1 to display rescue failures, 2 to display all warnings
class Mesh

This bouncer will use the triangular mesh associated with objects to detect boundary crossings. Therefore it can only be created for Membrane and Rigid Object types of object vectors. Due to numerical precision, about $$1$$ of $$10^5 - 10^6$$ mesh crossings will not be detected, therefore it is advised to use that bouncer in conjunction with correction option provided by the Object Belonging Checker, see Object belonging checkers.

Note

In order to prevent numerical instabilities in case of light membrane particles, the new velocity of the bounced particles will be a random vector drawn from the Maxwell distibution of given temperature and added to the velocity of the mesh triangle at the collision point.

__init__(name: str, kernel: str, **kwargs) → None
Parameters: name – name of the bouncer kernel – the kernel used to bounce the particles (see Bouncer)
class Rod

This bouncer will use the analytical representation of enlarged segments by a given radius. The velocity of the particles bounced from the segments is reversed with respect to the boundary velocity at the contact point.

__init__(name: str, radius: float, kernel: str, **kwargs) → None
Parameters: name – name of the checker radius – radius of the segments kernel – the kernel used to bounce the particles (see Bouncer)