Inputs: PICMI Python Script

This documents on how to use WarpX as a Python script (e.g., python3 PICMI_script.py).

WarpX uses the PICMI standard for its Python input files. Complete example input files can be found in the examples section.

Tip

If you enjoy AI/LLM/agentic workflows, see our AI (LLM)-Assisted Input File Design section, too.

In the input file, instances of classes are created defining the various aspects of the simulation. A variable of type pywarpx.picmi.Simulation is the central object to which all other options are passed, defining the simulation time, field solver, registered species, etc.

Once the simulation is fully configured, it can be used in one of two modes. Interactive use is the most common and can be extended with custom runtime functionality:

step(): run directly from Python

When run directly from Python, one can also extend WarpX with further custom user logic. See the detailed workflow page on how to extend WarpX from Python.

Simulation and Grid Setup

pydantic model pywarpx.picmi.Simulation[source]

Creates a Simulation object

See Input Parameters for more information.

Parameters

parameter applied_fields: list[PICMI_AnyAppliedField] [Optional]

Applied fields added with add_applied_field

parameter diagnostics: list[PICMI_AnyDiagnostic] [Optional]

Diagnostics added with add_diagnostic

parameter gamma_boost: float | None = None

Lorentz factor of the boosted simulation frame. Note that all input values should be in the lab frame.

parameter initialize_self_fields: list[bool | None] [Optional]

Whether the initial space-charge fields of each species are calculated

parameter injection_plane_normal_vectors: list[list[float] | None] [Optional]

Vector normal to the injection plane of each species

parameter injection_plane_positions: list[float | list[float] | None] [Optional]

Position of one point of the injection plane of each species

parameter interactions: list[PICMI_AnyInteraction] [Optional]

Interactions added with add_interaction

parameter laser_injection_methods: list[PICMI_AnyLaserInjection | None] [Optional]

Injection method of each laser

parameter lasers: list[PICMI_AnyLaser] [Optional]

Lasers added with add_laser

parameter layouts: list[PICMI_AnyLayout | list[PICMI_AnyLayout] | None] [Optional]

Layout (or list of layouts, one per initial distribution) of each species

parameter load_balancing: Any | None = None

Controls load balancing (code dependent).

parameter max_steps: int | None = None

Maximum number of time steps. Specify either this, or max_time, or use the step function directly.

parameter max_time: float | None = None

Maximum physical time to run the simulation [s]. Specify either this, or max_steps, or use the step function directly.

parameter particle_shape: Literal['NGP', 'linear', 'quadratic', 'cubic'] | int | None = 'linear'

Default particle shape for species added to this simulation. One of ‘NGP’, ‘linear’, ‘quadratic’, ‘cubic’, or the equivalent integer interpolation order.

parameter solver: PICMI_AnySolver | None = None

This is the field solver to be used in the simulation. It should be an instance of field solver classes.

parameter species: list[PICMI_AnySpecies] [Optional]

Species added with add_species or add_species_through_plane

parameter time_step_size: float | None = None

Absolute time step size of the simulation [s]. Needed if the CFL is not specified elsewhere.

parameter verbose: int | None = None

Verbosity flag. A larger integer results in more verbose output

parameter warpx_amr_check_input: bool | None = None (name 'amr_check_input')

Whether AMReX should perform checks on the input (primarily related to the max grid size and blocking factors)

parameter warpx_amr_restart: str | None = None (name 'amr_restart')

The name of the restart to use

parameter warpx_amrex_the_arena_init_size: int | None = None (name 'amrex_the_arena_init_size')

The amount of memory in bytes to allocate in the Arena.

parameter warpx_amrex_the_arena_is_managed: bool | None = None (name 'amrex_the_arena_is_managed')

Whether to use managed memory in the AMReX Arena

parameter warpx_amrex_use_gpu_aware_mpi: bool | None = None (name 'amrex_use_gpu_aware_mpi')

Whether to use GPU-aware MPI communications

parameter warpx_break_signals: str | int | list[str | int] | None = None (name 'break_signals')

Signal or list of signals on which to break

parameter warpx_charge_deposition_algo: str | None = None (name 'charge_deposition_algo')

Charge deposition algorithm.

parameter warpx_checkpoint_signals: str | int | list[str | int] | None = None (name 'checkpoint_signals')

Signal or list of signals on which to write out a checkpoint

parameter warpx_collisions: list[pywarpx.picmi.CollisionBase] | None = None (name 'collisions')

The collision instance specifying the particle collisions

parameter warpx_collisions_split_momentum_push: bool | None = None (name 'collisions_split_momentum_push')

If true, collisions are performed in the middle of the momentum push, which is split into two substeps. This improves energy conservation, as demonstrated in (Vay et al., Phys. Rev. E 111, 2025). This is only implemented for the explicit evolve scheme and is not available for the implicit evolve schemes.

parameter warpx_compute_max_step_from_btd: bool | None = None (name 'compute_max_step_from_btd')

If specified, automatically calculates the number of iterations required in the boosted frame for all back-transformed diagnostics to be completed.

parameter warpx_costs_heuristic_cells_wt: float | None = None (name 'costs_heuristic_cells_wt')

(See documentation)

parameter warpx_costs_heuristic_particles_wt: float | None = None (name 'costs_heuristic_particles_wt')

(See documentation)

parameter warpx_current_centering_order: list[int] | None = None (name 'current_centering_order')

The order of interpolation used with hybrid grids (warpx_grid_type=hybrid) to interpolate the currents from the cell nodes to the cell centers when warpx_do_current_centering=1, before pushing the Maxwell fields on staggered grids. Default: warpx_current_centering_no<x,y,z>=8 with hybrid grids (typically necessary to ensure stability in boosted-frame simulations of relativistic plasmas and beams).

parameter warpx_current_deposition_algo: str | None = None (name 'current_deposition_algo')

Current deposition algorithm. The default depends on conditions.

parameter warpx_do_current_centering: bool | None = None (name 'do_current_centering')

If true, the current is deposited on a nodal grid and then centered to a staggered grid (Yee grid), using finite-order interpolation. Default: warpx.do_current_centering=0 with collocated or staggered grids, warpx.do_current_centering=1 with hybrid grids.

parameter warpx_do_device_synchronize: bool | None = None (name 'do_device_synchronize')

Whether to synchronize GPU threads at ends of profiling regions. Note that if this is set to False, the TinyProfiler table can be misleading.

parameter warpx_do_dynamic_scheduling: bool | None = None (name 'do_dynamic_scheduling')

Whether to do dynamic scheduling with OpenMP

parameter warpx_embedded_boundary: EmbeddedBoundary | None = None (name 'embedded_boundary')

The embedded boundary of the simulation

parameter warpx_evolve_scheme: EvolveSchemeBase | None = None (name 'evolve_scheme')

Which evolve scheme to use

parameter warpx_field_centering_order: list[int] | None = None (name 'field_centering_order')

The order of interpolation used with staggered or hybrid grids (warpx_grid_type=staggered or warpx_grid_type=hybrid) and momentum-conserving field gathering (warpx_field_gathering_algo=momentum-conserving) to interpolate the electric and magnetic fields from the cell centers to the cell nodes, before gathering the fields from the cell nodes to the particle positions. Default: warpx_field_centering_no<x,y,z>=2 with staggered grids, warpx_field_centering_no<x,y,z>=8 with hybrid grids (typically necessary to ensure stability in boosted-frame simulations of relativistic plasmas and beams).

parameter warpx_field_gathering_algo: str | None = None (name 'field_gathering_algo')

Field gathering algorithm. The default depends on conditions.

parameter warpx_grid: PICMI_CylindricalGrid | PICMI_Cartesian1DGrid | PICMI_Cartesian2DGrid | PICMI_Cartesian3DGrid | PICMI_Grid | None = None (name 'grid')

When the solver is not specified, this provides a way to specify the grid

parameter warpx_grid_type: str | None = None (name 'grid_type')

Whether to use a collocated grid (all fields defined at the cell nodes), a staggered grid (fields defined on a Yee grid), or a hybrid grid (fields and currents are interpolated back and forth between a staggered grid and a collocated grid, must be used with momentum-conserving field gathering algorithm).

parameter warpx_load_balance_costs_update: str | None = None (name 'load_balance_costs_update')

(See documentation)

parameter warpx_load_balance_efficiency_ratio_threshold: float | None = None (name 'load_balance_efficiency_ratio_threshold')

(See documentation)

parameter warpx_load_balance_intervals: int | str | None = None (name 'load_balance_intervals')

The intervals for doing load balancing

parameter warpx_load_balance_knapsack_factor: float | None = None (name 'load_balance_knapsack_factor')

(See documentation)

parameter warpx_load_balance_with_sfc: bool | None = None (name 'load_balance_with_sfc')

(See documentation)

parameter warpx_macroscopic_properties: list[pywarpx.picmi.MacroscopicProperty] [Optional] (name 'macroscopic_properties')

Macroscopic material properties added with add_macroscopic_property

parameter warpx_numprocs: list[int] | None = None (name 'numprocs')

Domain decomposition on the coarsest level. The domain will be chopped into the exact number of pieces in each dimension as specified by this parameter. https://warpx.readthedocs.io/en/latest/usage/parameters.html#distribution-across-mpi-ranks-and-parallelization https://warpx.readthedocs.io/en/latest/usage/domain_decomposition.html#simple-method

parameter warpx_particle_pusher_algo: str | None = None (name 'particle_pusher_algo')

Particle pushing algorithm.

parameter warpx_random_seed: int | str | None = None (name 'random_seed')

(See documentation)

parameter warpx_reduced_diags_extension: str | None = None (name 'reduced_diags_extension')

Sets the default extension for reduced diagnostic output files

parameter warpx_reduced_diags_intervals: int | str | None = None (name 'reduced_diags_intervals')

Sets the default intervals for reduced diagnostic output files

parameter warpx_reduced_diags_path: str | None = None (name 'reduced_diags_path')

Sets the default path for reduced diagnostic output files

parameter warpx_reduced_diags_precision: int | None = None (name 'reduced_diags_precision')

Sets the default precision for reduced diagnostic output files

parameter warpx_reduced_diags_separator: str | None = None (name 'reduced_diags_separator')

Sets the default separator for reduced diagnostic output files

parameter warpx_roundrobin_sfc: bool | None = None (name 'roundrobin_sfc')

Whether to use the RRSFC strategy for making DistributionMapping

parameter warpx_self_fields_absolute_tolerance: float | None = None (name 'self_fields_absolute_tolerance')
parameter warpx_self_fields_max_iters: int | None = None (name 'self_fields_max_iters')
parameter warpx_self_fields_required_precision: float | None = None (name 'self_fields_required_precision')
parameter warpx_self_fields_verbosity: int | None = None (name 'self_fields_verbosity')
parameter warpx_serialize_initial_conditions: bool | None = None (name 'serialize_initial_conditions')

Controls the random numbers used for initialization. This parameter should only be used for testing and continuous integration.

parameter warpx_sort_bin_size: list[int] | None = None (name 'sort_bin_size')

If sort_intervals is activated and sort_particles_for_deposition is false, particles are sorted in bins of sort_bin_size cells. In 2D, only the first two elements are read.

parameter warpx_sort_idx_type: list[int] | None = None (name 'sort_idx_type')

This controls the type of grid used to sort the particles when sort_particles_for_deposition is true. Possible values are:

  • idx_type = {0, 0, 0}: Sort particles to a cell centered grid,

  • idx_type = {1, 1, 1}: Sort particles to a node centered grid,

  • idx_type = {2, 2, 2}: Compromise between a cell and node centered grid.

In 2D (XZ and RZ), only the first two elements are read. In 1D, only the first element is read.

parameter warpx_sort_intervals: int | str | None = None (name 'sort_intervals')

Using the Intervals parser syntax, this string defines the timesteps at which particles are sorted. If <=0, do not sort particles. It is turned on on GPUs for performance reasons (to improve memory locality).

parameter warpx_sort_particles_for_deposition: bool | None = None (name 'sort_particles_for_deposition')

This option controls the type of sorting used if particle sorting is turned on, i.e. if sort_intervals is not <=0. If true, particles will be sorted by cell to optimize deposition with many particles per cell, in the order x -> y -> z -> ppc. If false, particles will be sorted by bin, using the sort_bin_size parameter below, in the order ppc -> x -> y -> z. true is recommended for best performance on NVIDIA and AMD GPUs, especially if there are many particles per cell.

parameter warpx_synchronize_velocity: bool | None = None (name 'synchronize_velocity')

Flags whether the particle velocities are synchronized in time with the positions in the diagnostics. When False, the particles are one half step behind the positions (except for the final diagnostic).

parameter warpx_tiny_profiler_flush_interval: int | str | None = None (name 'tiny_profiler_flush_interval')

Sets interval(s) to write out tiny profiler data. When not set, the tiny profiler data will only be written out at the end of the simulation.

parameter warpx_use_fdtd_nci_corr: bool | None = None (name 'use_fdtd_nci_corr')

Whether to use the NCI correction when using the FDTD solver

parameter warpx_use_filter: bool | None = None (name 'use_filter')

Whether to use filtering. The default depends on the conditions.

parameter warpx_used_inputs_file: str | None = None (name 'used_inputs_file')

The name of the text file that the used input parameters is written to,

parameter warpx_zmax_plasma_to_compute_max_step: float | None = None (name 'zmax_plasma_to_compute_max_step')

Sets the simulation run time based on the maximum z value

Methods

add_applied_field(applied_field)

Add an applied field

Parameters:

applied_field (PICMI_AnyAppliedField) – One of the applied field instances. Specifies the properties of the applied field.

add_diagnostic(diagnostic)

Add a diagnostic

Parameters:

diagnostic (PICMI_AnyDiagnostic) – One of the diagnostic instances.

add_interaction(interaction)

Add an interaction

Parameters:

interaction (PICMI_AnyInteraction) – One of the interaction objects.

add_laser(laser, injection_method)

Add a laser pulse that is injected into the simulation

Parameters:
  • laser (PICMI_AnyLaser) – One of the laser profile instances. Specifies the physical properties of the laser pulse (e.g. spatial and temporal profile, wavelength, amplitude, etc.).

  • injection_method (PICMI_AnyLaserInjection or None) – Specifies how the laser is injected (numerically) into the simulation (e.g. through a laser antenna, or directly added to the mesh). This argument describes an algorithm, not a physical object. It is up to each code to define the default method of injection, if the user does not provide injection_method.

add_macroscopic_property(macroscopic_property)[source]

Add a macroscopic material property (an instance of MacroscopicProperty)

add_species(species, layout, initialize_self_field=None)

Add species to be used in the simulation

Parameters:
  • species (PICMI_AnySpecies) – An instance of one of the PICMI species objects. Defines species to be added from the physical point of view (e.g. charge, mass, initial distribution of particles).

  • layout (PICMI_AnyLayout, list of PICMI_AnyLayout, or None) – An instance of one of the PICMI particle layout objects (or a list of them, one per initial distribution). Defines how particles are added into the simulation, from the numerical point of view.

  • initialize_self_field (bool, optional) – Whether the initial space-charge fields of this species is calculated and added to the simulation

add_species_through_plane(species, layout, injection_plane_position, injection_plane_normal_vector, initialize_self_field=None)

Add species to be used in the simulation that are injected through a plane during the simulation.

Parameters:
  • species (PICMI_AnySpecies) – An instance of one of the PICMI species objects. Defines species to be added from the physical point of view (e.g. charge, mass, initial distribution of particles).

  • layout (PICMI_AnyLayout, list of PICMI_AnyLayout, or None) – An instance of one of the PICMI layout objects (or a list of them, one per initial distribution). Defines how particles are added into the simulation, from the numerical point of view.

  • initialize_self_field (bool, optional) – Whether the initial space-charge fields of this species is calculated and added to the simulation

  • injection_plane_position (float or list of float) – Position of one point of the injection plane

  • injection_plane_normal_vector (list of float) – Vector normal to injection plane

finalize()[source]
initialize_inputs()[source]
initialize_warpx(mpi_comm=None)[source]
run()

Run the full simulation (up to max_time or max_step are reached)

set_max_step(max_steps)

Set the default number of steps for the simulation (i.e. the number of steps that gets written when calling write_input_file).

Note: this is equivalent to passing max_steps as an argument, when initializing the Simulation object

Parameters:

max_steps (int) – Maximum number of time steps

step(nsteps=None, mpi_comm=None)[source]

Run the simulation for nsteps timesteps

Parameters:

nsteps (int, default 1) – The number of timesteps

write_input_file(file_name='inputs')[source]

Write the parameters of the simulation, as defined in the PICMI input, into a code-specific input file.

This can be used for codes that are not Python-driven (e.g. compiled, pure C++ or Fortran codes) and expect a text input in a given format.

Parameters:

file_name (str) – The path to the file that will be created

Attributes

extension

Handle to the running, compiled WarpX library (a LibWarpX instance).

This is the low-level bridge from a PICMI input script to the live C++ WarpX instance. It is most useful for interactive runs (stepping the simulation from Python), where it exposes the running simulation state and the pybind11-bound API.

Commonly used entry points:

  • extension.warpx – the C++ WarpX instance, e.g. sim.extension.warpx.getistep(lev=0) (current step), sim.extension.warpx.gett_new(0) (current time), sim.extension.warpx.getdt(0) (time-step size), or sim.extension.warpx.set_potential_on_eb("2.") (set the embedded-boundary potential).

  • extension.amr – the AMReX adaptive mesh-refinement core object.

  • extension.getNProcs() – the number of MPI processes.

  • extension.libwarpx_so – the raw pybind11 module for direct access to the compiled bindings.

