qimpy.transport.geometry.PatchSet
- class PatchSet(*, material, svg_file, svg_unit=1.0, grid_spacing, contacts, grid_size_max=0, save_rho=False, cent_diff_deriv=False, process_grid, checkpoint_in=(None, ''))
Bases:
GeometrySpatial transport starting from a SVG cubic spline specification.
- Parameters:
material (Material)
svg_file (str)
svg_unit (float)
grid_spacing (float)
contacts (dict[str, dict | None])
grid_size_max (int)
save_rho (bool)
cent_diff_deriv (bool)
process_grid (ProcessGrid)
checkpoint_in (CheckpointPath)
- __init__(*, material, svg_file, svg_unit=1.0, grid_spacing, contacts, grid_size_max=0, save_rho=False, cent_diff_deriv=False, process_grid, checkpoint_in=(None, ''))
Initialize PatchSet parameters.
- Parameters:
svg_file (str) – :yaml:`Path to an SVG file containing the input geometry.
svg_unit (float) – [Input file] Real length corresponding to one unit of distance in SVG.
grid_spacing (float) – [Input file] Maximum spacing between grid points anywhere in the geometry. This is used to select the number of grid points in each domain.
contacts (dict[str, dict | None]) – [Input file] Dictionary of contact names to parameters. The available contact parameters depend on the contact models implemented in the corresponding material. If None, the contact is treated like a regular boundary, but stored in the checkpoint, enabling consistent plotting of ‘floating’ contacts.
grid_size_max (int) – [Input file] Maximum grid points per dimension after quad subdvision. If 0, will be determined automatically from number of processes. Note that this only affects parallelization and performance by changing how data is divided into patches, and does not affect the accuracy of format of the output.
save_rho (bool) – [Input file] Whether to write the full density matrices to the checkpoint file. If not (default), only observables are written to the checkpoint file.
cent_diff_deriv (bool) – [Input file] Whether to use the simple central-difference derivative operator. The default is choosing from the backward, central or forward derivative.
material (Material)
process_grid (ProcessGrid)
checkpoint_in (CheckpointPath)
Methods
Initialize PatchSet parameters.
add_childConstruct child object self.`attr_name` of type cls.
add_child_one_ofInvoke add_child on one of several child options in args.
Accumulate edge contributions of grho_dot into appropriate domain points.
Apply all boundary conditions to rho at time t and produce ghost-padded, g=sqrt(metric)-multipled version suitable for advection.
Exchange data across edges based on patch adjacency, handling communication between patches on different processes, as necessary.
Return list of drho/dt corresponding to each rho at time t.
save_checkpointSave self and all children in hierarchy to cp_path.
Update padded velocities and riemann masks in each patch.
update_stashStash results for current step for a future save_checkpoint call.
Attributes
rhoGet current values of density matrices.
commCommunicator for real-space split over patches
materialCorresponding material
grid_spacingGrid spacing used for discretization
contactsSVG contact names to material parameters
quad_setOriginal geometry specification from SVG
sub_quad_setDivision into smaller quads for tuning parallelization
patchesAdvection for each quad patch local to this process
patch_divisionDivision of patches over comm
stashSaved results for collating into fewer checkpoints
dt_maxMaximum stable time step
save_rhowhether to write rho to checkpoint file
cent_diff_derivchild_namesNames of attributes with child objects.
variant_nameVersion of children having variants (if any)
- boundaries_post(grho_dot_list)
Accumulate edge contributions of grho_dot into appropriate domain points. This is necessary for exact norm conservation in reflection and pass-throughs, when velocities don’t map exactly across the boundary.
- Parameters:
grho_dot_list (list[tuple[Tensor, list[Tensor]]])
- Return type:
None
- boundaries_pre(rho_list, t)
Apply all boundary conditions to rho at time t and produce ghost-padded, g=sqrt(metric)-multipled version suitable for advection. The list contains the data for each patch.
- Parameters:
rho_list (TensorList)
t (float)
- Return type:
list[Tensor]
- edge_exchange(edge_list_in, velocity_mode=False)
Exchange data across edges based on patch adjacency, handling communication between patches on different processes, as necessary. If velocity_mode is True, the edge data is vectorial along the short axis of the edges, as used for communication of velocities, and hence changes sign when the short axis is flipped across a pass-through edge.
- Parameters:
edge_list_in (list[list[Tensor]])
velocity_mode (bool)
- Return type:
list[list[Tensor | None]]
- rho_dot(rho, t)
Return list of drho/dt corresponding to each rho at time t.
- Parameters:
rho (TensorList)
t (float)
- Return type:
- update_padded_velocities()
Update padded velocities and riemann masks in each patch.