llg3d.grid

Define the computational grid for the simulation.

Classes

Grid(Jx, Jy, Jz, dx)

Stores grid data.

class Grid(Jx, Jy, Jz, dx)[source]

Bases: object

Stores grid data.

Parameters:
  • Jx (int)

  • Jy (int)

  • Jz (int)

  • dx (float)

Jx: int

number of points in x direction

Jy: int

number of points in y direction

Jz: int

number of points in z direction

dx: float

grid spacing in x direction

dy: float

grid spacing in y direction

dz: float

grid spacing in z direction

dV: float

elemental volume

Lx: float

physical length in x direction

Ly: float

physical length in y direction

Lz: float

physical length in z direction

dims: tuple[int, int, int]

local grid dimensions

V: float

total volume

ntot: int

total number of points

ncell: int

total number of cells

inv_dx2: float

\(1/dx^2\)

inv_dy2: float

\(1/dy^2\)

inv_dz2: float

\(1/dz^2\)

center_coeff: float

center coefficient for Laplacian

uniform: ClassVar[bool] = True

whether the grid is uniform

get_x_coords(local=True, dtype=dtype('float64'))[source]

Returns the x coordinates.

Parameters:
  • local (bool) – if True, returns the local coordinates, otherwise the global coordinates

  • dtype (dtype) – data type of the coordinates

Returns:

1D array with the x coordinates

Return type:

ndarray

get_mesh(local=True, dtype=dtype('float64'))[source]

Returns a meshgrid of the coordinates.

Use ij indexing.

Parameters:
  • local (bool) – if True, returns the local coordinates, otherwise the global coordinates

  • dtype (dtype) – data type of the coordinates

Returns:

Tuple of 3D arrays with the coordinates

Return type:

tuple[ndarray, ndarray, ndarray]

as_dict()[source]

Export grid parameters to a dictionary for JAX JIT compatibility.

Returns:

Dictionary containing grid parameters needed for computations

Return type:

dict