jaxdem.domains.reflect#
Reflective boundary-condition domain.
Classes
|
A Domain implementation that enforces reflective boundary conditions. |
- class jaxdem.domains.reflect.ReflectDomain(box_size: Array, anchor: Array, restitution_coefficient: Array)[source]#
Bases:
DomainA Domain implementation that enforces reflective boundary conditions.
Particles that attempt to move beyond the defined box_size will have their positions reflected back into the box and their velocities reversed in the direction normal to the boundary.
- restitution_coefficient: jax.Array#
- classmethod Create(dim: int, box_size: Array | None = None, anchor: Array | None = None, restitution_coefficient: float = 1.0) Self[source][source]#
Default factory method for the Domain class.
This method constructs a new Domain instance with a box-shaped domain of the given dimensionality. If box_size or anchor are not provided, they are initialized to default values.
- Parameters:
dim (int) – The dimensionality of the domain (e.g., 2, 3).
box_size (jax.Array, optional) – The size of the domain along each dimension. If not provided, defaults to an array of ones with shape (dim,).
anchor (jax.Array, optional) – The anchor (origin) of the domain. If not provided, defaults to an array of zeros with shape (dim,).
restitution_coefficient (float) – Restitution coefficient between 0 and 1 to modulate energy conservation with wall.
- Returns:
A new instance of the Domain subclass with the specified or default configuration.
- Return type:
- Raises:
AssertionError – If box_size and anchor do not have the same shape.
- static apply(state: State, system: System) Tuple['State', 'System'][source][source]#
Applies reflective boundary conditions to particles.
Particles are checked against the domain boundaries. If a particle attempts to move beyond a boundary, it is reflected. The reflection is governed by the impulse-momentum equations for rigid bodies.
Velocity Update (Impulse)
\[\begin{split}\vec{v}' &= \vec{v} + \frac{1}{m}\vec{J} \\ \vec{\omega}' &= \vec{\omega} + \mathbf{I}^{-1} (\vec{r}_{p} \times \vec{J})\end{split}\]where the impulse vector \(J\) is:
\[\vec{J} = \frac{-(1+e)(\vec{v}_{contact} \cdot \hat{n})}{\frac{1}{m} + [\mathbf{I}^{-1} (\vec{r}_{p} \times \hat{n})] \cdot (\vec{r}_{p} \times \hat{n})} \hat{n}\]and the velocity of the contact point \(\vec{v}_{contact}\) is:
\[\vec{v}_{contact} = \vec{v} + \vec{\omega} \times \vec{r}_{p}\]Position Update
Finally, the particle is moved out of the boundary by reflecting its position based on the penetration depth \(\delta\):
\[\vec{r}_c' = \vec{r}_c + 2 \delta \hat{n}\]Definitions
\(\vec{r}_c\): Particle center of mass position (
jaxdem.State.pos_c).\(\vec{r}_{p}\): Vector from COM to contact sphere in the lab frame (
jaxdem.State.pos_p).\(\vec{v}\): Particle linear velocity (
jaxdem.State.vel).\(\vec{\omega}\): Particle angular velocity (
jaxdem.State.angVel).\(\hat{n}\): Boundary normal vector (pointing into the domain).
\(\delta\): Penetration depth (positive value).
\(e\): Coefficient of restitution.