Field and particle data are usually accessed more conveniently through the fields and particles properties, which wrap this handle. See Extend a Simulation with Python for the full runtime-extension workflow.

Properties

property fields

This is a convenience property that returns the MultiFab registry, allowing easy fetching of the MultiFabs.

property particles

This is a convenience property that returns the MultiParticleContainer, allowing easy fetching of the WarpXParticleContainer instances.

pydantic model pywarpx.picmi.Cartesian3DGrid[source]

Three dimensional Cartesian grid Parameters can be specified either as vectors or separately. (If both are specified, the vector is used.)

References

absorbing_silver_mueller: A local absorbing boundary condition that works best under normal incidence angle. Based on the Silver-Mueller Radiation Condition, e.g., in

See Input Parameters for more information.

Parameters

parameter bc_xmax: str | None = None

Boundary condition at max X: One of periodic, open, dirichlet, absorbing_silver_mueller, or neumann

parameter bc_xmax_particles: str | None = None

Boundary condition at max X for particles: One of periodic, absorbing, reflect, thermal

parameter bc_xmin: str | None = None

Boundary condition at min X: One of periodic, open, dirichlet, absorbing_silver_mueller, or neumann

parameter bc_xmin_particles: str | None = None

Boundary condition at min X for particles: One of periodic, absorbing, reflect, thermal

parameter bc_ymax: str | None = None

Boundary condition at max Y: One of periodic, open, dirichlet, absorbing_silver_mueller, or neumann

parameter bc_ymax_particles: str | None = None

Boundary condition at max Y for particles: One of periodic, absorbing, reflect, thermal

parameter bc_ymin: str | None = None

Boundary condition at min Y: One of periodic, open, dirichlet, absorbing_silver_mueller, or neumann

parameter bc_ymin_particles: str | None = None

Boundary condition at min Y for particles: One of periodic, absorbing, reflect, thermal

parameter bc_zmax: str | None = None

Boundary condition at max Z: One of periodic, open, dirichlet, absorbing_silver_mueller, or neumann

parameter bc_zmax_particles: str | None = None

Boundary condition at max Z for particles: One of periodic, absorbing, reflect, thermal

parameter bc_zmin: str | None = None

Boundary condition at min Z: One of periodic, open, dirichlet, absorbing_silver_mueller, or neumann

parameter bc_zmin_particles: str | None = None

Boundary condition at min Z for particles: One of periodic, absorbing, reflect, thermal

parameter guard_cells: list[int] | None = None

Number of guard cells used along each direction

parameter lower_bound: list[float] | None = None

Position of the node at the lower bound [m]

parameter lower_bound_particles: list[float] | None = None

Position of particle lower bound [m]

parameter lower_boundary_conditions: list[str | None] | None = None

Conditions at lower boundaries, periodic, open, dirichlet, absorbing_silver_mueller, or neumann

parameter lower_boundary_conditions_particles: list[str | None] | None = None

Conditions at lower boundaries for particles, periodic, absorbing, reflect or thermal

parameter moving_window_velocity: list[float] | None = None

Moving frame velocity [m/s]

parameter number_of_cells: list[int] | None = None

Number of cells along each axis (number of nodes is number_of_cells+1)

parameter nx: int | None = None

Number of cells along X (number of nodes=nx+1)

parameter ny: int | None = None

Number of cells along Y (number of nodes=ny+1)

parameter nz: int | None = None

Number of cells along Z (number of nodes=nz+1)

parameter pml_cells: list[int] | None = None

Number of Perfectly Matched Layer (PML) cells along each direction

parameter refined_regions: list [Optional]

List of refined regions, each element being a list of the format [level, lo, hi, refinement_factor], with level being the refinement level, with 1 being the first level of refinement, 2 being the second etc, lo and hi being vectors of length 3 specifying the extent of the region, and refinement_factor defaulting to [2,2,2] (relative to next lower level)

parameter upper_bound: list[float] | None = None

Position of the node at the upper bound [m]

parameter upper_bound_particles: list[float] | None = None

Position of particle upper bound [m]

parameter upper_boundary_conditions: list[str | None] | None = None

Conditions at upper boundaries, periodic, open, dirichlet, absorbing_silver_mueller, or neumann

parameter upper_boundary_conditions_particles: list[str | None] | None = None

Conditions at upper boundaries for particles, periodic, absorbing, reflect or thermal

parameter warpx_blocking_factor: int | list[int] | None = None (name 'blocking_factor')

Blocking factor (which controls the block size)

parameter warpx_blocking_factor_x: int | None = None (name 'blocking_factor_x')

Blocking factor (which controls the block size) in the x direction

parameter warpx_blocking_factor_y: int | None = None (name 'blocking_factor_y')

Blocking factor (which controls the block size) in the y direction

parameter warpx_blocking_factor_z: int | None = None (name 'blocking_factor_z')

Blocking factor (which controls the block size) in the z direction

parameter warpx_boundary_u_th: dict[str, float] | None = None (name 'thermal_boundary_u_th')

If a thermal boundary is used for particles, this dictionary should specify the thermal speed for each species in the form {<species>: u_th}. Note: u_th = sqrt(T*q_e/mass)/clight with T in eV.

parameter warpx_end_moving_window_step: int | None = None (name 'end_moving_window_step')

The timestep at which the moving window ends. If -1, the moving window will continue until the end of the simulation.

parameter warpx_max_grid_size: int | list[int] = 32 (name 'max_grid_size')

Maximum block size in either direction

parameter warpx_max_grid_size_x: int | None = None (name 'max_grid_size_x')

Maximum block size in x direction

parameter warpx_max_grid_size_y: int | None = None (name 'max_grid_size_y')

Maximum block size in y direction

parameter warpx_max_grid_size_z: int | None = None (name 'max_grid_size_z')

Maximum block size in z direction

parameter warpx_potential_hi_x: float | str | None = None (name 'potential_xmax')

Electrostatic potential on the upper x boundary

parameter warpx_potential_hi_y: float | str | None = None (name 'potential_ymax')

Electrostatic potential on the upper y boundary

parameter warpx_potential_hi_z: float | str | None = None (name 'potential_zmax')

Electrostatic potential on the upper z boundary

parameter warpx_potential_lo_x: float | str | None = None (name 'potential_xmin')

Electrostatic potential on the lower x boundary

parameter warpx_potential_lo_y: float | str | None = None (name 'potential_ymin')

Electrostatic potential on the lower y boundary

parameter warpx_potential_lo_z: float | str | None = None (name 'potential_zmin')

Electrostatic potential on the lower z boundary

parameter warpx_start_moving_window_step: int | None = None (name 'start_moving_window_step')

The timestep at which the moving window starts

parameter xmax: float | None = None

Position of last node along X [m]

parameter xmax_particles: float | None = None

Position of max particle boundary along X [m]

parameter xmin: float | None = None

Position of first node along X [m]

parameter xmin_particles: float | None = None

Position of min particle boundary along X [m]

parameter ymax: float | None = None

Position of last node along Y [m]

parameter ymax_particles: float | None = None

Position of max particle boundary along Y [m]

parameter ymin: float | None = None

Position of first node along Y [m]

parameter ymin_particles: float | None = None

Position of min particle boundary along Y [m]

parameter zmax: float | None = None

Position of last node along Z [m]

parameter zmax_particles: float | None = None

Position of max particle boundary along Z [m]

parameter zmin: float | None = None

Position of first node along Z [m]

parameter zmin_particles: float | None = None

Position of min particle boundary along Z [m]

Methods

add_refined_region(level, lo, hi, refinement_factor=[2, 2, 2])

Add a refined region.

Parameters:
  • level (int) – The refinement level, with 1 being the first level of refinement, 2 being the second etc.

  • lo (list of float) – The lower (lo) and upper (hi) corner of the region, each a vector of length 3

  • hi (list of float) – The lower (lo) and upper (hi) corner of the region, each a vector of length 3

  • refinement_factor (list of int, optional) – The refinement factor relative to the next lower level (default: [2, 2, 2])

grid_initialize_inputs()[source]

Attributes

number_of_dimensions: ClassVar[int] = 3
pydantic model pywarpx.picmi.Cartesian2DGrid[source]

Two dimensional Cartesian grid Parameters can be specified either as vectors or separately. (If both are specified, the vector is used.)

References

absorbing_silver_mueller: A local absorbing boundary condition that works best under normal incidence angle. Based on the Silver-Mueller Radiation Condition, e.g., in

See Input Parameters for more information.

Parameters

parameter bc_xmax: str | None = None

Boundary condition at max X: One of periodic, open, dirichlet, absorbing_silver_mueller, or neumann

parameter bc_xmax_particles: str | None = None

Boundary condition at max X for particles: One of periodic, absorbing, reflect, thermal

parameter bc_xmin: str | None = None

Boundary condition at min X: One of periodic, open, dirichlet, absorbing_silver_mueller, or neumann

parameter bc_xmin_particles: str | None = None

Boundary condition at min X for particles: One of periodic, absorbing, reflect, thermal

parameter bc_ymax: str | None = None

Boundary condition at max Y: One of periodic, open, dirichlet, absorbing_silver_mueller, or neumann

parameter bc_ymax_particles: str | None = None

Boundary condition at max Y for particles: One of periodic, absorbing, reflect, thermal

parameter bc_ymin: str | None = None

Boundary condition at min Y: One of periodic, open, dirichlet, absorbing_silver_mueller, or neumann

parameter bc_ymin_particles: str | None = None

Boundary condition at min Y for particles: One of periodic, absorbing, reflect, thermal

parameter guard_cells: list[int] | None = None

Number of guard cells used along each direction

parameter lower_bound: list[float] | None = None

Position of the node at the lower bound [m]

parameter lower_bound_particles: list[float] | None = None

Position of particle lower bound [m]

parameter lower_boundary_conditions: list[str | None] | None = None

Conditions at lower boundaries, periodic, open, dirichlet, absorbing_silver_mueller, or neumann

parameter lower_boundary_conditions_particles: list[str | None] | None = None

Conditions at lower boundaries for particles, periodic, absorbing, reflect or thermal

parameter moving_window_velocity: list[float] | None = None

Moving frame velocity [m/s]

parameter number_of_cells: list[int] | None = None

Number of cells along each axis (number of nodes is number_of_cells+1)

parameter nx: int | None = None

Number of cells along X (number of nodes=nx+1)

parameter ny: int | None = None

Number of cells along Y (number of nodes=ny+1)

parameter pml_cells: list[int] | None = None

Number of Perfectly Matched Layer (PML) cells along each direction

parameter refined_regions: list [Optional]

List of refined regions, each element being a list of the format [level, lo, hi, refinement_factor], with level being the refinement level, with 1 being the first level of refinement, 2 being the second etc, lo and hi being vectors of length 2 specifying the extent of the region, and refinement_factor defaulting to [2,2] (relative to next lower level)

parameter upper_bound: list[float] | None = None

Position of the node at the upper bound [m]

parameter upper_bound_particles: list[float] | None = None

Position of particle upper bound [m]

parameter upper_boundary_conditions: list[str | None] | None = None

Conditions at upper boundaries, periodic, open, dirichlet, absorbing_silver_mueller, or neumann

parameter upper_boundary_conditions_particles: list[str | None] | None = None

Conditions at upper boundaries for particles, periodic, absorbing, reflect or thermal

parameter warpx_blocking_factor: int | list[int] | None = None (name 'blocking_factor')

Blocking factor (which controls the block size)

parameter warpx_blocking_factor_x: int | None = None (name 'blocking_factor_x')

Blocking factor (which controls the block size) in the x direction

parameter warpx_blocking_factor_y: int | None = None (name 'blocking_factor_y')

Blocking factor (which controls the block size) in the z direction (the second axis of the grid, y in PICMI)

parameter warpx_boundary_u_th: dict[str, float] | None = None (name 'thermal_boundary_u_th')

If a thermal boundary is used for particles, this dictionary should specify the thermal speed for each species in the form {<species>: u_th}. Note: u_th = sqrt(T*q_e/mass)/clight with T in eV.

parameter warpx_end_moving_window_step: int | None = None (name 'end_moving_window_step')

The timestep at which the moving window ends. If -1, the moving window will continue until the end of the simulation.

parameter warpx_max_grid_size: int | list[int] = 32 (name 'max_grid_size')

Maximum block size in either direction

parameter warpx_max_grid_size_x: int | None = None (name 'max_grid_size_x')

Maximum block size in x direction

parameter warpx_max_grid_size_y: int | None = None (name 'max_grid_size_y')

Maximum block size in z direction (the second axis of the grid, y in PICMI)

parameter warpx_potential_hi_x: float | str | None = None (name 'potential_xmax')

Electrostatic potential on the upper x boundary

parameter warpx_potential_hi_z: float | str | None = None (name 'potential_zmax')

Electrostatic potential on the upper z boundary

parameter warpx_potential_lo_x: float | str | None = None (name 'potential_xmin')

Electrostatic potential on the lower x boundary

parameter warpx_potential_lo_z: float | str | None = None (name 'potential_zmin')

Electrostatic potential on the lower z boundary

parameter warpx_start_moving_window_step: int | None = None (name 'start_moving_window_step')

The timestep at which the moving window starts

parameter xmax: float | None = None

Position of last node along X [m]

parameter xmax_particles: float | None = None

Position of max particle boundary along X [m]

parameter xmin: float | None = None

Position of first node along X [m]

parameter xmin_particles: float | None = None

Position of min particle boundary along X [m]

parameter ymax: float | None = None

Position of last node along Y [m]

parameter ymax_particles: float | None = None

Position of max particle boundary along Y [m]

parameter ymin: float | None = None

Position of first node along Y [m]

parameter ymin_particles: float | None = None

Position of min particle boundary along Y [m]

Methods

add_refined_region(level, lo, hi, refinement_factor=[2, 2])

Add a refined region.

Parameters:
  • level (int) – The refinement level, with 1 being the first level of refinement, 2 being the second etc.

  • lo (list of float) – The lower (lo) and upper (hi) corner of the region, each a vector of length 2

  • hi (list of float) – The lower (lo) and upper (hi) corner of the region, each a vector of length 2

  • refinement_factor (list of int, optional) – The refinement factor relative to the next lower level (default: [2, 2])

grid_initialize_inputs()[source]

Attributes

number_of_dimensions: ClassVar[int] = 2

Properties

property potential_ymax

Not defined in 2D geometry (always None)

property potential_ymin

Not defined in 2D geometry (always None)

pydantic model pywarpx.picmi.Cartesian1DGrid[source]

One-dimensional Cartesian grid Parameters can be specified either as vectors or separately. (If both are specified, the vector is used.)

References

absorbing_silver_mueller: A local absorbing boundary condition that works best under normal incidence angle. Based on the Silver-Mueller Radiation Condition, e.g., in

See Input Parameters for more information.

Parameters

parameter bc_xmax: str | None = None

Boundary condition at max X: One of periodic, open, dirichlet, absorbing_silver_mueller, or neumann

parameter bc_xmax_particles: str | None = None

Boundary condition at max X for particles: One of periodic, absorbing, reflect, thermal

parameter bc_xmin: str | None = None

Boundary condition at min X: One of periodic, open, dirichlet, absorbing_silver_mueller, or neumann

parameter bc_xmin_particles: str | None = None

Boundary condition at min X for particles: One of periodic, absorbing, reflect, thermal

parameter guard_cells: list[int] | None = None

Number of guard cells used along each direction

parameter lower_bound: list[float] | None = None

Position of the node at the lower bound [m]

parameter lower_bound_particles: list[float] | None = None

Position of particle lower bound [m]

parameter lower_boundary_conditions: list[str | None] | None = None

Conditions at lower boundaries, periodic, open, dirichlet, absorbing_silver_mueller, or neumann

parameter lower_boundary_conditions_particles: list[str | None] | None = None

Conditions at lower boundaries for particles, periodic, absorbing, reflect or thermal

parameter moving_window_velocity: list[float] | None = None

Moving frame velocity [m/s]

parameter number_of_cells: list[int] | None = None

Number of cells along each axis (number of nodes is number_of_cells+1)

parameter nx: int | None = None

Number of cells along X (number of nodes=nx+1)

parameter pml_cells: list[int] | None = None

Number of Perfectly Matched Layer (PML) cells along each direction

parameter refined_regions: list [Optional]

List of refined regions, each element being a list of the format [level, lo, hi, refinement_factor], with level being the refinement level, with 1 being the first level of refinement, 2 being the second etc, lo and hi being vectors of length 1 specifying the extent of the region, and refinement_factor defaulting to [2] (relative to next lower level)

parameter upper_bound: list[float] | None = None

Position of the node at the upper bound [m]

parameter upper_bound_particles: list[float] | None = None

Position of particle upper bound [m]

parameter upper_boundary_conditions: list[str | None] | None = None

Conditions at upper boundaries, periodic, open, dirichlet, absorbing_silver_mueller, or neumann

parameter upper_boundary_conditions_particles: list[str | None] | None = None

Conditions at upper boundaries for particles, periodic, absorbing, reflect or thermal

parameter warpx_blocking_factor: int | list[int] | None = None (name 'blocking_factor')

Blocking factor (which controls the block size)

parameter warpx_blocking_factor_x: int | None = None (name 'blocking_factor_x')

Blocking factor (which controls the block size) in the longitudinal direction

