Simulation

The Simulation object is the central object in a PICMI script. It defines the simulation time, field solver, registered species, etc.

class picmistandard.PICMI_Simulation(solver=None, time_step_size=None, max_steps=None, max_time=None, verbose=None, particle_shape='linear', gamma_boost=None, load_balancing=None, **kw)[source]

Creates a Simulation object

Parameters:
  • solver (field solver instance) – This is the field solver to be used in the simulation. It should be an instance of field solver classes.

  • time_step_size (float) – Absolute time step size of the simulation [s]. Needed if the CFL is not specified elsewhere.

  • max_steps (integer) – Maximum number of time steps. Specify either this, or max_time, or use the step function directly.

  • max_time (float) – Maximum physical time to run the simulation [s]. Specify either this, or max_steps, or use the step function directly.

  • verbose (integer, optional) – Verbosity flag. A larger integer results in more verbose output

  • particle_shape ({'NGP', 'linear', 'quadratic', 'cubic'}) – Default particle shape for species added to this simulation

  • gamma_boost (float, optional) – Lorentz factor of the boosted simulation frame. Note that all input values should be in the lab frame.

add_species(species, layout, initialize_self_field=None)[source]

Add species to be used in the simulation

Parameters:
  • species (species instance) – 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 (layout instance) – An instance of one of the PICMI particle layout objects. 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_laser(laser, injection_method)[source]

Add a laser pulses that to be injected in the simulation

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

  • injection_method (laser injection instance, optional) – 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_applied_field(applied_field)[source]

Add an applied field

Parameters:

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

write_input_file(file_name)[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 (string) – The path to the file that will be created

step(nsteps=1)[source]

Run the simulation for nsteps timesteps

Parameters:

nsteps (integer, default=1) – The number of timesteps

extension()[source]

Reserved for code-specific extensions, for example returns a class instance that has further methods for manipulating a PIC simulation.