jaxdem.domains.reflect#

Reflective boundary-condition domain.

Classes

ReflectDomain(box_size, anchor)

A Domain implementation that enforces reflective boundary conditions.

class jaxdem.domains.reflect.ReflectDomain(box_size: Array, anchor: Array)[source]#

Bases: Domain

A 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.

Notes

  • The reflection occurs at the boundaries defined by anchor and anchor + box_size.

static displacement(ri: jax.Array, rj: jax.Array, _: System) jax.Array[source][source]#

Computes the displacement vector between two particles.

In a reflective domain, the displacement is simply the direct vector difference.

Parameters:
  • ri (jax.Array) – Position vector of the first particle \(r_i\).

  • rj (jax.Array) – Position vector of the second particle \(r_j\).

  • _ (System) – The system object.

Returns:

The direct displacement vector \(r_i - r_j\).

Return type:

jax.Array

static shift(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, its position is reflected back into the box, and its velocity component normal to that boundary is reversed.

\[\begin{split}l &= a + R \\ u &= a + B - R \\ v' &= \begin{cases} -v & \text{if } r < l \text{ or } r > u \\ v & \text{otherwise} \end{cases} \\ r' &= \begin{cases} 2l - r & \text{if } r < l \\ r & \text{otherwise} \end{cases} \\ r'' &= \begin{cases} 2u - r' & \text{if } r' > u \\ r' & \text{otherwise} \end{cases} r = r''\end{split}\]
where:
  • \(r\) is the current particle position (jaxdem.State.pos)

  • \(v\) is the current particle velocity (jaxdem.State.vel)

  • \(a\) is the domain anchor (Domain.anchor)

  • \(B\) is the domain box size (Domain.box_size)

  • \(R\) is the particle radius (jaxdem.State.rad)

  • \(l\) is the lower boundary for the particle center

  • \(u\) is the upper boundary for the particle center

TO DO: Ensure correctness when adding different types of shapes and angular vel

Parameters:
  • state (State) – The current state of the simulation.

  • system (System) – The configuration of the simulation.

Returns:

The updated State object with reflected positions and velocities, and the System object.

Return type:

Tuple[State, System]

classmethod registry_name() str[source]#
property type_name: str[source]#