parameter warpx_boundary_u_th: dict[str, float] | None = None (name 'thermal_boundary_u_th')

If a thermal boundary is used for particles, this dictionary should specify the thermal speed for each species in the form {<species>: u_th}. Note: u_th = sqrt(T*q_e/mass)/clight with T in eV.

parameter warpx_end_moving_window_step: int | None = None (name 'end_moving_window_step')

The timestep at which the moving window ends. If -1, the moving window will continue until the end of the simulation.

parameter warpx_max_grid_size: int | list[int] = 32 (name 'max_grid_size')

Maximum block size in either direction

parameter warpx_max_grid_size_x: int | None = None (name 'max_grid_size_x')

Maximum block size in longitudinal direction

parameter warpx_potential_hi_z: float | str | None = None (name 'potential_zmax')

Electrostatic potential on the upper longitudinal boundary

parameter warpx_potential_lo_z: float | str | None = None (name 'potential_zmin')

Electrostatic potential on the lower longitudinal boundary

parameter warpx_start_moving_window_step: int | None = None (name 'start_moving_window_step')

The timestep at which the moving window starts

parameter xmax: float | None = None

Position of last node along X [m]

parameter xmax_particles: float | None = None

Position of max particle boundary along X [m]

parameter xmin: float | None = None

Position of first node along X [m]

parameter xmin_particles: float | None = None

Position of min particle boundary along X [m]

Methods

add_refined_region(level, lo, hi, refinement_factor=[2])

Add a refined region.

Parameters:
  • level (int) – The refinement level, with 1 being the first level of refinement, 2 being the second etc.

  • lo (list of float) – The lower (lo) and upper (hi) corner of the region, each a vector of length 1

  • hi (list of float) – The lower (lo) and upper (hi) corner of the region, each a vector of length 1

  • refinement_factor (list of int, optional) – The refinement factor relative to the next lower level (default: [2])

grid_initialize_inputs()[source]

Attributes

number_of_dimensions: ClassVar[int] = 1

Properties

property potential_xmax

Not defined in 1D geometry (always None)

property potential_xmin

Not defined in 1D geometry (always None)

property potential_ymax

Not defined in 1D geometry (always None)

property potential_ymin

Not defined in 1D geometry (always None)

pydantic model pywarpx.picmi.CylindricalGrid[source]

Axisymmetric, cylindrical grid Parameters can be specified either as vectors or separately. (If both are specified, the vector is used.)

References

absorbing_silver_mueller: A local absorbing boundary condition that works best under normal incidence angle. Based on the Silver-Mueller Radiation Condition, e.g., in

This assumes that WarpX was compiled with USE_RZ = TRUE

See Input Parameters for more information.

Parameters

parameter bc_rmax: str | None = None

Boundary condition at max R: One of open, dirichlet, absorbing_silver_mueller, or neumann

parameter bc_rmax_particles: str | None = None

Boundary condition at max R for particles: One of periodic, absorbing, reflect, thermal

parameter bc_rmin: str | None = None

Boundary condition at min R: One of open, dirichlet, absorbing_silver_mueller, or neumann

parameter bc_rmin_particles: str | None = None

Boundary condition at min R for particles: One of periodic, absorbing, reflect, thermal

parameter bc_zmax: str | None = None

Boundary condition at max Z: One of periodic, open, dirichlet, absorbing_silver_mueller, or neumann

parameter bc_zmax_particles: str | None = None

Boundary condition at max Z for particles: One of periodic, absorbing, reflect, thermal

parameter bc_zmin: str | None = None

Boundary condition at min Z: One of periodic, open, dirichlet, absorbing_silver_mueller, or neumann

parameter bc_zmin_particles: str | None = None

Boundary condition at min Z for particles: One of periodic, absorbing, reflect, thermal

parameter guard_cells: list[int] | None = None

Number of guard cells used along each direction

parameter lower_bound: list[float] | None = None

Position of the node at the lower bound [m]

parameter lower_bound_particles: list[float] | None = None

Position of particle lower bound [m]

parameter lower_boundary_conditions: list[str | None] | None = None

Conditions at lower boundaries, periodic, open, dirichlet, absorbing_silver_mueller, or neumann

parameter lower_boundary_conditions_particles: list[str | None] | None = None

Conditions at lower boundaries for particles, periodic, absorbing, reflect or thermal

parameter moving_window_velocity: list[float] | None = None

Moving frame velocity [m/s]

parameter n_azimuthal_modes: int | None = None

Number of azimuthal modes

parameter nr: int | None = None

Number of cells along R (number of nodes=nr+1)

parameter number_of_cells: list[int] | None = None

Number of cells along each axis (number of nodes is number_of_cells+1)

parameter nz: int | None = None

Number of cells along Z (number of nodes=nz+1)

parameter pml_cells: list[int] | None = None

Number of Perfectly Matched Layer (PML) cells along each direction

parameter refined_regions: list [Optional]

List of refined regions, each element being a list of the format [level, lo, hi, refinement_factor], with level being the refinement level, with 1 being the first level of refinement, 2 being the second etc, lo and hi being vectors of length 2 specifying the extent of the region, and refinement_factor defaulting to [2,2] (relative to next lower level)

parameter rmax: float | None = None

Position of last node along R [m]

parameter rmax_particles: float | None = None

Position of max particle boundary along R [m]

parameter rmin: float | None = None

Position of first node along R [m]

parameter rmin_particles: float | None = None

Position of min particle boundary along R [m]

parameter upper_bound: list[float] | None = None

Position of the node at the upper bound [m]

parameter upper_bound_particles: list[float] | None = None

Position of particle upper bound [m]

parameter upper_boundary_conditions: list[str | None] | None = None

Conditions at upper boundaries, periodic, open, dirichlet, absorbing_silver_mueller, or neumann

parameter upper_boundary_conditions_particles: list[str | None] | None = None

Conditions at upper boundaries for particles, periodic, absorbing, reflect or thermal

parameter warpx_blocking_factor: int | list[int] | None = None (name 'blocking_factor')

Blocking factor (which controls the block size)

parameter warpx_blocking_factor_x: int | None = None (name 'blocking_factor_x')

Blocking factor (which controls the block size) in the radial direction

parameter warpx_blocking_factor_y: int | None = None (name 'blocking_factor_y')

Blocking factor (which controls the block size) in the longitudinal direction

parameter warpx_boundary_u_th: dict[str, float] | None = None (name 'thermal_boundary_u_th')

If a thermal boundary is used for particles, this dictionary should specify the thermal speed for each species in the form {<species>: u_th}. Note: u_th = sqrt(T*q_e/mass)/clight with T in eV.

parameter warpx_end_moving_window_step: int | None = None (name 'end_moving_window_step')

The timestep at which the moving window ends. If -1, the moving window will continue until the end of the simulation.

parameter warpx_max_grid_size: int | list[int] = 32 (name 'max_grid_size')

Maximum block size in either direction

parameter warpx_max_grid_size_x: int | None = None (name 'max_grid_size_x')

Maximum block size in radial direction

parameter warpx_max_grid_size_y: int | None = None (name 'max_grid_size_y')

Maximum block size in longitudinal direction

parameter warpx_potential_hi_r: float | str | None = None (name 'potential_xmax')

Electrostatic potential on the upper radial boundary

parameter warpx_potential_hi_z: float | str | None = None (name 'potential_zmax')

Electrostatic potential on the upper longitudinal boundary

parameter warpx_potential_lo_r: float | str | None = None (name 'potential_xmin')

Electrostatic potential on the lower radial boundary

parameter warpx_potential_lo_z: float | str | None = None (name 'potential_zmin')

Electrostatic potential on the lower longitudinal boundary

parameter warpx_reflect_all_velocities: bool | None = None (name 'reflect_all_velocities')

Whether the sign of all of the particle velocities are changed upon reflection on a boundary, or only the velocity normal to the surface

parameter warpx_start_moving_window_step: int | None = None (name 'start_moving_window_step')

The timestep at which the moving window starts

parameter zmax: float | None = None

Position of last node along Z [m]

parameter zmax_particles: float | None = None

Position of max particle boundary along Z [m]

parameter zmin: float | None = None

Position of first node along Z [m]

parameter zmin_particles: float | None = None

Position of min particle boundary along Z [m]

Methods

add_refined_region(level, lo, hi, refinement_factor=[2, 2])

Add a refined region.

Parameters:
  • level (int) – The refinement level, with 1 being the first level of refinement, 2 being the second etc.

  • lo (list of float) – The lower (lo) and upper (hi) corner of the region, each a vector of length 2

  • hi (list of float) – The lower (lo) and upper (hi) corner of the region, each a vector of length 2

  • refinement_factor (list of int, optional) – The refinement factor relative to the next lower level (default: [2, 2])

grid_initialize_inputs()[source]

Attributes

number_of_dimensions: ClassVar[int] = 2

Properties

property potential_ymax

Not defined in RZ geometry (always None)

property potential_ymin

Not defined in RZ geometry (always None)

pydantic model pywarpx.picmi.EmbeddedBoundary[source]

Custom class to handle set up of embedded boundaries specific to WarpX. If embedded boundary initialization is added to picmistandard this can be changed to inherit that functionality. The geometry can be specified either as an implicit function or as an STL file (ASCII or binary). In the latter case the geometry specified in the STL file can be scaled, translated and inverted.

Parameters used in the analytic expressions should be given as additional keyword arguments.

Parameters

parameter cover_multiple_cuts: bool | None = None

Whether to cover cells with multiple cuts. (If False, this will raise an error if some cells have multiple cuts)

parameter implicit_function: Expression | None = None

Analytic expression describing the embedded boundary

parameter potential: Expression | None = None

Analytic expression defining the potential. Can only be specified when the solver is electrostatic. (default 0.)

parameter stl_center: list[float] | None = None

Vector by which the STL geometry is translated (in meters)

parameter stl_file: str | None = None

STL file path (string), file contains the embedded boundary geometry

parameter stl_reverse_normal: bool = False

If True inverts the orientation of the STL geometry

parameter stl_scale: float | None = None

Factor by which the STL geometry is scaled

parameter user_defined_kw: dict [Optional]

Constants referenced in the expressions, collected from otherwise-unrecognized keyword arguments.

Methods

embedded_boundary_initialize_inputs(solver)[source]

Field solvers define the updates of electric and magnetic fields. Any of them is passed as PICMI_AnySolver to Simulation(solver=...).

pydantic model pywarpx.picmi.ElectromagneticSolver[source]

Electromagnetic field solver.

The advance method used to solve Maxwell’s equations. The default method is code dependent.

Method options:

See Input Parameters for more information.

Parameters

parameter cfl: float | None = None

Fraction of the Courant-Friedrich-Lewy criteria [1]

parameter divB_cleaning: bool | None = None

Solver uses div(B) cleaning if True

parameter divE_cleaning: bool | None = None

Solver uses div(E) cleaning if True

parameter field_smoother: PICMI_BinomialSmoother | None = None

Smoother object to apply to the fields

parameter galilean_velocity: list[float] | None = None

Velocity of Galilean reference frame [m/s]

parameter grid: PICMI_AnyGrid [Required]

Grid object for the diagnostic

parameter method: Literal['Yee', 'CKC', 'PSATD', 'ECT'] | None = None

The advance method used to solve Maxwell’s equations. WarpX supports ‘Yee’, ‘CKC’, ‘PSATD’, and ‘ECT’.

parameter pml_divB_cleaning: bool | None = None

Solver uses div(B) cleaning in the PML if True

parameter pml_divE_cleaning: bool | None = None

Solver uses div(E) cleaning in the PML if True

parameter source_smoother: PICMI_BinomialSmoother | None = None

Smoother object to apply to the sources

parameter stencil_order: list[int] | None = None

Order of stencil for each axis (-1=infinite)

parameter subcycling: int | None = None

Level of subcycling for the GPSTD solver

parameter warpx_current_correction: bool | None = None (name 'psatd_current_correction')

Whether to do the current correction for the spectral solver. See documentation for exceptions to the default value.

parameter warpx_do_pml_in_domain: bool | None = None (name 'do_pml_in_domain')

Whether to do the PML boundaries within the domain (versus in the guard cells)

parameter warpx_do_pml_j_damping: bool | None = None (name 'do_pml_j_damping')

Whether to do damping of J in the PML

parameter warpx_periodic_single_box_fft: bool | None = None (name 'psatd_periodic_single_box_fft')

Whether to do the spectral solver FFTs assuming a single simulation block

parameter warpx_pml_has_particles: bool | None = None (name 'pml_has_particles')

Whether to allow particles in the PML region

parameter warpx_pml_ncell: int | None = None (name 'pml_ncell')

The depth of the PML, in number of cells

parameter warpx_psatd_JRhom: str | None = None (name 'psatd_JRhom')

This determines whether the PSATD JRhom algorithm is used. The parameter is a string composed by two characters and one digit. The first character represents the time dependency of J within the time step over which the electromagnetic fields are evolved, e.g., “C” for constant in time, “L” for linear in time, “Q” for quadratic in time. The second character represents the time dependency of rho within the time step over which the electromagnetic fields are evolved, following the same naming convention as for J. The last digit is an integer that represents the number of subintervals used in the JRhom algorithm. Examples: “CL1” (equivalent to the standard PSATD PIC algorithm), “CL2”, “LL4”, etc. By default, the string is empty and the JRhom algorithm is not used.

parameter warpx_psatd_do_time_averaging: bool | None = None (name 'psatd_do_time_averaging')

Whether to do the time averaging for the spectral solver

parameter warpx_psatd_update_with_rho: bool | None = None (name 'psatd_update_with_rho')

Whether to update with the actual rho for the spectral solver

Methods

solver_initialize_inputs()[source]

Attributes

methods_list: ClassVar[list[str]] = ['Yee', 'CKC', 'Lehe', 'PSTD', 'PSATD', 'GPSTD', 'DS', 'ECT']
pydantic model pywarpx.picmi.ElectrostaticSolver[source]

Electrostatic field solver

See Input Parameters for more information.

The standard PICMI parameters required_precision and maximum_iterations control the MLMG Poisson solver convergence for the labframe electrostatic solvers. When warpx_magnetostatic=True, these parameters are used as defaults for the magnetostatic solver but can be overridden with the explicit warpx_magnetostatic_* parameters.

Parameters

parameter grid: PICMI_AnyGrid [Required]

Grid object for the diagnostic

parameter maximum_iterations: int | None = None

Maximum number of iterations for iterative solvers

parameter method: _ElectrostaticSolverMethod | None = None

One of ‘FFT’, or ‘Multigrid’

parameter required_precision: float | None = None

Level of precision required for iterative solvers

parameter warpx_absolute_tolerance: float | None = None (name 'absolute_tolerance')

Absolute tolerance on the labframe electrostatic solver (default 0.)

parameter warpx_cfl: float | None = None (name 'cfl')

Fraction of the CFL condition for particle velocity vs grid size, used to set the timestep when warpx_dt_update_interval > 0.

parameter warpx_dt_update_interval: int | str | None = None (name 'dt_update_interval')

How frequently the timestep is updated. Adaptive timestepping is disabled when this is <= 0. (default -1)

parameter warpx_effective_potential: bool = False (name 'effective_potential')

Whether to use the effective potential Poisson solver (EP-PIC)

parameter warpx_effective_potential_density_floor: float | None = None (name 'effective_potential_density_floor')

If given, this value will be used as the minimum density during the local calculation of sigma. (default 0)

parameter warpx_effective_potential_factor: float | None = None (name 'effective_potential_factor')

If the effective potential Poisson solver is used, this sets the value of C_EP (the method is marginally stable at C_EP = 1) (default 4)

parameter warpx_effective_potential_time_filter_param: float | None = None (name 'effective_potential_time_filter_param')

Time filtering parameter used to filter sigma in the effective potential scheme. sigma is updated using: sigma^n = warpx_effective_potential_time_filter_param * sigma^n + (1 - warpx_effective_potential_time_filter_param) * sigma^n-1 (default 0.1)

parameter warpx_magnetostatic: bool = False (name 'magnetostatic')

Whether to also solve for self-consistent magnetic fields from currents.

parameter warpx_magnetostatic_absolute_tolerance: float | None = None (name 'magnetostatic_absolute_tolerance')

Absolute tolerance for the magnetostatic solver. If not specified, defaults to the value of warpx_absolute_tolerance.

parameter warpx_magnetostatic_max_iters: int | None = None (name 'magnetostatic_max_iters')

Maximum iterations for the magnetostatic solver. If not specified, defaults to the value of maximum_iterations.

parameter warpx_magnetostatic_required_precision: float | None = None (name 'magnetostatic_required_precision')

Relative precision for the magnetostatic solver. If not specified, defaults to the value of required_precision.

parameter warpx_magnetostatic_verbosity: int | None = None (name 'magnetostatic_verbosity')

Verbosity level for the magnetostatic solver. If not specified, defaults to the value of warpx_self_fields_verbosity.

parameter warpx_max_dt: float | None = None (name 'max_dt')

The maximum allowable timestep when warpx_dt_update_interval > 0.

parameter warpx_relativistic: bool = False (name 'relativistic')

Whether to use the relativistic solver or lab frame solver

parameter warpx_self_fields_agglomeration: bool | None = None (name 'self_fields_agglomeration')

Whether MLMG may gather the coarse multigrid levels onto a single box owned by a single MPI rank (AMReX default: True). Agglomeration avoids very small boxes at coarse levels, but it serializes those levels including the bottom solve, leaving the other ranks idle.

