qimpy.transport.geometry.Patch
- class Patch(*, transformation, grid_size_tot, grid_start, grid_stop, is_reflective, has_apertures, aperture_circles, contact_circles, contact_params, material, cent_diff_deriv, checkpoint_in=(None, ''))
Bases:
objectQuad-patch with real-space advection on an arbitrary transformation.
- Parameters:
transformation (Callable[[torch.Tensor], torch.Tensor])
grid_size_tot (tuple[int, ...])
grid_start (tuple[int, ...])
grid_stop (tuple[int, ...])
is_reflective (np.ndarray)
has_apertures (np.ndarray)
aperture_circles (torch.Tensor)
contact_circles (torch.Tensor)
contact_params (list[dict])
material (Material)
cent_diff_deriv (bool)
checkpoint_in (CheckpointPath)
- __init__(*, transformation, grid_size_tot, grid_start, grid_stop, is_reflective, has_apertures, aperture_circles, contact_circles, contact_params, material, cent_diff_deriv, checkpoint_in=(None, ''))
- Parameters:
transformation (Callable[[Tensor], Tensor])
grid_size_tot (tuple[int, ...])
grid_start (tuple[int, ...])
grid_stop (tuple[int, ...])
is_reflective (ndarray)
has_apertures (ndarray)
aperture_circles (Tensor)
contact_circles (Tensor)
contact_params (list[dict])
material (Material)
cent_diff_deriv (bool)
checkpoint_in (CheckpointPath)
- Return type:
None
Methods
Compute g*rho_dot, given current g*rho.
Save observables, and optionally density matrix, to checkpoint.
Attributes
Nx x Ny x 2 Cartesian coordinates
Nx x Ny x 1 sqrt(metric), with extra dimensipm for broadcasting
Nx x Ny x Nkbb x 2 mesh-coordinate velocities
Relevant velocity component along each edge
Padded mesh-coordinate velocities
Cached riemann selection masks
Maximum stable time step
Integration weight for the flattened density matrix dimensions
Offset of density matrix data within that of quad
Shape of density matrix on patch
current density matrix on this patch
Underlying advection logic
cent_diff_derivmaterialAperture indices for each edge
Material-dependent reflector for each edge that needs one
Contact calculators (multiple possibly) by edge
Masks for zeroing edge flux by axis
- rho_dot(grho)
Compute g*rho_dot, given current g*rho. The input is ghost-padded, while the output contains the contributions within the domain and the edge contributions that must be reflected/passed-through.
- Parameters:
grho (Tensor)
- Return type:
tuple[Tensor, list[Tensor]]
- save_checkpoint(cp_path, observables, save_rho)
Save observables, and optionally density matrix, to checkpoint.
- Parameters:
cp_path (CheckpointPath)
observables (Tensor)
save_rho (bool)
- Return type:
None
- V: Tensor
Nx x Ny x Nkbb x 2 mesh-coordinate velocities
- Vedges: list[Tensor]
Relevant velocity component along each edge
- Vpadded: tuple[Tensor, Tensor]
Padded mesh-coordinate velocities
- advect: ScriptModule
Underlying advection logic
- aperture_selections: list[Tensor | None]
Aperture indices for each edge
- contacts: list[list[Contact]]
Contact calculators (multiple possibly) by edge
- dt_max: float
Maximum stable time step
- edge_masks: tuple[list[bool | Tensor], list[bool | Tensor]]
Masks for zeroing edge flux by axis
- g: Tensor
Nx x Ny x 1 sqrt(metric), with extra dimensipm for broadcasting
- q: Tensor
Nx x Ny x 2 Cartesian coordinates
- reflectors: list[Callable[[Tensor], Tensor] | None]
Material-dependent reflector for each edge that needs one
- rho: Tensor
current density matrix on this patch
- rho_offset: tuple[int, ...]
Offset of density matrix data within that of quad
- rho_shape: tuple[int, ...]
Shape of density matrix on patch
- riemann_masks: tuple[Tensor, Tensor]
Cached riemann selection masks
- wk: float
Integration weight for the flattened density matrix dimensions