jaxincell._fields

Functions

E_from_Gauss_1D_FFT(charge_density, dx)

Solve for the electric field E = -d(phi)/dx using FFT,

E_from_Poisson_1D_FFT(charge_density, dx)

Solve for the electric field E = -d(phi)/dx using FFT,

E_from_Gauss_1D_Cartesian(charge_density, dx)

Solve for the electric field at t=0 (E0) using the charge density distribution

curlE(E_field, B_field, dx, dt, field_BC_left, ...)

Compute the curl of the electric field, which is related to the time derivative of

curlB(B_field, E_field, dx, dt, field_BC_left, ...)

Compute the curl of the magnetic field, which is related to the time derivative of

field_update(E_fields, B_fields, dx, dt, j, ...)

Update the electric and magnetic fields based on Maxwell's equations

field_update1(E_fields, B_fields, dx, dt, j, ...)

field_update2(E_fields, B_fields, dx, dt, j, ...)

Module Contents

jaxincell._fields.E_from_Gauss_1D_FFT(charge_density, dx)

Solve for the electric field E = -d(phi)/dx using FFT, where phi is derived from the 1D Gauss’ law equation. Parameters: charge_density : 1D numpy array, source term (right-hand side of Poisson equation) dx : float, grid spacing in the x-direction Returns: E : 1D numpy array, electric field

jaxincell._fields.E_from_Poisson_1D_FFT(charge_density, dx)

Solve for the electric field E = -d(phi)/dx using FFT, where phi is derived from the 1D Poisson equation. Parameters: charge_density : 1D numpy array, source term (right-hand side of Poisson equation) dx : float, grid spacing in the x-direction Returns: E : 1D numpy array, electric field

jaxincell._fields.E_from_Gauss_1D_Cartesian(charge_density, dx)

Solve for the electric field at t=0 (E0) using the charge density distribution and applying Gauss’s law in a 1D system.

Parameters:
  • charge_density – 1D numpy array, source term (right-hand side of Gauss equation)

  • dx – float, grid spacing in the x-direction

Returns:

The electric field at each grid point due to the particles, shape (G,).

Return type:

array

jaxincell._fields.curlE(E_field, B_field, dx, dt, field_BC_left, field_BC_right)

Compute the curl of the electric field, which is related to the time derivative of the magnetic field in Maxwell’s equations (Faraday’s law).

Parameters:
  • E_field (array) – Electric field at each grid point, shape (G, 3).

  • B_field (array) – Magnetic field at each grid point, shape (G, 3).

  • dx (float) – Grid spacing.

  • dt (float) – Time step.

  • field_BC_left (int) – Left boundary condition for fields (0: periodic, 1: reflective, 2: absorbing).

  • field_BC_right (int) – Right boundary condition for fields.

Returns:

The curl of the electric field, which is the source of the magnetic field.

Return type:

array

jaxincell._fields.curlB(B_field, E_field, dx, dt, field_BC_left, field_BC_right)

Compute the curl of the magnetic field, which is related to the time derivative of the electric field in Maxwell’s equations (Ampère’s law with Maxwell correction).

Parameters:
  • B_field (array) – Magnetic field at each grid point, shape (G, 3).

  • E_field (array) – Electric field at each grid point, shape (G, 3).

  • dx (float) – Grid spacing.

  • dt (float) – Time step.

  • field_BC_left (int) – Left boundary condition for fields.

  • field_BC_right (int) – Right boundary condition for fields.

Returns:

The curl of the magnetic field, which is the source of the electric field.

Return type:

array

jaxincell._fields.field_update(E_fields, B_fields, dx, dt, j, field_BC_left, field_BC_right)

Update the electric and magnetic fields based on Maxwell’s equations

Parameters:
  • E_fields (array) – Electric field at each grid point, shape (G, 3).

  • B_fields (array) – Magnetic field at each grid point, shape (G, 3).

  • dx (float) – Grid spacing.

  • dt (float) – Time step.

  • j (array) – Current density at each grid point, shape (G, 3).

  • field_BC_left (int) – Left boundary condition for fields.

  • field_BC_right (int) – Right boundary condition for fields.

Returns:

Updated electric and magnetic fields, each of shape (G, 3).

Return type:

tuple

jaxincell._fields.field_update1(E_fields, B_fields, dx, dt, j, field_BC_left, field_BC_right)
jaxincell._fields.field_update2(E_fields, B_fields, dx, dt, j, field_BC_left, field_BC_right)