parameter warpx_self_fields_agglomeration_grid_size: int | None = None (name 'self_fields_agglomeration_grid_size')

Box size below which MLMG agglomerates the coarse multigrid levels (AMReX defaults: 8 in 3D, 16 in 2D, 32 in 1D for CPU and 32 for GPU)

parameter warpx_self_fields_bottom_absolute_tolerance: float | None = None (name 'self_fields_bottom_absolute_tolerance')

Absolute tolerance of the bottom solve (AMReX default: unused)

parameter warpx_self_fields_bottom_max_iters: int | None = None (name 'self_fields_bottom_max_iters')

Maximum number of bottom solver iterations (AMReX default: 200)

parameter warpx_self_fields_bottom_relative_tolerance: float | None = None (name 'self_fields_bottom_relative_tolerance')

Relative tolerance of the bottom solve (AMReX default: 1e-4)

parameter warpx_self_fields_bottom_solver: Literal['default', 'smoother', 'bicgstab', 'cg', 'bicgcg', 'cgbicg', 'custom', 'algmg', 'hypre', 'petsc'] | None = None (name 'self_fields_bottom_solver')

Bottom solver used by the MLMG electrostatic solver. ‘hypre’ and ‘petsc’ require an AMReX built with HYPRE / PETSc support. (default ‘default’)

parameter warpx_self_fields_bottom_verbosity: int | None = None (name 'self_fields_bottom_verbosity')

Level of verbosity of the bottom solver of the electrostatic solvers (default 0)

parameter warpx_self_fields_consolidation: bool | None = None (name 'self_fields_consolidation')

Whether MLMG may redistribute the coarse multigrid levels onto a subset of the MPI ranks (AMReX default: True)

parameter warpx_self_fields_consolidation_grid_size: int | None = None (name 'self_fields_consolidation_grid_size')

Box size below which MLMG consolidates the coarse multigrid levels onto fewer MPI ranks (AMReX defaults: 8 in 3D, 16 in 2D, 32 in 1D for CPU and 32 for GPU)

parameter warpx_self_fields_max_coarsening_level: int | None = None (name 'self_fields_max_coarsening_level')

Maximum number of MLMG coarsening levels (AMReX default: 30). Lowering this leaves a larger problem to the bottom solver.

parameter warpx_self_fields_verbosity: int | None = None (name 'self_fields_verbosity')

Level of verbosity for the labframe electrostatic solver (default 2)

Methods

solver_initialize_inputs()[source]

Attributes

methods_list: ClassVar[list[str]] = ['FFT', 'Multigrid']
pydantic model pywarpx.picmi.HybridPICSolver[source]

Hybrid-PIC solver based on Ohm’s law. See Theory Section for more information.

Parameters used in the expressions can be given as additional keyword arguments.

Notes

Required Parameters:

  • Te must be specified when using the hybrid solver.

  • n0 should be specified if gamma != 1.

Best Practices:

  • Grid type: Setting warpx_grid_type='collocated' is recommended.

  • Particle shape: Linear particles (algo.particle_shape = 1) are recommended.

Constraints and Limitations:

  • Mesh refinement: Only one level is supported (no AMR). The solver will abort if more than one level is used.

  • RZ geometry: Only the m=0 azimuthal mode is supported in RZ geometry.

  • External vector potential: If A_external is provided, it must be non-empty.

  • Time-dependent A fields: When using expressions for external vector potentials, time variation must be specified via A_time_external_function, not directly in the A[x,y,z]_external_function expressions.

For complete parameter documentation, see the Input Parameters section.

Parameters

parameter A_external: dict[str, dict[str, float | str | bool]] | None = None

Function of space and time specifying external (non-plasma) vector potential fields. It is expected that a nested dictionary will be passed in for each separate vector potential that may have different spatial configuration or time dependence. Each field entry should contain either implicit functions with (x,y,z) dependence for ‘Ax_external_function’, ‘Ay_external_function’, ‘Az_external_function’, plus ‘A_time_external_function’ with (t) dependence, or alternatively ‘load_from_file’: True with a ‘path’ to an OpenPMD file along with ‘A_time_external_function’.

parameter Jx_external_function: float | str | None = None

Function of space and time specifying external (non-plasma) currents.

parameter Jy_external_function: float | str | None = None

Function of space and time specifying external (non-plasma) currents.

parameter Jz_external_function: float | str | None = None

Function of space and time specifying external (non-plasma) currents.

parameter Te: float | None = None

Electron temperature in eV.

parameter do_external_diva_cleaning: bool | None = None

This flag can be used to disable divA cleaning. This may be necessary when using a non-periodic external A with periodic field boundary conditions. (default True)

parameter electron_ion_relaxation_rate: float | str | None = None

Value or expression for the electron-ion energy-equilibration rate nu_ei in 1/s. Specifying it enables the electron-ion thermal equilibration Q_ei on the electron temperature, with the conjugate ion heating applied as an energy-conserving drag-diffusion kick on each ion (the required shape-aware ion temperature deposition is enabled automatically on every charged species). The expression may depend on rho (charge density in C/m^3), Te and Ti (temperatures in eV) and t (time). Only used when solve_electron_energy_equation is True.

parameter gamma: float | None = None

Exponent in calculation of electron pressure (default 5/3).

parameter grid: PICMI_CylindricalGrid | PICMI_Cartesian1DGrid | PICMI_Cartesian2DGrid | PICMI_Cartesian3DGrid | PICMI_Grid [Required]

Grid object for the solver

parameter holmstrom_vacuum_region: bool | None = None

Flag to determine handling of vacuum region (where rho < n_floor*q_e). Setting to True will solve the simplified Generalized Ohm’s Law dropping the Hall and pressure terms in the vacuum region. See Holmstrom (2013). This flag is useful for suppressing vacuum region fluctuations. A large resistivity value must be used when rho <= rho_floor. (default False)

parameter include_joule_heating: bool | None = None

Add the resistive (Joule) heating source to the electron temperature. Reduces to eta * J**2 for a single ion species. Only used when solve_electron_energy_equation is True. (default False)

parameter joule_redirect_Te_threshold: float | None = None

Electron temperature threshold in eV above which the Joule heating of a cell is routed to the ions (as an energy-conserving stochastic kick) instead of the electrons, allowing Ti > Te to develop. Specifying a value >= 0 enables the redirect (off by default). Requires include_joule_heating.

parameter max_substep_attempts: int | None = None

Maximum number of substep attempts (accepted + rejected combined) per half-step before the simulation aborts. Only used when use_rkf45 is active. (default 250)

parameter n0: float | None = None

Reference plasma density in m^-3.

parameter n_floor: float | None = None

Minimum density used in Ohm’s law calculation.

parameter plasma_hyper_resistivity: float | str | None = None

Value or expression to use for the plasma hyper-resistivity in Ohm*m^3. Can be a constant value or an expression depending on rho (charge density) and B (magnetic field magnitude).

parameter plasma_resistivity: float | str | None = None

Value or expression to use for the plasma resistivity in Ohm*m. Can be a constant value or an expression depending on rho (charge density), J (current density magnitude), and t (simulation time).

parameter plasma_resistivity_species: dict[str, float | str] | None = None

Per-species resistivity overlays added on top of plasma_resistivity, as a dictionary mapping a charged species name to a value or expression in Ohm*m. The expression may depend on rho_s (the species charge density), rho (total charge density which, by quasineutrality, equals the electron charge density), Te (electron temperature in Kelvin), J (plasma current density magnitude), J_s (the species current density magnitude), B (magnetic field magnitude) and t (time). The effective resistivity applied to species s in Ohm’s law, the Joule heating source and the resistive drag is plasma_resistivity + plasma_resistivity_species[s].

parameter solve_electron_energy_equation: bool | None = None

Solve the electron energy equation instead of the algebraic adiabatic pressure closure: the electron entropy K = Te * ne**(1-gamma) is transported each step by QDSMC markers advected with the electron fluid velocity, the source terms below are applied per cell, and Pe = ne * kB * Te is fed back into the Ohm’s-law E-solve. (default False)

parameter substep_atol: float | None = None

Absolute tolerance for the RKF45 adaptive step-size control. Only used when use_rkf45 is active. (default 1e-8)

parameter substep_max_growth: float | None = None

Maximum factor by which the substep size may grow after an accepted step. Only used when use_rkf45 is active. (default 5.0)

parameter substep_rtol: float | None = None

Relative tolerance for the RKF45 adaptive step-size control. Only used when use_rkf45 is active. (default 1e-4)

parameter substep_safety: float | None = None

Safety factor applied to the step-size adjustment formula. Only used when use_rkf45 is active. (default 0.9)

parameter substeps: int | None = None

Total number of substeps used to advance the B-field over one full timestep (split evenly between the two half-steps, so substeps/2 RK4 steps are taken per half-step, each of duration dt / substeps). Must be divisible by 2; if not, the value is automatically rounded up to the next even number. When use_rkf45 is active (True or a non-empty interval string), this is instead used only as the initial substep count estimate for the adaptive solver. After each timestep on which use_rkf45 is active, this value is updated based on n_attempts, the total number of RKF45 sub-step attempts (accepted and rejected) taken in the most recent half-step: if the current value is less than 2 * n_attempts, it jumps immediately to 2 * n_attempts; otherwise it decays slowly toward that target via exponential smoothing (95% old, 5% of 2 * n_attempts). This warm-start guess also carries over to RK4 steps on timesteps where use_rkf45 is not active. (default 10)

parameter use_rkf45: bool | str | None = None

