Fields Data

Fields

Base class for fields data.

Important

Fields data are stored in [:nx, :ny, :nz] range, and the guard cells are in the [nx:, ny:, nz:] range. The guard cells are therefore accessed using [-n_guard:, -n_guard:, -n_guard:] and [nx:nx+n_guard, ny:ny+n_guard, nz:nz+n_guard].

class lambdapic.core.fields.Fields[source]

Base class for electromagnetic field data in particle-in-cell simulations.

nx,ny,nz

Grid dimensions in x, y, z directions

Type:

int

n_guard

Number of guard cells

Type:

int

dx,dy,dz

Grid spacings

Type:

float

shape

Full array shape including guard cells

Type:

tuple

x0,y0,z0

Grid origin coordinates

Type:

float

ex,ey,ez

Electric field components

Type:

NDArray[float64]

bx,by,bz

Magnetic field components

Type:

NDArray[float64]

jx,jy,jz

Current density components

Type:

NDArray[float64]

rho

Charge density

Type:

NDArray[float64]

xaxis,yaxis,zaxis

Coordinate axes including guard cells

Type:

NDArray[float64]

attrs

List of field attribute names

Type:

list[str]

Note

Fields data are stored in [:nx, :ny, :nz] range, and the guard cells are in the [nx:, ny:, nz:] range. The guard cells are therefore accessed using [-n_guard:, -n_guard:, -n_guard:] and [nx:nx+n_guard, ny:ny+n_guard, nz:nz+n_guard].

Fields2D & Fields3D

class lambdapic.core.fields.Fields2D(nx: int, ny: int, dx: float, dy: float, x0: float, y0: float, n_guard: int, attrs: List[str] | None = None)[source]

Bases: Fields

2D electromagnetic field data for particle-in-cell simulations.

Inherits all attributes from Fields class.

Initialize 2D field data.

Parameters:
  • nx (int) – Number of grid cells in x direction

  • ny (int) – Number of grid cells in y direction

  • dx (float) – Grid spacing in x direction

  • dy (float) – Grid spacing in y direction

  • x0 (float) – x-coordinate origin

  • y0 (float) – y-coordinate origin

  • n_guard (int) – Number of guard cells

  • attrs (Optional[List[str]]) – Optional list of field attributes to initialize

class lambdapic.core.fields.Fields3D(nx: int, ny: int, nz: int, dx: float, dy: float, dz: float, x0: float, y0: float, z0: float, n_guard: int, attrs: List[str] | None = None)[source]

Bases: Fields

3D electromagnetic field data for particle-in-cell simulations.

Inherits all attributes from Fields class.

Initialize 3D field data.

Parameters:
  • nx (int) – Number of grid cells in x direction

  • ny (int) – Number of grid cells in y direction

  • nz (int) – Number of grid cells in z direction

  • dx (float) – Grid spacing in x direction

  • dy (float) – Grid spacing in y direction

  • dz (float) – Grid spacing in z direction

  • x0 (float) – x-coordinate origin

  • y0 (float) – y-coordinate origin

  • z0 (float) – z-coordinate origin

  • n_guard (int) – Number of guard cells

  • attrs (Optional[List[str]]) – Optional list of field attributes to initialize