jaxincell._boundary_conditions¶
Functions¶
|
Applies boundary conditions (BCs) to a single particle's position and velocity. |
|
Applies boundary conditions to all particles in parallel. |
|
Applies boundary conditions to particle positions only (used for half-step updates). |
|
Applies boundary conditions to particle positions for all particles during a half-step update. |
Module Contents¶
- jaxincell._boundary_conditions.set_BC_single_particle(x_n, v_n, q, q_m, dx, grid, box_size_x, box_size_y, box_size_z, BC_left, BC_right)¶
Applies boundary conditions (BCs) to a single particle’s position and velocity.
- Parameters:
x_n (jnp.ndarray) – Particle position as a 1D array [x, y, z].
v_n (jnp.ndarray) – Particle velocity as a 1D array [vx, vy, vz].
q (float) – Particle charge.
q_m (float) – Charge-to-mass ratio of the particle.
dx (float) – Grid spacing.
grid (jnp.ndarray) – Discretized grid positions.
box_size_x (float) – Box dimensions in x, y, and z directions.
box_size_y (float) – Box dimensions in x, y, and z directions.
box_size_z (float) – Box dimensions in x, y, and z directions.
BC_left (int) – Boundary conditions for left and right boundaries in the x-direction. 0: Periodic 1: Reflective 2: Absorbing
BC_right (int) – Boundary conditions for left and right boundaries in the x-direction. 0: Periodic 1: Reflective 2: Absorbing
- Returns:
Updated position (x_n), velocity (v_n), charge (q), and charge-to-mass ratio (q_m).
- Return type:
tuple
- jaxincell._boundary_conditions.set_BC_particles(xs_n, vs_n, qs, ms, q_ms, dx, grid, box_size_x, box_size_y, box_size_z, BC_left, BC_right)¶
Applies boundary conditions to all particles in parallel.
- Parameters:
xs_n (jnp.ndarray) – Positions of all particles, shape (N, 3).
vs_n (jnp.ndarray) – Velocities of all particles, shape (N, 3).
qs (jnp.ndarray) – Charges of all particles, shape (N,).
ms (jnp.ndarray) – Masses of all particles, shape (N,).
q_ms (jnp.ndarray) – Charge-to-mass ratios of all particles, shape (N,).
parameters (Other) – Same as set_BCs.
- Returns:
Updated positions, velocities, charges, masses, and charge-to-mass ratios for all particles.
- Return type:
tuple
- jaxincell._boundary_conditions.set_BC_single_particle_positions(x_n, dx, grid, box_size_x, box_size_y, box_size_z, BC_left, BC_right)¶
Applies boundary conditions to particle positions only (used for half-step updates).
- Parameters:
x_n (jnp.ndarray) – Particle position as a 1D array [x, y, z].
parameters (Other) – Same as set_BCs.
- Returns:
Updated particle position [x, y, z].
- Return type:
jnp.ndarray
- jaxincell._boundary_conditions.set_BC_positions(xs_n, qs, dx, grid, box_size_x, box_size_y, box_size_z, BC_left, BC_right)¶
Applies boundary conditions to particle positions for all particles during a half-step update.
- Parameters:
xs_n (jnp.ndarray) – Positions of all particles, shape (N, 3).
qs (jnp.ndarray) – Charges of all particles, shape (N,).
parameters (Other) – Same as set_BCs.
- Returns:
Updated positions of all particles, shape (N, 3).
- Return type:
jnp.ndarray