If True (or the WarpX time-interval string "::"), use the adaptive Runge-Kutta-Fehlberg 4(5) (RKF45) integrator (Fehlberg 1969, NASA Technical Report R-315, https://ntrs.nasa.gov/citations/19690021375) for the B-field substep advance, with step-size control governed by substep_rtol and substep_atol. If False, use the fixed-step classical RK4 integrator with substeps total substeps per timestep. A WarpX time-interval string (e.g. "1::5" to enable from step every 5 steps starting from step 1) may also be passed to activate RKF45 only on specific timesteps. (default False)

parameter user_defined_kw: dict [Optional]

Constants referenced in the expressions, collected from otherwise-unrecognized keyword arguments.

parameter vacuum_seam_switch_mode: Literal['edge', 'node', 'cell'] | None = None

Sampling of the density that decides the vacuum-seam treatment – the Holmstrom vacuum branch when holmstrom_vacuum_region is True and the density-floor selection of the guarded Hall term otherwise: “edge” (legacy per-component edge average), “node” (endpoint minimum), or “cell” (adjacent-cell minimum – one decision for all three E components of an index, removing the per-component half-cell decision offsets at the plasma/vacuum seam). Cartesian only. (default “edge”)

Methods

solver_initialize_inputs()[source]

Attributes

method: ClassVar[str] = 'hybrid'

Object that allows smoothing of fields.

pydantic model pywarpx.picmi.BinomialSmoother[source]

Describes a binomial smoother operator (applied to grids).

Parameters

parameter alpha: list[float] | None = None

Smoothing coefficients along each axis

parameter compensation: bool | list[bool] | None = None

Flags whether to apply compensation along each axis. A single flag applies to all axes. WarpX applies compensation if all flags are true.

parameter n_pass: int | list[int] | None = None

Number of passes along each axis. A single integer applies to all axes. If not specified, one pass is done along each axis.

parameter stride: list[int] | None = None

Stride along each axis

Methods

smoother_initialize_inputs(solver)[source]

Evolve Schemes

These define the scheme use to evolve the fields and particles. An instance of one of these would be passed as the evolve_scheme into the Simulation.

pydantic model pywarpx.picmi.ExplicitEvolveScheme[source]

Base class of the evolve schemes, accepted as Simulation.warpx_evolve_scheme

Sets up the explicit evolve scheme

Methods

solver_scheme_initialize_inputs()[source]
pydantic model pywarpx.picmi.ThetaImplicitEMEvolveScheme[source]

Base class of the evolve schemes, accepted as Simulation.warpx_evolve_scheme

Sets up the “theta implicit” electromagnetic evolve scheme

Parameters

parameter nonlinear_solver: NonlinearSolverBase [Required]

The nonlinear solver to use for the iterations

parameter theta: float | None = None

The “theta” parameter, determining the level of implicitness

Methods

solver_scheme_initialize_inputs()[source]
pydantic model pywarpx.picmi.SemiImplicitEMEvolveScheme[source]

Base class of the evolve schemes, accepted as Simulation.warpx_evolve_scheme

Sets up the “semi-implicit” electromagnetic evolve scheme

Parameters

parameter nonlinear_solver: NonlinearSolverBase [Required]

The nonlinear solver to use for the iterations

Methods

solver_scheme_initialize_inputs()[source]

There are several support classes use to specify components of the evolve schemes

pydantic model pywarpx.picmi.PicardNonlinearSolver[source]

Base class of the nonlinear solvers

Sets up the iterative Picard nonlinear solver for the implicit evolve scheme

Parameters

parameter absolute_tolerance: float | None = None

Absolute tolerance of the convergence (default 0.)

parameter diagnostic_file: str | None = None

File name where solver diagnostics are written

parameter diagnostic_interval: int | str | None = None

The intervals for writing out solver diagnostics to the diagnostic file

parameter max_iterations: int | None = None

Maximum number of iterations (default 100)

parameter relative_tolerance: float | None = None

Relative tolerance of the convergence (default 1.e-6)

parameter require_convergence: bool | None = None

Whether convergence is required. If True and convergence is not obtained, the code will exit. (default True)

parameter verbose: bool | None = None

Whether there is verbose output from the solver (default True)

Methods

nonlinear_solver_initialize_inputs()[source]
pydantic model pywarpx.picmi.NewtonNonlinearSolver[source]

Base class of the nonlinear solvers

Sets up the iterative Newton nonlinear solver for the implicit evolve scheme

Parameters

parameter absolute_tolerance: float | None = None

Absolute tolerance of the convergence (default 0.)

parameter diagnostic_file: str | None = None

File name where solver diagnostics are written

parameter diagnostic_interval: int | str | None = None

The intervals for writing out solver diagnostics to the diagnostic file

parameter divergence_tolerance: float | None = None

The solve has diverged when the residual norm exceeds this factor times the initial residual norm (default 1.e4)

parameter linear_solver: LinearSolverBase | None = None

Specifies input arguments to the linear solver

parameter mass_matrices_pc_width: int | None = None

When use_mass_matrices_pc is True, the width of the preconditioner mass matrices

parameter max_iterations: int | None = None

Maximum number of iterations (default 100)

parameter max_particle_iterations: int | None = None

The maximum number of particle iterations

parameter particle_suborbits: bool | None = None

Whether to use particle suborbits during the solve

parameter particle_tolerance: float | None = None

The tolerance of particle quantities for convergence

parameter pc_type: PreconditionerBase | None = None

The preconditioner type, An instance of either CurlCurlMLMGPreconditioner, JacobiPreconditioner, PETScPreconditioner, or AlgMGPreconditioner

parameter print_unconverged_particle_details: bool | None = None

Whether to print the details of unconverged particles during suborbits

parameter relative_tolerance: float | None = None

Relative tolerance of the convergence (default 1.e-6)

parameter require_convergence: bool | None = None

Whether convergence is required. If True and convergence is not obtained, the code will exit. (default True)

parameter skip_particle_picard_init: bool | None = None

When use_mass_matrices_jacobian is True, whether to skip the particle picard iteration on the initial Newton step

parameter use_mass_matrices_jacobian: bool | None = None

Whether to use mass-matrices during the linear stage of PS-JFNK

parameter use_mass_matrices_pc: bool | None = None

Whether to capture the plasma response in the preconditioner

parameter verbose: bool | None = None

Whether there is verbose output from the solver (default True)

Methods

nonlinear_solver_initialize_inputs()[source]
pydantic model pywarpx.picmi.GMRESLinearSolver[source]

Base class of the linear solvers

Sets up the iterative GMRES linear solver for the implicit Newton nonlinear solver

Parameters

parameter absolute_tolerance: float | None = None

Absolute tolerance of the convergence (default 0.)

parameter max_iterations: int | None = None

Maximum number of iterations (default 1000)

parameter pc_type: PreconditionerBase | None = None

The preconditioner applied inside the GMRES iterations. This is only used by solvers that drive GMRES directly rather than through a nonlinear solver (currently the semi-implicit Darwin solver, which supports an instance of DarwinMLMGPreconditioner); with a nonlinear solver, pass the preconditioner to that solver instead.

parameter relative_tolerance: float | None = None

Relative tolerance of the convergence (default 1.e-4)

parameter restart_length: int | None = None

How often to restart the GMRES iterations (default 30)

parameter verbose_int: int | None = None

Level of verbosity of output (default 2)

Methods

linear_solver_initialize_inputs(nonlinear_solver=None)[source]
pydantic model pywarpx.picmi.PETScKSPLinearSolver[source]

Base class of the linear solvers

Sets up the petsc_ksp linear solver for the implicit Newton nonlinear solver

Methods

linear_solver_initialize_inputs(nonlinear_solver=None)[source]
pydantic model pywarpx.picmi.CurlCurlMLMGPreconditioner[source]

Base class of the preconditioners

Sets up the curl-curl multigrid preconditioner used during the nonlinear solver

Parameters

parameter absolute_tolerance: float | None = None

Absolute tolerance of the convergence

parameter agglomeration: bool | None = None

Whether to use agglomeration

parameter bottom_verbose: bool | None = None

Whether there is verbose output from the bottom solver

parameter consolidation: bool | None = None

Whether to use consolidation

parameter max_coarsening_level: int | None = None

Maximum coarsening level

parameter max_iter: int | None = None

Maximum number of iterations

parameter relative_tolerance: float | None = None

Relative tolerance of the convergence

parameter verbose: bool | None = None

Whether there is verbose output from the solver

Methods

preconditioner_type_initialize_inputs(jacobian=None)

Attributes

name: ClassVar[str | None] = 'pc_curl_curl_mlmg'
other_inputs: ClassVar[tuple[str, ...]] = ()
supports_direct_gmres: ClassVar[bool] = False
pydantic model pywarpx.picmi.JacobiPreconditioner[source]

Base class of the preconditioners

Sets up the weighted Jacobi preconditioner used during the nonlinear solver

Parameters

parameter absolute_tolerance: float | None = None

Absolute tolerance of the convergence

parameter adaptive_omega: bool | None = None

Whether to reduce the relaxation factor when the residual increases

parameter max_iter: int | None = None

Maximum number of iterations

parameter omega: float | None = None

Relaxation factor. Setting it turns off adaptive_omega.

parameter relative_tolerance: float | None = None

Relative tolerance of the convergence

parameter verbose: bool | None = None

Whether there is verbose output from the solver

Methods

preconditioner_type_initialize_inputs(jacobian=None)

Attributes

name: ClassVar[str | None] = 'pc_jacobi'
other_inputs: ClassVar[tuple[str, ...]] = ()
supports_direct_gmres: ClassVar[bool] = False
pydantic model pywarpx.picmi.PETScPreconditioner[source]

Base class of the preconditioners

Base class of the preconditioners that can use the assembled sparse matrix

Sets up the PETSc preconditioner used during the nonlinear solver

Parameters

parameter asm_overlap: int | None = None

Parameter for type is “asm”

parameter euclid_factor_levels: int | None = None

When type is “hypre” and hypre_type is “euclid”

parameter hypre_type: str | None = None

When type is “hypre”, default “euclid”

parameter ilu_factor_levels: int | None = None

When type is “asm”, and sub_type is “ilu”

parameter precon_mat_verbose: bool | None = None

Whether to print information on the assembly of the sparse matrix (default True)

parameter sub_type: Literal['ilu', 'lu'] | None = None

When type is “asm”, one of “ilu” or “lu”, default “ilu”

parameter type: Literal['lu', 'asm', 'hypre'] | None = None

PETSc solver type, one of “lu”, “asm”, or “hypre”

Methods

preconditioner_type_initialize_inputs(jacobian=None)

Attributes

name: ClassVar[str | None] = 'pc_petsc'
other_inputs: ClassVar[tuple[str, ...]] = ('precon_mat_verbose',)
supports_direct_gmres: ClassVar[bool] = False
pydantic model pywarpx.picmi.AlgMGPreconditioner[source]

Base class of the preconditioners

Base class of the preconditioners that can use the assembled sparse matrix

Sets up the AMReX algebraic multigrid (AlgMG) preconditioner used during the nonlinear solver

Parameters

parameter aggressive_levels: int | None = None

Number of levels with aggressive coarsening (default 0)

parameter algmg_verbose: int | None = None

Verbosity of the multigrid solver

parameter chebyshev_degree: int | None = None

Degree of the Chebyshev smoother (default 4)

parameter max_iter: int | None = None

Number of V-cycles per application (default 1)

parameter max_levels: int | None = None

Maximum number of multigrid levels (default 25)

parameter precon_mat_verbose: bool | None = None

Whether to print information on the assembly of the sparse matrix (default True)

parameter smoother: str | None = None

One of “chebyshev”, “l1_jacobi”, “jacobi”, or “l1_gauss_seidel” (CPU only) (default “chebyshev”)

parameter strong_threshold: float | None = None

Strength threshold for coarsening (default 0.25)

parameter verbose: bool | None = None

Whether there is verbose output from the preconditioner

Methods

preconditioner_type_initialize_inputs(jacobian=None)

Attributes

name: ClassVar[str | None] = 'pc_algmg'
other_inputs: ClassVar[tuple[str, ...]] = ('precon_mat_verbose',)
supports_direct_gmres: ClassVar[bool] = False

Constants

For convenience, the PICMI interface defines the following constants, which can be used directly inside any PICMI script. The values are in SI units.

  • picmi.constants.c: The speed of light in vacuum.

  • picmi.constants.ep0: The vacuum permittivity \(\epsilon_0\)

  • picmi.constants.mu0: The vacuum permeability \(\mu_0\)

  • picmi.constants.q_e: The elementary charge (absolute value of the charge of an electron).

  • picmi.constants.m_e: The electron mass

  • picmi.constants.m_p: The proton mass

Applied fields

Instances of the classes below need to be passed as PICMI_AnyAppliedField to the method add_applied_field of the Simulation class.

pydantic model pywarpx.picmi.AnalyticInitialField[source]

Describes an analytic applied field

The expressions should be in terms of the position and time, written as ‘x’, ‘y’, ‘z’, ‘t’. Parameters can be used in the expression with the values given as additional keyword arguments. Expressions should be relative to the lab frame.

Field Initializer that takes an implicit function to be loaded as an initial E/B field.

Parameters

parameter Bx_expression: Expression | None = None

Analytic expression describing Bx field [T]

parameter By_expression: Expression | None = None

Analytic expression describing By field [T]

parameter Bz_expression: Expression | None = None

Analytic expression describing Bz field [T]

parameter Ex_expression: Expression | None = None

Analytic expression describing Ex field [V/m]

parameter Ey_expression: Expression | None = None

Analytic expression describing Ey field [V/m]

parameter Ez_expression: Expression | None = None

Analytic expression describing Ez field [V/m]

parameter lower_bound: list[float | None] [Optional]

Lower bound of the region where the field is applied [m].

parameter upper_bound: list[float | None] [Optional]

Upper bound of the region where the field is applied [m]

parameter user_defined_kw: dict [Optional]

Constants referenced in the expressions, collected from otherwise-unrecognized keyword arguments.

parameter warpx_do_initial_div_cleaning: bool | None = None (name 'do_initial_div_cleaning')

Flag that controls whether or not to execute the Projection based B-field divergence cleaner. (default True)

parameter warpx_maxlevel_extEMfield_init: int | None = None (name 'maxlevel_extEMfield_init')

Maximum mesh-refinement level up to which the external fields are loaded

parameter warpx_projection_div_cleaner_atol: float | None = None (name 'div_cleaner_atol')

Controls the absolute tolerance used in the divergence cleaner solve.

parameter warpx_projection_div_cleaner_rtol: float | None = None (name 'div_cleaner_rtol')

Controls the relative tolerance used in the divergence cleaner solve.

Methods

applied_field_initialize_inputs()[source]
pydantic model pywarpx.picmi.ConstantAppliedField[source]

Describes a constant applied field

Parameters

parameter Bx: float | None = None

Constant Bx field [T]

parameter By: float | None = None

Constant By field [T]

parameter Bz: float | None = None

Constant Bz field [T]

parameter Ex: float | None = None

Constant Ex field [V/m]

parameter Ey: float | None = None

Constant Ey field [V/m]

parameter Ez: float | None = None

Constant Ez field [V/m]

parameter lower_bound: list[float | None] [Optional]

Lower bound of the region where the field is applied [m].

parameter upper_bound: list[float | None] [Optional]

Upper bound of the region where the field is applied [m]

Methods

applied_field_initialize_inputs()[source]
pydantic model pywarpx.picmi.AnalyticAppliedField[source]

Describes an analytic applied field

The expressions should be in terms of the position and time, written as ‘x’, ‘y’, ‘z’, ‘t’. Parameters can be used in the expression with the values given as additional keyword arguments. Expressions should be relative to the lab frame.

Parameters

parameter Bx_expression: Expression | None = None

Analytic expression describing Bx field [T]

parameter By_expression: Expression | None = None

Analytic expression describing By field [T]

parameter Bz_expression: Expression | None = None

Analytic expression describing Bz field [T]

parameter Ex_expression: Expression | None = None

Analytic expression describing Ex field [V/m]

parameter Ey_expression: Expression | None = None

Analytic expression describing Ey field [V/m]

parameter Ez_expression: Expression | None = None

Analytic expression describing Ez field [V/m]

parameter lower_bound: list[float | None] [Optional]

Lower bound of the region where the field is applied [m].

parameter upper_bound: list[float | None] [Optional]

Upper bound of the region where the field is applied [m]

parameter user_defined_kw: dict [Optional]

Constants referenced in the expressions, collected from otherwise-unrecognized keyword arguments.

Methods

applied_field_initialize_inputs()[source]
pydantic model pywarpx.picmi.LoadInitialField[source]

The data read in is used to initialize the E and B fields on the grid at the start of the simulation. The expected format is the file is OpenPMD with axes (x,y,z) in Cartesian, or (r,z) in Cylindrical geometry.

Field Initializer that loads the initial field from a file.

Parameters

parameter load_B: bool = True

If False, do not load magnetic field

parameter load_E: bool = True

If False, do not load electric field

parameter read_fields_from_path: str [Required]

Path to file with field data

parameter warpx_do_initial_div_cleaning: bool | None = None (name 'do_initial_div_cleaning')

Flag that controls whether or not to execute the Projection based B-field divergence cleaner. (default True)

parameter warpx_projection_div_cleaner_atol: float | None = None (name 'div_cleaner_atol')

Controls the absolute tolerance used in the divergence cleaner solve.

parameter warpx_projection_div_cleaner_rtol: float | None = None (name 'div_cleaner_rtol')

Controls the relative tolerance used in the divergence cleaner solve.

Methods

applied_field_initialize_inputs()[source]
pydantic model pywarpx.picmi.PlasmaLens[source]

Custom class to setup a plasma lens lattice. The applied fields are dependent only on the transverse position.

The field that is applied depends on the transverse position of the particle, (x,y)

  • Ex = x*strengths_E

  • Ey = y*strengths_E

  • Bx = +y*strengths_B

  • By = -x*strengths_B

Parameters

parameter lengths: list[float] [Required]

The length of each lens

parameter period: float [Required]

Periodicity of the lattice (in lab frame, in meters)

parameter starts: list[float] [Required]

The start of each lens relative to the periodic repeat

parameter strengths_B: list[float] | None = None

The magnetic field strength of each lens (default 0.)

parameter strengths_E: list[float] | None = None

The electric field strength of each lens (default 0.)

Methods

applied_field_initialize_inputs()[source]
pydantic model pywarpx.picmi.Mirror[source]

Describes a perfectly reflecting mirror, where the E and B fields are zeroed out in a plane of finite thickness.

Only one of the [x,y,z]_front_location should be specified. The mirror will be set perpendicular to the respective direction and infinite in the others. The depth of the mirror will be the maximum of the specified depth and number_of_cells, or the code’s default value if neither are specified.

Parameters

parameter depth: float | None = None

Depth of the mirror [m]

parameter number_of_cells: int | None = None

Minimum number of cells zeroed out

parameter x_front_location: float | None = None

Location in x of the front of the mirror [m]

parameter y_front_location: float | None = None

Location in y of the front of the mirror [m]

parameter z_front_location: float | None = None

Location in z of the front of the mirror [m]

Methods

applied_field_initialize_inputs()[source]

Diagnostics

pydantic model pywarpx.picmi.ParticleDiagnostic[source]

Defines the particle diagnostics in the simulation frame

See Input Parameters for more information.

Parameters

parameter data_list: list[str] | None = None

The data to be written out. Possible values ‘position’, ‘momentum’, ‘weighting’. Defaults to the output list of the implementing code.

parameter name: str | None = None

Sets the base name for the diagnostic output files

parameter parallelio: bool | None = None

If set to True, particle diagnostics are dumped in parallel

parameter period: int | str [Required]

Period of time steps at which the diagnostic is performed; WarpX also accepts the Intervals parser string syntax (e.g. ‘::10’).

parameter species: PICMI_AnySpecies | list[PICMI_AnySpecies] | None = None

Species instance (or MultiSpecies instance) or list of them to write out. If not specified, all species are written. Note that the name attribute must be defined for the species.

parameter step_max: int | None = None

Maximum step at which diagnostics could be written (default unbounded)

parameter step_min: int | None = None

Minimum step at which diagnostics could be written (default 0)

parameter warpx_dump_last_timestep: bool | None = None (name 'dump_last_timestep')

If true, the last timestep is dumped regardless of the diagnostic period/intervals.

parameter warpx_file_min_digits: int | None = None (name 'file_min_digits')

Minimum number of digits for the time step number in the file name

parameter warpx_file_prefix: str | None = None (name 'file_prefix')

Prefix on the diagnostic file name

parameter warpx_format: str = 'plotfile' (name 'format')

Diagnostic file format

parameter warpx_openpmd_backend: str | None = None (name 'openpmd_backend')

Openpmd backend file format

parameter warpx_openpmd_encoding: str | None = None (name 'openpmd_encoding')

Only read if <diag_name>.format = openpmd. openPMD file output encoding. File based: one file per timestep (slower), group/variable based: one file for all steps (faster)). Variable based is an experimental feature with ADIOS2. Default: ‘f’.

parameter warpx_plot_filter_function: str | None = None (name 'plot_filter_function')

Analytic expression to down select the particles to in the diagnostic

parameter warpx_random_fraction: float | dict[pywarpx.picmi.Species, float] | None = None (name 'random_fraction')

Random fraction of particles to include in the diagnostic. If a float is given the same fraction will be used for all species, if a dictionary is given the keys should be species with the value specifying the random fraction for that species.

parameter warpx_uniform_stride: int | dict[pywarpx.picmi.Species, int] | None = None (name 'uniform_stride')

Stride to down select to the particles to include in the diagnostic. If an integer is given the same stride will be used for all species, if a dictionary is given the keys should be species with the value specifying the stride for that species.

parameter warpx_user_defined_kw: dict [Optional] (name 'user_defined_kw')

Constants referenced in the plot filter function, collected from otherwise-unrecognized keyword arguments that start with warpx_.

parameter warpx_verbose: int | None = None (name 'verbose')

Verbosity level to use for printing diagnostic output information.

parameter write_dir: str | None = None

Directory where data is to be written

Methods

diagnostic_initialize_inputs()[source]
pydantic model pywarpx.picmi.ParticleBoundaryScrapingDiagnostic[source]

Defines the particle diagnostics that are used to collect the particles that are absorbed at the boundaries, throughout the simulation.

See Input Parameters for more information.

Parameters

parameter data_list: list[str] | None = None

The data to be written out. Possible values ‘position’, ‘momentum’, ‘weighting’. Defaults to the output list of the implementing code.

parameter name: str | None = None

Sets the base name for the diagnostic output files

parameter parallelio: bool | None = None

If set to True, particle diagnostics are dumped in parallel

parameter period: int [Required]

Period of time steps that the diagnostic is performed

parameter species: PICMI_AnySpecies | list[PICMI_AnySpecies] | None = None

Species instance (or MultiSpecies instance) or list of them to write out. If not specified, all species are written. Note that the name attribute must be defined for the species.

parameter warpx_dump_last_timestep: bool | None = None (name 'dump_last_timestep')

If true, the last timestep is dumped regardless of the diagnostic period/intervals.

parameter warpx_file_min_digits: int | None = None (name 'file_min_digits')

Minimum number of digits for the time step number in the file name

parameter warpx_file_prefix: str | None = None (name 'file_prefix')

Prefix on the diagnostic file name

parameter warpx_format: str = 'openpmd' (name 'format')

Diagnostic file format

parameter warpx_openpmd_backend: Literal['bp', 'h5', 'json'] | None = None (name 'openpmd_backend')

Openpmd backend file format

parameter warpx_openpmd_encoding: Literal['v', 'f', 'g'] | None = None (name 'openpmd_encoding')

Only read if <diag_name>.format = openpmd. openPMD file output encoding: ‘v’ (variable based), ‘f’ (file based) or ‘g’ (group based). File based: one file per timestep (slower), group/variable based: one file for all steps (faster)). Variable based is an experimental feature with ADIOS2. Default: ‘f’.

parameter warpx_plot_filter_function: str | None = None (name 'plot_filter_function')

Analytic expression to down select the particles to in the diagnostic

parameter warpx_random_fraction: float | dict[pywarpx.picmi.Species, float] | None = None (name 'random_fraction')

Random fraction of particles to include in the diagnostic. If a float is given the same fraction will be used for all species, if a dictionary is given the keys should be species with the value specifying the random fraction for that species.

parameter warpx_uniform_stride: int | dict[pywarpx.picmi.Species, int] | None = None (name 'uniform_stride')

Stride to down select to the particles to include in the diagnostic. If an integer is given the same stride will be used for all species, if a dictionary is given the keys should be species with the value specifying the stride for that species.

parameter warpx_user_defined_kw: dict [Optional] (name 'user_defined_kw')

Constants referenced in the plot filter function, collected from otherwise-unrecognized keyword arguments that start with warpx_.

parameter write_dir: str | None = None

Directory where data is to be written

Methods

diagnostic_initialize_inputs()[source]
pydantic model pywarpx.picmi.FieldDiagnostic[source]

Defines the electromagnetic field diagnostics in the simulation frame

See Input Parameters for more information.

Parameters

parameter data_list: list[str] | None = None

List of quantities to write out. Possible values ‘rho’, ‘E’, ‘B’, ‘J’, ‘Ex’ etc. Defaults to the output list of the implementing code.

parameter grid: PICMI_AnyGrid [Required]

