Split up E and H Yee shifts

Use E shifts by default.
This commit is contained in:
jan 2016-05-25 00:40:13 -07:00
parent b7ff35485e
commit 55d9f33090

View File

@ -56,13 +56,13 @@ class Grid(object):
# For each axis, determines how far the rightmost boundary gets shifted # For each axis, determines how far the rightmost boundary gets shifted
periodic = [False] * 3 # type: List[bool] periodic = [False] * 3 # type: List[bool]
# Intended for use as a static constant # Intended for use as static constants
Yee_Shifts = 0.5 * numpy.array([[1, 0, 0], Yee_Shifts_E = 0.5 * numpy.array([[1, 0, 0],
[0, 1, 0], [0, 1, 0],
[0, 0, 1], [0, 0, 1]], dtype=float) # type: numpy.ndarray
[0, 1, 1], Yee_Shifts_H = 0.5 * numpy.array([[0, 1, 1],
[1, 0, 1], [1, 0, 1],
[1, 1, 0]], dtype=float) # type: numpy.ndarray [1, 1, 0]], dtype=float) # type: numpy.ndarray
@property @property
def dxyz(self) -> List[numpy.ndarray]: def dxyz(self) -> List[numpy.ndarray]:
@ -263,7 +263,7 @@ class Grid(object):
def __init__(self, def __init__(self,
pixel_edge_coordinates: List[List or numpy.ndarray], pixel_edge_coordinates: List[List or numpy.ndarray],
shifts: numpy.ndarray or List=Yee_Shifts, shifts: numpy.ndarray or List=Yee_Shifts_E,
initial: float or numpy.ndarray or List[float] or List[numpy.ndarray]=(1.0,)*3, initial: float or numpy.ndarray or List[float] or List[numpy.ndarray]=(1.0,)*3,
num_grids: int=None, num_grids: int=None,
periodic: bool or List[bool]=False): periodic: bool or List[bool]=False):
@ -275,7 +275,7 @@ class Grid(object):
(ie, [[x0, x1, x2,...], [y0,...], [z0,...]] where the first pixel has x-edges x=x0 and (ie, [[x0, x1, x2,...], [y0,...], [z0,...]] where the first pixel has x-edges x=x0 and
x=x1, the second has edges x=x1 and x=x2, etc.) x=x1, the second has edges x=x1 and x=x2, etc.)
:param shifts: Nx3 array containing [x, y, z] offsets for each of N grids. :param shifts: Nx3 array containing [x, y, z] offsets for each of N grids.
Yee shifts are used by default. E-field Yee shifts are used by default.
:param initial: Grids are initialized to this value. If scalar, all grids are initialized :param initial: Grids are initialized to this value. If scalar, all grids are initialized
with ndarrays full of the scalar. If a list of scalars, grid[i] is initialized to an with ndarrays full of the scalar. If a list of scalars, grid[i] is initialized to an
ndarray full of initial[i]. If a list of ndarrays of the same shape as the grids, grid[i] ndarray full of initial[i]. If a list of ndarrays of the same shape as the grids, grid[i]