Grid object for the diagnostic

parameter lower_bound: list[float] | None = None

Lower corner of diagnostics box in each direction. If not given, will be obtained from grid.

parameter name: str | None = None

Sets the base name for the diagnostic output files

parameter number_of_cells: list[int] | None = None

Number of cells in each dimension. If not given, will be obtained from grid.

parameter parallelio: bool | None = None

If set to True, field diagnostics are dumped in parallel

parameter period: int | str [Required]

Period of time steps at which the diagnostic is performed; WarpX also accepts the Intervals parser string syntax (e.g. ‘::10’).

parameter step_max: int | None = None

Maximum step at which diagnostics could be written (default unbounded)

parameter step_min: int | None = None

Minimum step at which diagnostics could be written (default 0)

parameter upper_bound: list[float] | None = None

Higher corner of diagnostics box in each direction. If not given, will be obtained from grid.

parameter warpx_dump_last_timestep: bool | None = None (name 'dump_last_timestep')

If true, the last timestep is dumped regardless of the diagnostic period/intervals.

parameter warpx_dump_rz_modes: bool | None = None (name 'dump_rz_modes')

Flag whether to dump the data for all RZ modes

parameter warpx_file_min_digits: int | None = None (name 'file_min_digits')

Minimum number of digits for the time step number in the file name

parameter warpx_file_prefix: str | None = None (name 'file_prefix')

Prefix on the diagnostic file name

parameter warpx_format: str = 'plotfile' (name 'format')

Diagnostic file format

parameter warpx_openpmd_backend: str | None = None (name 'openpmd_backend')

Openpmd backend file format

parameter warpx_openpmd_encoding: str | None = None (name 'openpmd_encoding')

Only read if <diag_name>.format = openpmd. openPMD file output encoding. File based: one file per timestep (slower), group/variable based: one file for all steps (faster)). Variable based is an experimental feature with ADIOS2. Default: ‘f’.

parameter warpx_particle_fields_species: list[str] | None = None (name 'particle_fields_species')

Species for which to calculate particle_fields_to_plot functions. Fields will be calculated separately for each specified species. If not passed, default is all of the available particle species.

parameter warpx_particle_fields_to_plot: list[pywarpx.picmi.ParticleFieldDiagnostic] [Optional] (name 'particle_fields_to_plot')

List of ParticleFieldDiagnostic classes to install in the simulation. Error checking is handled in the class itself.

parameter warpx_plot_crsepatch: bool | None = None (name 'plot_crsepatch')
parameter warpx_plot_finepatch: bool | None = None (name 'plot_finepatch')
parameter warpx_plot_raw_fields: bool | None = None (name 'plot_raw_fields')

Flag whether to dump the raw fields

parameter warpx_plot_raw_fields_guards: bool | None = None (name 'plot_raw_fields_guards')

Flag whether the raw fields should include the guard cells

parameter warpx_verbose: int | None = None (name 'verbose')

Verbosity level to use for printing diagnostic output information.

parameter write_dir: str | None = None

Directory where data is to be written

Methods

diagnostic_initialize_inputs()[source]
pydantic model pywarpx.picmi.TimeAveragedFieldDiagnostic[source]

Defines the electromagnetic field diagnostics in the simulation frame

See Input Parameters for more information.

See Input Parameters for more information.

Parameters

parameter data_list: list[str] | None = None

List of quantities to write out. Possible values ‘rho’, ‘E’, ‘B’, ‘J’, ‘Ex’ etc. Defaults to the output list of the implementing code.

parameter grid: PICMI_AnyGrid [Required]

Grid object for the diagnostic

parameter lower_bound: list[float] | None = None

Lower corner of diagnostics box in each direction. If not given, will be obtained from grid.

parameter name: str | None = None

Sets the base name for the diagnostic output files

parameter number_of_cells: list[int] | None = None

Number of cells in each dimension. If not given, will be obtained from grid.

parameter parallelio: bool | None = None

If set to True, field diagnostics are dumped in parallel

parameter period: int | str [Required]

Period of time steps at which the diagnostic is performed; WarpX also accepts the Intervals parser string syntax (e.g. ‘::10’).

parameter step_max: int | None = None

Maximum step at which diagnostics could be written (default unbounded)

parameter step_min: int | None = None

Minimum step at which diagnostics could be written (default 0)

parameter upper_bound: list[float] | None = None

Higher corner of diagnostics box in each direction. If not given, will be obtained from grid.

parameter warpx_average_period_steps: int | None = None (name 'average_period_steps')

Configures the number of time steps in an averaging period. Set this only in the "dynamic_start" mode and only if warpx_average_period_time has not already been set. Will be ignored in the "fixed_start" mode (with warning).

parameter warpx_average_period_time: float | None = None (name 'average_period_time')

Configures the time (SI units) in an averaging period. Set this only in the "dynamic_start" mode and only if average_period_steps has not already been set. Will be ignored in the "fixed_start" mode (with warning).

parameter warpx_average_start_step: int | None = None (name 'average_start_step')

Configures the time step at which time-averaging begins. Set this only in the "fixed_start" mode. Will be ignored in the "dynamic_start" mode (with warning).

parameter warpx_dump_last_timestep: bool | None = None (name 'dump_last_timestep')

If true, the last timestep is dumped regardless of the diagnostic period/intervals.

parameter warpx_dump_rz_modes: bool | None = None (name 'dump_rz_modes')

Flag whether to dump the data for all RZ modes

parameter warpx_file_min_digits: int | None = None (name 'file_min_digits')

Minimum number of digits for the time step number in the file name

parameter warpx_file_prefix: str | None = None (name 'file_prefix')

Prefix on the diagnostic file name

parameter warpx_format: str = 'plotfile' (name 'format')

Diagnostic file format

parameter warpx_openpmd_backend: str | None = None (name 'openpmd_backend')

Openpmd backend file format

parameter warpx_openpmd_encoding: str | None = None (name 'openpmd_encoding')

Only read if <diag_name>.format = openpmd. openPMD file output encoding. File based: one file per timestep (slower), group/variable based: one file for all steps (faster)). Variable based is an experimental feature with ADIOS2. Default: ‘f’.

parameter warpx_particle_fields_species: list[str] | None = None (name 'particle_fields_species')

Species for which to calculate particle_fields_to_plot functions. Fields will be calculated separately for each specified species. If not passed, default is all of the available particle species.

parameter warpx_particle_fields_to_plot: list[ParticleFieldDiagnostic] [Optional] (name 'particle_fields_to_plot')

List of ParticleFieldDiagnostic classes to install in the simulation. Error checking is handled in the class itself.

parameter warpx_plot_crsepatch: bool | None = None (name 'plot_crsepatch')
parameter warpx_plot_finepatch: bool | None = None (name 'plot_finepatch')
parameter warpx_plot_raw_fields: bool | None = None (name 'plot_raw_fields')

Flag whether to dump the raw fields

parameter warpx_plot_raw_fields_guards: bool | None = None (name 'plot_raw_fields_guards')

Flag whether the raw fields should include the guard cells

parameter warpx_time_average_mode: str | None = None (name 'time_average_mode')

Type of time averaging diagnostic Supported values include "none", "fixed_start", and "dynamic_start"

  • "none" for no averaging (instantaneous fields)

  • "fixed_start" for a diagnostic that averages all fields between the current output step and a fixed point in time

  • "dynamic_start" for a constant averaging period and output at different points in time (non-overlapping)

parameter warpx_verbose: int | None = None (name 'verbose')

Verbosity level to use for printing diagnostic output information.

parameter write_dir: str | None = None

Directory where data is to be written

Methods

diagnostic_initialize_inputs()[source]
pywarpx.picmi.ElectrostaticFieldDiagnostic

alias of FieldDiagnostic

pydantic model pywarpx.picmi.Checkpoint[source]

Sets up checkpointing of the simulation, allowing for later restarts

See Input Parameters for more information.

Parameters

parameter name: str = 'chkpoint'

Name of the checkpoint diagnostic

parameter period: int | str = 1

Period of time steps at which the checkpoint is written; WarpX also accepts the Intervals parser string syntax (e.g. ‘::10’).

parameter warpx_file_min_digits: int | None = None (name 'file_min_digits')

Minimum number of digits for the time step number in the checkpoint directory name.

parameter warpx_file_prefix: str | None = None (name 'file_prefix')

The prefix to the checkpoint directory names

parameter warpx_verbose: int | None = None (name 'verbose')

Verbosity level to use for printing diagnostic output information.

parameter write_dir: str | None = None

Directory where the checkpoints are written

Methods

diagnostic_initialize_inputs()[source]
pydantic model pywarpx.picmi.ReducedDiagnostic[source]

Sets up a reduced diagnostic in the simulation.

See Input Parameters for more information.

Which parameters are used depends on the type of the diagnostic. Parameters used in the expressions can be given as additional keyword arguments.

Parameters

parameter bin_max: float | None = None

For diagnostic type ‘ParticleHistogram’, the maximum value of the bins

parameter bin_max_abs: float | None = None

For diagnostic type ‘ParticleHistogram2D’, the maximum value of the bins for the abscissa axis.

parameter bin_max_ord: float | None = None

For diagnostic type ‘ParticleHistogram2D’, the maximum value of the bins for the ordinate axis.

parameter bin_min: float | None = None

For diagnostic type ‘ParticleHistogram’, the minimum value of the bins

parameter bin_min_abs: float | None = None

For diagnostic type ‘ParticleHistogram2D’, the minimum value of the bins for the abscissa axis.

parameter bin_min_ord: float | None = None

For diagnostic type ‘ParticleHistogram2D’, the minimum value of the bins for the ordinate axis.

parameter bin_number: int | None = None

For diagnostic type ‘ParticleHistogram’, the number of bins used for the histogram

parameter bin_number_abs: int | None = None

For diagnostic type ‘ParticleHistogram2D’, the number of bins used for the histogram for the abscissa axis.

parameter bin_number_ord: int | None = None

For diagnostic type ‘ParticleHistogram2D’, the number of bins used for the histogram for the ordinate axis.

parameter detector_radius: float | None = None

For diagnostic type ‘FieldProbe’, the detector “radius” (half edge length) of the ‘Plane’

parameter diag_type: Literal['ParticleEnergy', 'ParticleMomentum', 'FieldEnergy', 'FieldMomentum', 'FieldMaximum', 'FieldPoyntingFlux', 'RhoMaximum', 'ParticleNumber', 'LoadBalanceCosts', 'LoadBalanceEfficiency', 'Timestep', 'BeamRelevant', 'ParticleHistogram', 'ParticleHistogram2D', 'ParticleExtrema', 'FieldProbe', 'FieldReduction', 'ChargeOnEB'] [Required]

The type of reduced diagnostic. See the link above for all the different types of reduced diagnostics available.

parameter do_moving_window_FP: bool | None = None

For diagnostic type ‘FieldProbe’, whether the moving window is followed (default False)

parameter extension: str | None = None

The file extension used for the diagnostic output.

parameter filter_function: Expression | None = None

For diagnostic types ‘ParticleHistogram’ and ‘ParticleHistogram2D’, the function to filter whether particles are included in the histogram

parameter histogram_function: Expression | None = None

For diagnostic type ‘ParticleHistogram’, the function evaluated to produce the histogram data

parameter histogram_function_abs: Expression | None = None

For diagnostic type ‘ParticleHistogram2D’, the histogram function for the abscissa axis.

parameter histogram_function_ord: Expression | None = None

For diagnostic type ‘ParticleHistogram2D’, the histogram function for the ordinate axis.

parameter integrate: bool | None = None

For diagnostic type ‘FieldProbe’, whether the field is integrated (default False)

parameter interp_order: int | None = None

For diagnostic type ‘FieldProbe’, the interpolation order for ‘Line’ and ‘Plane’

parameter name: str | None = None

The name of this diagnostic which will also be the name of the data file written to disk.

parameter normalization: Literal['unity_particle_weight', 'max_to_unity', 'area_to_unity'] | None = None

For diagnostic type ‘ParticleHistogram’, normalization method of the histogram.

parameter path: str | None = None

The file path in which the diagnostic file should be written.

parameter period: int | str | None = None

The simulation step interval at which to output this diagnostic.

parameter probe_geometry: str | None = None

For diagnostic type ‘FieldProbe’, the geometry of the probe: ‘Point’, ‘Line’, or ‘Plane’

parameter reduced_function: Expression | None = None

For diagnostic type ‘FieldReduction’, the function of the fields to evaluate

parameter reduction_type: Literal['Maximum', 'Minimum', 'Integral'] | None = None

For diagnostic type ‘FieldReduction’, the type of reduction

parameter resolution: int | None = None

For diagnostic type ‘FieldProbe’, the number of points along the ‘Line’ or along each edge of the square ‘Plane’

parameter separator: str | None = None

The separator between row values in the output file.

parameter species: Species | None = None

The species for which to calculate the diagnostic, required for diagnostic types ‘BeamRelevant’, ‘ParticleHistogram’, ‘ParticleHistogram2D’, and ‘ParticleExtrema’

parameter target_normal_x: float | None = None

For diagnostic type ‘FieldProbe’, the normal vector to the ‘Plane’. Only applicable in 3D

parameter target_normal_y: float | None = None

For diagnostic type ‘FieldProbe’, the normal vector to the ‘Plane’. Only applicable in 3D

parameter target_normal_z: float | None = None

For diagnostic type ‘FieldProbe’, the normal vector to the ‘Plane’. Only applicable in 3D

parameter target_up_x: float | None = None

For diagnostic type ‘FieldProbe’, the vector specifying up in the ‘Plane’

parameter target_up_y: float | None = None

For diagnostic type ‘FieldProbe’, the vector specifying up in the ‘Plane’

parameter target_up_z: float | None = None

For diagnostic type ‘FieldProbe’, the vector specifying up in the ‘Plane’

parameter user_defined_kw: dict [Optional]

Constants referenced in the expressions, collected from otherwise-unrecognized keyword arguments.

parameter value_function: Expression | None = None

For diagnostic type ‘ParticleHistogram2D’, the expression for the weight used to calculate the histogram.

parameter weighting_function: Expression | None = None

For diagnostic type ‘ChargeOnEB’, the function to weight contributions to the total charge

parameter x1_probe: float | None = None

For diagnostic type ‘FieldProbe’, the end point for ‘Line’

parameter x_probe: float | None = None

For diagnostic type ‘FieldProbe’, a probe location. For ‘Point’, the location of the point. For ‘Line’, the start of the line. For ‘Plane’, the center of the square detector.

parameter y1_probe: float | None = None

For diagnostic type ‘FieldProbe’, the end point for ‘Line’

parameter y_probe: float | None = None

For diagnostic type ‘FieldProbe’, see x_probe

parameter z1_probe: float | None = None

For diagnostic type ‘FieldProbe’, the end point for ‘Line’

parameter z_probe: float | None = None

For diagnostic type ‘FieldProbe’, see x_probe

Methods

diagnostic_initialize_inputs()[source]

Lab-frame diagnostics diagnostics are used when running boosted-frame simulations.

pydantic model pywarpx.picmi.LabFrameParticleDiagnostic[source]

Defines the particle diagnostics in the lab frame

See Input Parameters for more information.

Parameters

parameter data_list: list[str] | None = None

The data to be written out. Possible values ‘position’, ‘momentum’, ‘weighting’. Defaults to the output list of the implementing code.

parameter dt_snapshots: float [Required]

Time between each snapshot in lab frame

parameter grid: PICMI_AnyGrid [Required]

Grid object for the diagnostic

parameter name: str | None = None

Sets the base name for the diagnostic output files

parameter num_snapshots: int [Required]

Number of lab frame snapshots to make

parameter parallelio: bool | None = None

If set to True, particle diagnostics are dumped in parallel

parameter species: PICMI_AnySpecies | list[PICMI_AnySpecies] | None = None

Species instance (or MultiSpecies instance) or list of them to write out. If not specified, all species are written. Note that the name attribute must be defined for the species.

parameter time_start: float = 0.0

Time for the first snapshot in lab frame

parameter warpx_buffer_size: int | None = None (name 'buffer_size')

Passed to <diagnostic name>.buffer_size

parameter warpx_file_min_digits: int | None = None (name 'file_min_digits')

Passed to <diagnostic name>.file_min_digits

parameter warpx_file_prefix: str | None = None (name 'file_prefix')

Passed to <diagnostic name>.file_prefix

parameter warpx_format: str | None = None (name 'format')

Passed to <diagnostic name>.format

parameter warpx_intervals: int | str | None = None (name 'intervals')

Selects the snapshots to be made, instead of using “num_snapshots” which makes all snapshots. “num_snapshots” is ignored.

parameter warpx_openpmd_backend: str | None = None (name 'openpmd_backend')

Passed to <diagnostic name>.openpmd_backend

parameter warpx_openpmd_encoding: Literal['f', 'g'] | None = None (name 'openpmd_encoding')

Only read if <diag_name>.format = openpmd. openPMD file output encoding: ‘f’ (file based) or ‘g’ (group based). File based: one file per timestep (slower), group/variable based: one file for all steps (faster)). Default: ‘f’.

parameter warpx_verbose: int | None = None (name 'verbose')

Verbosity level to use for printing diagnostic output information.

parameter write_dir: str | None = None

Directory where data is to be written

Methods

diagnostic_initialize_inputs()[source]
pydantic model pywarpx.picmi.LabFrameFieldDiagnostic[source]

Defines the electromagnetic field diagnostics in the lab frame

See Input Parameters for more information.

Parameters

parameter data_list: list[str] | None = None

List of quantities to write out. Possible values ‘rho’, ‘E’, ‘B’, ‘J’, ‘Ex’ etc. Defaults to the output list of the implementing code.

parameter dt_snapshots: float [Required]

Time between each snapshot in lab frame

parameter grid: PICMI_AnyGrid [Required]

Grid object for the diagnostic

parameter name: str | None = None

Sets the base name for the diagnostic output files

parameter num_snapshots: int [Required]

Number of lab frame snapshots to make

parameter parallelio: bool | None = None

If set to True, field diagnostics are dumped in parallel

parameter time_start: float = 0.0

Time for the first snapshot in lab frame

parameter warpx_buffer_size: int | None = None (name 'buffer_size')

Passed to <diagnostic name>.buffer_size

parameter warpx_file_min_digits: int | None = None (name 'file_min_digits')

Passed to <diagnostic name>.file_min_digits

parameter warpx_file_prefix: str | None = None (name 'file_prefix')

Passed to <diagnostic name>.file_prefix

parameter warpx_format: str | None = None (name 'format')

Passed to <diagnostic name>.format

parameter warpx_intervals: int | str | None = None (name 'intervals')

Selects the snapshots to be made, instead of using “num_snapshots” which makes all snapshots. “num_snapshots” is ignored.

parameter warpx_lower_bound: list[float] | None = None (name 'lower_bound')

Passed to <diagnostic name>.lower_bound

parameter warpx_openpmd_backend: str | None = None (name 'openpmd_backend')

Passed to <diagnostic name>.openpmd_backend

parameter warpx_openpmd_encoding: Literal['f', 'g'] | None = None (name 'openpmd_encoding')

Only read if <diag_name>.format = openpmd. openPMD file output encoding: ‘f’ (file based) or ‘g’ (group based). File based: one file per timestep (slower), group/variable based: one file for all steps (faster)). Default: ‘f’.

parameter warpx_upper_bound: list[float] | None = None (name 'upper_bound')

Passed to <diagnostic name>.upper_bound

parameter warpx_verbose: int | None = None (name 'verbose')

Verbosity level to use for printing diagnostic output information.

parameter write_dir: str | None = None

Directory where data is to be written

parameter z_subsampling: int = 1

A factor which is applied on the resolution of the lab frame reconstruction

Methods

diagnostic_initialize_inputs()[source]

Particles

Species objects are a collection of particles with similar properties. For instance, background plasma electrons, background plasma ions and an externally injected beam could each be their own particle species.

pydantic model pywarpx.picmi.Species[source]

Sets up the species to be simulated. The species charge and mass can be specified by setting the particle type or by setting them directly. If the particle type is specified, the charge or mass can be set to override the value from the type.

The particle advance method options:

  • ‘Boris’: Standard “leap-frog” Boris advance

  • ‘Vay’:

  • ‘Higuera-Cary’:

  • ‘Li’:

  • ‘free-streaming’: Advance with no fields

  • ‘LLRK4’: Landau-Lifschitz radiation reaction formula with RK-4)

See Input Parameters for more information.

Parameters

parameter charge: float | str | None = None

Particle charge [C], or a WarpX expression such as ‘q_e’. If not specified, determined from the particle type.

parameter charge_state: float | None = None

Charge state of the species (applies only to atoms) [1]

parameter density_scale: float | None = None

A scale factor on the density given by the initial_distribution.

parameter initial_distribution: PICMI_AnyDistribution | list[PICMI_AnyDistribution] | None = None

The initial distribution loaded at t=0. A list of distributions may be given to superimpose several distributions on the same species.

parameter interactions: list[PICMI_AnyInteraction] [Optional]

List of interactions for this species

parameter mass: float | str | None = None

Particle mass [kg], or a WarpX expression such as ‘m_e’. If not specified, determined from the particle type.

parameter method: str | None = None

The particle advance method to use. Code-specific method can be specified using ‘other:<method>’. The default is code dependent. Must be one of ‘Boris’, ‘Vay’, ‘Higuera-Cary’, ‘Li’, ‘free-streaming’, ‘LLRK4’, or start with ‘other:’

parameter name: str | None = None

Name of the species. If not specified, it will be determined from the particle type.

parameter particle_shape: Literal['NGP', 'linear', 'quadratic', 'cubic'] | int | None = None

Particle shape used for deposition and gather. If not specified, the value from the Simulation object will be used. Other values maybe specified that are code dependent.

parameter particle_type: str | None = None

A string specifying an elementary particle, atom, or other, as defined in the openPMD 2 species type extension, openPMD-standard/EXT_SpeciesType.md

parameter warpx_add_int_attributes: dict[str, Expression] | None = None (name 'extra_int_attributes')

Dictionary of extra integer particle attributes initialized from an expression that is a function of the variables (x, y, z, ux, uy, uz, t).

parameter warpx_add_real_attributes: dict[str, Expression] | None = None (name 'extra_real_attributes')

Dictionary of extra real particle attributes initialized from an expression that is a function of the variables (x, y, z, ux, uy, uz, t).

parameter warpx_boost_adjust_transverse_positions: bool | None = None (name 'boost_adjust_transverse_positions')

Whether to adjust transverse positions when apply the boost to the simulation frame

parameter warpx_do_not_deposit: bool | None = None (name 'do_not_deposit')

Whether or not to deposit the charge and current density for for this species

parameter warpx_do_not_gather: bool | None = None (name 'do_not_gather')

Whether or not to gather the fields from grids for this species

parameter warpx_do_not_push: bool | None = None (name 'do_not_push')

Whether or not to push this species

parameter warpx_do_resampling: bool | None = None (name 'do_resampling')

Whether particles will be resampled

parameter warpx_do_temperature_deposition: bool | None = None (name 'do_temperature_deposition')

This flag is set per species to do another pass to deposit temperature on each timestep if required. Currently only works with Ohm’s Law Hybrid Solver.

parameter warpx_radial_numpercell_power: float | None = None (name 'radial_numpercell_power')

With cylindrical geometry, specifies the radial power of the number of particles per cell

parameter warpx_random_theta: bool | None = None (name 'random_theta')

Whether or not to add random angle to the particles in theta when in RZ mode.

parameter warpx_reflection_model_xhi: float | str | None = None (name 'reflection_model_xhi')

Expression (in terms of the velocity “v”) specifying the probability that the particle will reflect on the upper x boundary

parameter warpx_reflection_model_xlo: float | str | None = None (name 'reflection_model_xlo')

Expression (in terms of the velocity “v”) specifying the probability that the particle will reflect on the lower x boundary

parameter warpx_reflection_model_yhi: float | str | None = None (name 'reflection_model_yhi')

Expression (in terms of the velocity “v”) specifying the probability that the particle will reflect on the upper y boundary

parameter warpx_reflection_model_ylo: float | str | None = None (name 'reflection_model_ylo')

Expression (in terms of the velocity “v”) specifying the probability that the particle will reflect on the lower y boundary

parameter warpx_reflection_model_zhi: float | str | None = None (name 'reflection_model_zhi')

Expression (in terms of the velocity “v”) specifying the probability that the particle will reflect on the upper z boundary

parameter warpx_reflection_model_zlo: float | str | None = None (name 'reflection_model_zlo')

Expression (in terms of the velocity “v”) specifying the probability that the particle will reflect on the lower z boundary

parameter warpx_resampling_algorithm: str | None = None (name 'resampling_algorithm')

Resampling algorithm to use.

parameter warpx_resampling_algorithm_delta_u: float | list[float] | None = None (name 'resampling_algorithm_delta_u')

Size of velocity window used in ux, uy and uz for clustering particles during grid-based merging, with velocity_grid_type == “cartesian”. If a single number is given the same du value will be used in all three directions.

parameter warpx_resampling_algorithm_delta_ur: float | None = None (name 'resampling_algorithm_delta_ur')

Size of velocity window used for clustering particles during grid-based merging, with velocity_grid_type == “spherical”.

parameter warpx_resampling_algorithm_n_phi: int | None = None (name 'resampling_algorithm_n_phi')

Number of bins to use in phi when clustering particle velocities during grid-based merging, with velocity_grid_type == “spherical”.

parameter warpx_resampling_algorithm_n_theta: int | None = None (name 'resampling_algorithm_n_theta')

Number of bins to use in theta when clustering particle velocities during grid-based merging, with velocity_grid_type == “spherical”.

parameter warpx_resampling_algorithm_target_ratio: float | None = None (name 'resampling_algorithm_target_ratio')

Roughly corresponds to the ratio between the number of particles before and after resampling. Only used with the leveling_thinning algorithm.

parameter warpx_resampling_algorithm_target_weight: float | None = None (name 'resampling_algorithm_target_weight')

Weight that the product particles from resampling will not exceed.

parameter warpx_resampling_algorithm_velocity_grid_type: str | None = None (name 'resampling_algorithm_velocity_grid_type')

Type of grid to use when clustering particles in velocity space. Only applicable with the velocity_coincidence_thinning algorithm.

parameter warpx_resampling_min_ppc: int | None = None (name 'resampling_min_ppc')

Cells with fewer particles than this number will be skipped during resampling.

parameter warpx_resampling_trigger_intervals: int | str | None = None (name 'resampling_trigger_intervals')

Timesteps at which to resample

parameter warpx_resampling_trigger_max_avg_ppc: float | None = None (name 'resampling_triggering_max_avg_ppc')

Resampling will be done when the average number of particles per cell exceeds this number

parameter warpx_save_particles_at_eb: bool | None = None (name 'save_particles_at_eb')

Whether to save particles lost at the embedded boundary

parameter warpx_save_particles_at_xhi: bool | None = None (name 'save_particles_at_xhi')

Whether to save particles lost at the upper x boundary

parameter warpx_save_particles_at_xlo: bool | None = None (name 'save_particles_at_xlo')

Whether to save particles lost at the lower x boundary

parameter warpx_save_particles_at_yhi: bool | None = None (name 'save_particles_at_yhi')

Whether to save particles lost at the upper y boundary

parameter warpx_save_particles_at_ylo: bool | None = None (name 'save_particles_at_ylo')

Whether to save particles lost at the lower y boundary

parameter warpx_save_particles_at_zhi: bool | None = None (name 'save_particles_at_zhi')

Whether to save particles lost at the upper z boundary

parameter warpx_save_particles_at_zlo: bool | None = None (name 'save_particles_at_zlo')

Whether to save particles lost at the lower z boundary

parameter warpx_save_previous_position: bool | None = None (name 'save_previous_position')

Whether to save the old particle positions

parameter warpx_self_fields_absolute_tolerance: float | None = None (name 'self_fields_absolute_tolerance')

Absolute precision on the electrostatic solver (when using the relativistic solver)

parameter warpx_self_fields_max_iters: int | None = None (name 'self_fields_max_iters')

Maximum number of iterations for the electrostatic solver for the species

parameter warpx_self_fields_required_precision: float | None = None (name 'self_fields_required_precision')

Relative precision on the electrostatic solver (when using the relativistic solver)

parameter warpx_self_fields_verbosity: int | None = None (name 'self_fields_verbosity')

Level of verbosity for the electrostatic solver

Methods

species_initialize_inputs(layout, initialize_self_fields=False, injection_plane_position=None, injection_plane_normal_vector=None)[source]

Attributes

methods_list: ClassVar[list[str]] = ['Boris', 'Vay', 'Higuera-Cary', 'Li', 'free-streaming', 'LLRK4']

Properties

property species

The WarpX inputs of this species (available after the inputs are initialized)

pydantic model pywarpx.picmi.MultiSpecies[source]

INCOMPLETE: proportions argument is not implemented Multiple species that are initialized with the same distribution. Each parameter can be list, giving a value for each species, or a single value which is given to all species. The species charge and mass can be specified by setting the particle type or by setting them directly. If the particle type is specified, the charge or mass can be set to override the value from the type.

The species are created at construction, so their parameters cannot be changed afterwards.

Parameters

parameter charge_states: float | list[float | None] | None = None

Charge states of the species (applies only to atoms)

parameter charges: float | list[float | None] | None = None

Particle charges, required when type is not specified, otherwise determined from type [C]

parameter initial_distribution: PICMI_AnyDistribution | list[PICMI_AnyDistribution] | None = None

Initial particle distribution, applied to all species

parameter masses: float | list[float | None] | None = None

Particle masses, required when type is not specified, otherwise determined from type [kg]

parameter names: str | list[str | None] | None = None

Names of the species

parameter particle_shape: _ParticleShape | None = None

Particle shape used for deposition and gather (‘NGP’, ‘linear’, ‘quadratic’, ‘cubic’). If not specified, the value from the Simulation object will be used. Other values maybe specified that are code dependent.

parameter particle_types: str | list[str | None] | None = None

A string specifying an elementary particle, atom, or other, as defined in the openPMD 2 species type extension, openPMD-standard/EXT_SpeciesType.md

parameter proportions: float | list[float | None] | None = None

Proportions of the initial distribution made up by each species

Attributes

Species_class

alias of Species

Methods

static get_input_item(var, i)

The value for the i-th species of a parameter given for each species or for all

species_initialize_inputs(layout, initialize_self_fields=False, injection_plane_position=None, injection_plane_normal_vector=None)[source]

Properties

property nspecies

Number of species

property species_instances_dict

The species instances that have a name, by name

property species_instances_list

The species instances, in order

Particle distributions can be used for to initialize particles in a particle species. Any of them is passed as PICMI_AnyDistribution to Species(initial_distribution=...).

pydantic model pywarpx.picmi.GaussianBunchDistribution[source]

Describes a Gaussian distribution of particles

Parameters

parameter centroid_position: list[float] [Optional]

Position of the bunch centroid at t=0 [m]

parameter centroid_velocity: list[float] [Optional]

Velocity (gamma*V) of the bunch centroid at t=0 [m/s]

parameter n_physical_particles: float [Required]

Number of physical particles in the bunch

parameter rms_bunch_size: list[float] [Required]

RMS bunch size at t=0 [m]

parameter rms_velocity: list[float] [Optional]

RMS velocity spread at t=0 [m/s]

parameter velocity_divergence: list[float] [Optional]

Expansion rate of the bunch at t=0 [m/s/m]

parameter warpx_do_symmetrize: bool | None = None (name 'do_symmetrize')

Whether to symmetrize the bunch

parameter warpx_symmetrization_order: int | None = None (name 'symmetrization_order')

The order of the symmetrization (4 or 8)

Methods

distribution_initialize_inputs(species_number, layout, species, density_scale, source_name)[source]
pydantic model pywarpx.picmi.UniformDistribution[source]

Describes a uniform density distribution of particles

Parameters

parameter density: float [Required]

Physical number density [m^-3]

parameter directed_velocity: list[float] [Optional]

Directed, average, proper velocity [m/s]

parameter fill_in: bool | None = None

Flags whether to fill in the empty spaced opened up when the grid moves

parameter lower_bound: list[float | None] [Optional]

Lower bound of the distribution [m]

parameter rms_velocity: list[float] [Optional]

Thermal velocity spread [m/s]

parameter upper_bound: list[float | None] [Optional]

Upper bound of the distribution [m]

Methods

distribution_initialize_inputs(species_number, layout, species, density_scale, source_name)[source]
pydantic model pywarpx.picmi.AnalyticDistribution[source]

Describes a plasma with density following a provided analytic expression

Parameters can be used in the expressions, with their values given as keyword arguments. For example, this creates a distribution where the density is n0 below rmax and zero elsewhere:

dist = AnalyticDistribution(density_expression='((x**2+y**2)<rmax**2)*n0',
                            rmax = 1.,
                            n0 = 1.e20,
                            ...)

Parameters

parameter density_expression: Expression [Required]

Analytic expression describing physical number density [m^-3]. Expression should be in terms of the position, written as ‘x’, ‘y’, and ‘z’. Parameters can be used in the expression with the values given as keyword arguments.

parameter directed_velocity: list[float] [Optional]

Directed, average, proper velocity [m/s]

parameter fill_in: bool | None = None

Flags whether to fill in the empty spaced opened up when the grid moves

parameter lower_bound: list[float | None] [Optional]

Lower bound of the distribution [m]

parameter momentum_expressions: list[Expression | None] [Optional]

Analytic expressions describing the gamma*velocity for each axis [m/s]. Expressions should be in terms of the position, written as ‘x’, ‘y’, and ‘z’. For any axis not supplied (set to None), directed_velocity will be used.

parameter rms_velocity: list[float] [Optional]

Thermal velocity spread [m/s]

parameter upper_bound: list[float | None] [Optional]

Upper bound of the distribution [m]

parameter user_defined_kw: dict [Optional]

Constants referenced in the analytic expressions, collected from otherwise-unrecognized keyword arguments.

parameter warpx_density_max: float | None = None (name 'density_max')

Maximum plasma density. The density at each point is the minimum between the value given in the profile, and density_max.

parameter warpx_density_min: float | None = None (name 'density_min')

Minimum plasma density. No particle is injected where the density is below this value.

parameter warpx_momentum_spread_expressions: list[Optional[Expression]] [Optional] (name 'momentum_spread_expressions')

Analytic expressions describing the gamma*velocity spread for each axis [m/s]. Expressions should be in terms of the position, written as ‘x’, ‘y’, and ‘z’. Parameters can be used in the expression with the values given as keyword arguments. For any axis not supplied (set to None), zero will be used.

Methods

distribution_initialize_inputs(species_number, layout, species, density_scale, source_name)[source]
pydantic model pywarpx.picmi.UniformFluxDistribution[source]

Describes a flux of particles emitted from a plane

Parameters can be used in the flux expression, with their values given as keyword arguments.

Parameters

parameter directed_velocity: list[float] [Optional]

Directed, average, proper velocity [m/s]

parameter flux: Expression [Required]

Analytic expression describing flux of particles [m^-2.s^-1]. Expression should be in terms of the position and time, written as ‘x’, ‘y’, ‘z’, and ‘t’.

parameter flux_direction: Literal[-1, 1] [Required]

Direction of the flux relative to the plane: -1 or +1

parameter flux_normal_axis: str [Required]

x, y, or z for 3D, x or z for 2D, or r, t, or z in RZ geometry

parameter flux_tmax: float | None = None

Time at which the flux injection will be turned off.

parameter flux_tmin: float | None = None

Time at which the flux injection will be turned on.

parameter gaussian_flux_momentum_distribution: bool | None = None

If True, the momentum distribution is v*Gaussian, in the direction normal to the plane. Otherwise, the momentum distribution is simply Gaussian.

parameter lower_bound: list[float | None] [Optional]

Lower bound of the distribution [m]

parameter rms_velocity: list[float] [Optional]

Thermal velocity spread [m/s]

parameter surface_flux_position: float [Required]

Location of the injection plane [m] along the direction specified by flux_normal_axis

parameter upper_bound: list[float | None] [Optional]

Upper bound of the distribution [m]

parameter user_defined_kw: dict [Optional]

Constants referenced in the flux expression, collected from otherwise-unrecognized keyword arguments.

parameter warpx_inject_from_embedded_boundary: bool = False (name 'inject_from_embedded_boundary')

When true, the flux is injected from the embedded boundaries instead of a plane.

Methods

initialize_flux_profile_func(species, density_scale, source_name)[source]

Initialize the flux profile and flux function.

pydantic model pywarpx.picmi.AnalyticFluxDistribution[source]

Describes a flux of particles emitted from a plane

Parameters can be used in the flux expression, with their values given as keyword arguments.

Parameters

parameter directed_velocity: list[float] [Optional]

Directed, average, proper velocity [m/s]

parameter flux: Expression [Required]

Analytic expression describing flux of particles [m^-2.s^-1]. Expression should be in terms of the position and time, written as ‘x’, ‘y’, ‘z’, and ‘t’.

parameter flux_direction: Literal[-1, 1] [Required]

Direction of the flux relative to the plane: -1 or +1

parameter flux_normal_axis: str [Required]

x, y, or z for 3D, x or z for 2D, or r, t, or z in RZ geometry

parameter flux_tmax: float | None = None

Time at which the flux injection will be turned off.

parameter flux_tmin: float | None = None

Time at which the flux injection will be turned on.

parameter gaussian_flux_momentum_distribution: bool | None = None

If True, the momentum distribution is v*Gaussian, in the direction normal to the plane. Otherwise, the momentum distribution is simply Gaussian.

parameter lower_bound: list[float | None] [Optional]

Lower bound of the distribution [m]

parameter rms_velocity: list[float] [Optional]

Thermal velocity spread [m/s]

parameter surface_flux_position: float [Required]

Location of the injection plane [m] along the direction specified by flux_normal_axis

parameter upper_bound: list[float | None] [Optional]

Upper bound of the distribution [m]

parameter user_defined_kw: dict [Optional]

Constants referenced in the flux expression, collected from otherwise-unrecognized keyword arguments.

parameter warpx_inject_from_embedded_boundary: bool = False (name 'inject_from_embedded_boundary')

When true, the flux is injected from the embedded boundaries instead of a plane.

Methods

initialize_flux_profile_func(species, density_scale, source_name)[source]

Initialize the flux profile and flux function.

pydantic model pywarpx.picmi.ParticleListDistribution[source]

Load particles at the specified positions and velocities

The positions and velocities can be given as lists, or as a single value that is used for all particles. All lists must have the same length.

Parameters

parameter ux: list[float] [Optional]

List of ux of the particles (ux = gamma*vx) [m/s]

parameter uy: list[float] [Optional]

List of uy of the particles (uy = gamma*vy) [m/s]

parameter uz: list[float] [Optional]

List of uz of the particles (uz = gamma*vz) [m/s]

parameter weight: float | list[float] = 0.0

Particle weight or list of weights, number of real particles per simulation particle

parameter x: list[float] [Optional]

List of x positions of the particles [m]

parameter y: list[float] [Optional]

List of y positions of the particles [m]

parameter z: list[float] [Optional]

List of z positions of the particles [m]

Methods

distribution_initialize_inputs(species_number, layout, species, density_scale, source_name)[source]
pydantic model pywarpx.picmi.FromFileDistribution[source]

Load particles from an openPMD file.

The openPMD file must contain the attributes position, momentum, weighting.

Parameters

parameter file_path: str [Required]

Path to the openPMD file

Methods

distribution_initialize_inputs(species_number, layout, species, density_scale, source_name)[source]

Particle layouts determine how to microscopically place macro particles in a grid cell. Any of them is passed as PICMI_AnyLayout to Simulation.add_species.

pydantic model pywarpx.picmi.GriddedLayout[source]

Specifies a gridded layout of particles

Parameters

parameter grid: PICMI_AnyGrid | None = None

Grid object specifying the grid to follow. If not specified, the underlying grid of the code is used.

parameter n_macroparticles_per_cell: list[int] [Required]

Number of particles per cell along each axis (one entry per grid dimension, or a single number in 1D)

Properties

property n_macroparticle_per_cell
pydantic model pywarpx.picmi.PseudoRandomLayout[source]

Specifies a pseudo-random layout of the particles

Parameters

parameter grid: PICMI_AnyGrid | None = None

Grid object specifying the grid to follow for n_macroparticles_per_cell. If not specified, the underlying grid of the code is used.

parameter n_macroparticles: int | None = None

Total number of macroparticles to load. Either this argument or n_macroparticles_per_cell should be supplied (not both).

parameter n_macroparticles_per_cell: int | None = None

Number of macroparticles to load per cell. Either this argument or n_macroparticles should be supplied (not both).

parameter seed: int | None = None

Pseudo-random number generator seed

Other operations related to particles:

pydantic model pywarpx.picmi.CoulombCollisions[source]

Base class of the collisions, accepted by Simulation.warpx_collisions

Custom class to handle setup of binary Coulomb collisions in WarpX. If collision initialization is added to picmistandard this can be changed to inherit that functionality.

Parameters

parameter CoulombLog: float | None = None

Value of the Coulomb log to use in the collision cross section. If not supplied, it is calculated from the local conditions.

parameter name: str [Required]

Name of instance (used in the inputs file)

parameter ndt_subcycle: int | None = None

Run collision ndt_subcycle times per PIC time step (dt_collision = dt_PIC / ndt_subcycle). Mutually exclusive with ndt_supercycle.

parameter ndt_supercycle: int | None = None

Run collision once every ndt_supercycle PIC time steps (dt_collision = ndt_supercycle * dt_PIC). Mutually exclusive with ndt_subcycle. Default is 1.

parameter species: list[pywarpx.picmi.Species] [Required]

The species involved in the collision. Must be of length 2.

parameter start_step: int | None = None

First PIC time step on which the collision is applied. With ndt_supercycle, this acts as an offset: the collision runs on steps start_step, start_step + ndt_supercycle, start_step + 2*ndt_supercycle, … Default is 0.

Methods

collision_initialize_inputs()[source]
pydantic model pywarpx.picmi.DSMCCollisions[source]

Base class of the collisions, accepted by Simulation.warpx_collisions

Custom class to handle setup of DSMC collisions in WarpX. If collision initialization is added to picmistandard this can be changed to inherit that functionality.

Parameters

parameter name: str [Required]

Name of instance (used in the inputs file)

parameter ndt_subcycle: int | None = None

Run collision ndt_subcycle times per PIC time step (dt_collision = dt_PIC / ndt_subcycle). Mutually exclusive with ndt_supercycle.

parameter ndt_supercycle: int | None = None

Run collision once every ndt_supercycle PIC time steps (dt_collision = ndt_supercycle * dt_PIC). Mutually exclusive with ndt_subcycle. Default is 1.

parameter product_species: list[pywarpx.picmi.Species] | None = None

The species produced by collision processes (currently both ionization and charge-exchange require defining the product species).

parameter scattering_processes: dict[str, dict[str, pywarpx.picmi.Species | int | float | str]] [Required]

The scattering process to use and any needed information

parameter species: list[pywarpx.picmi.Species] [Required]

The species involved in the collision

parameter start_step: int | None = None

First PIC time step on which the collision is applied. With ndt_supercycle, this acts as an offset: the collision runs on steps start_step, start_step + ndt_supercycle, start_step + 2*ndt_supercycle, … Default is 0.

Methods

collision_initialize_inputs()[source]
pydantic model pywarpx.picmi.MCCCollisions[source]

Base class of the collisions, accepted by Simulation.warpx_collisions

Custom class to handle setup of MCC collisions in WarpX. If collision initialization is added to picmistandard this can be changed to inherit that functionality.

Parameters

parameter background_density: float | str [Required]

The density of the background. An string expression as a function of (x, y, z, t) can be used.

parameter background_mass: float | None = None

The mass of the background particle. If not supplied, the default depends on the type of scattering process.

parameter background_temperature: float | str [Required]

The temperature of the background. An string expression as a function of (x, y, z, t) can be used.

parameter max_background_density: float | None = None

The maximum background density. When the background_density is an expression, this must also be specified.

parameter name: str [Required]

Name of instance (used in the inputs file)

parameter ndt_subcycle: int | None = None

Run collision ndt_subcycle times per PIC time step (dt_collision = dt_PIC / ndt_subcycle). Mutually exclusive with ndt_supercycle.

parameter ndt_supercycle: int | None = None

Run collision once every ndt_supercycle PIC time steps (dt_collision = ndt_supercycle * dt_PIC). Mutually exclusive with ndt_subcycle. Default is 1.

parameter scattering_processes: dict[str, dict[str, pywarpx.picmi.Species | int | float | str]] [Required]

The scattering process to use and any needed information

parameter species: Species [Required]

The species involved in the collision

parameter start_step: int | None = None

First PIC time step on which the collision is applied. With ndt_supercycle, this acts as an offset: the collision runs on steps start_step, start_step + ndt_supercycle, start_step + 2*ndt_supercycle, … Default is 0.

Methods

collision_initialize_inputs()[source]
pydantic model pywarpx.picmi.FieldIonization[source]

Field ionization on an ion species

WarpX only has ADK ionization model implemented.

Parameters

parameter ionized_species: PICMI_Species [Required]

Species that is ionized

parameter model: Literal['ADK'] [Required]

Ionization model. WarpX only has the “ADK” model implemented.

parameter product_species: PICMI_Species [Required]

Species in which ionized electrons are stored.

Methods

interaction_initialize_inputs()[source]

Laser Pulses

Laser profiles can be used to initialize laser pulses in the simulation. Any of them is passed as PICMI_AnyLaser to Simulation.add_laser.

pydantic model pywarpx.picmi.GaussianLaser[source]

Specifies a Gaussian laser distribution.

More precisely, the electric field near the focal plane is given by:

\[E(\boldsymbol{x},t) = a_0\times E_0\, \exp\left( -\frac{r^2}{w_0^2} - \frac{(z-z_0-ct)^2}{c^2\tau^2} \right) \cos[ k_0( z - z_0 - ct ) - \phi_{cep} ]\]

where \(k_0 = 2\pi/\lambda_0\) is the wavevector and where \(E_0 = m_e c^2 k_0 / q_e\) is the field amplitude for \(a_0=1\).

Note

The additional terms that arise far from the focal plane (Gouy phase, wavefront curvature, …) are not included in the above formula for simplicity, but are of course taken into account by the code, when initializing the laser pulse away from the focal plane.

Parameters

parameter E0: float | None = None

Maximum amplitude of the laser field [V/m]. Specify either a0 or E0 (if both are given, they must be consistent).

parameter a0: float | None = None

Normalized vector potential at focus. Specify either a0 or E0 (if both are given, they must be consistent).

parameter beta: float | None = None

Angular dispersion at focus (in the lab frame) [rad.s]

parameter centroid_position: list[float] [Required]

Vector of length 3 of floats. Position of the laser centroid at time 0 [m]

parameter duration: float [Required]

Duration of the Gaussian pulse [s], defined as \(\tau\) in the above formula

parameter fill_in: bool = True

Flags whether to fill in the empty spaced opened up when the grid moves

parameter focal_position: list[float] [Required]

Vector of length 3 of floats. Position of the laser focus [m]

parameter name: str | None = None

Optional name of the laser

parameter phi0: float | None = None

Carrier envelope phase (CEP) [rad]

parameter phi2: float | None = None

Temporal chirp at focus (in the lab frame) [s^2]

parameter polarization_direction: list[float] [Required]

Unit vector of length 3. Direction of polarization [1]

parameter propagation_direction: list[float] [Required]

Unit vector of length 3. Direction of propagation [1]

parameter waist: float [Required]

Waist of the Gaussian pulse at focus [m], defined as \(w_0\) in the above formula

parameter wavelength: float [Required]

Laser wavelength [m], defined as \(\lambda_0\) in the above formula

parameter zeta: float | None = None

Spatial chirp at focus (in the lab frame) [m.s]

Methods

laser_initialize_inputs()[source]

Properties

property k0: float

Laser wavenumber [1/m], \(k_0 = 2\pi/\lambda_0\)

property laser

The WarpX inputs of this laser (available after the inputs are initialized)

pydantic model pywarpx.picmi.AnalyticLaser[source]

Specifies a laser with an analytically described distribution

Parameters can be used in the field expression, with their values given as keyword arguments.

Parameters

parameter Emax: float | None = None

Maximum amplitude of the laser field [V/m]. Specify either amax or Emax (if both are given, they must be consistent). This should be built into the expression, but some codes require a specified value for numerical purposes.

parameter amax: float | None = None

Maximum normalized vector potential. Specify either amax or Emax (if both are given, they must be consistent). This should be built into the expression, but some codes require a specified value for numerical purposes.

parameter field_expression: Expression [Required]

Analytic expression describing the electric field of the laser [V/m]. Expression should be in terms of the position, ‘X’, ‘Y’, in the plane orthogonal to the propagation direction, and ‘t’ the time. The expression should describe the full field, including the oscillitory component. Parameters can be used in the expression with the values given as keyword arguments.

parameter fill_in: bool = True

Flags whether to fill in the empty spaced opened up when the grid moves

parameter name: str | None = None

Optional name of the laser

parameter polarization_direction: list[float] [Required]

Unit vector of length 3. Direction of polarization [1]

parameter propagation_direction: list[float] [Required]

Unit vector of length 3. Direction of propagation [1]

parameter user_defined_kw: dict [Optional]

Constants referenced in the field expression, collected from otherwise-unrecognized keyword arguments.

parameter wavelength: float [Required]

Laser wavelength. This should be built into the expression, but some codes require a specified value for numerical purposes.

Methods

laser_initialize_inputs()[source]

Properties

property k0: float

Laser wavenumber [1/m], \(k_0 = 2\pi/\lambda_0\)

property laser

The WarpX inputs of this laser (available after the inputs are initialized)

Laser injectors control where to initialize laser pulses on the simulation grid. Any of them is passed as PICMI_AnyLaserInjection to Simulation.add_laser.

pydantic model pywarpx.picmi.LaserAntenna[source]

Specifies the laser antenna injection method

Parameters

parameter normal_vector: list[float] | None = None

Vector of length 3. Vector normal to antenna plane, defaults to the laser direction of propagation [1]

parameter position: list[float] [Required]

Vector of length 3. Position of antenna launching the laser [m]

Methods

laser_antenna_initialize_inputs(laser)[source]

Type Aliases

The types of the parameters name the classes that they accept, e.g., PICMI_AnySolver for a field solver. These type aliases of the PICMI standard accept the WarpX classes of that kind, which derive from the classes of the standard:

picmistandard.PICMI_AnyGrid

Cartesian1DGrid, Cartesian2DGrid, Cartesian3DGrid, CylindricalGrid

picmistandard.PICMI_AnySpecies

MultiSpecies, Species

picmistandard.PICMI_AnyDiagnostic

Checkpoint, ElectrostaticFieldDiagnostic, FieldDiagnostic, LabFrameFieldDiagnostic, LabFrameParticleDiagnostic, ParticleBoundaryScrapingDiagnostic, ParticleDiagnostic, ReducedDiagnostic, TimeAveragedFieldDiagnostic

picmistandard.PICMI_AnySolver

ElectromagneticSolver, ElectrostaticSolver, HybridPICSolver

picmistandard.PICMI_AnyAppliedField

AnalyticAppliedField, AnalyticInitialField, ConstantAppliedField, LoadAppliedField, LoadInitialField, LoadInitialFieldFromPython, Mirror, PlasmaLens

picmistandard.PICMI_AnyInteraction

FieldIonization

picmistandard.PICMI_AnyLaser

AnalyticLaser, GaussianLaser

picmistandard.PICMI_AnyLaserInjection

LaserAntenna

picmistandard.PICMI_AnyDistribution

AnalyticDistribution, AnalyticFluxDistribution, FromFileDistribution, GaussianBunchDistribution, ParticleListDistribution, UniformDistribution, UniformFluxDistribution

picmistandard.PICMI_AnyLayout

GriddedLayout, PseudoRandomLayout