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 :ref:`the examples section <usage-examples>`.
In the input file, instances of classes are created defining the various aspects of the simulation. A variable of type :py:class:`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 :ref:`extended with custom runtime functionality <usage-python-extend>`:
.. tab-set:: .. tab-item:: Interactive :py:meth:`~pywarpx.picmi.Simulation.step`: run directly from Python .. tab-item:: Preprocessor :py:meth:`~pywarpx.picmi.Simulation.write_input_file`: create an :ref:`inputs file for a WarpX executable <running-cpp-parameters>`
When run directly from Python, one can also extend WarpX with further custom user logic. See the :ref:`detailed workflow page <usage-python-extend>` on how to extend WarpX from Python.
.. autoclass:: pywarpx.picmi.Simulation :members: step, add_species, add_laser, write_input_file
.. autoclass:: pywarpx.picmi.Cartesian3DGrid
.. autoclass:: pywarpx.picmi.Cartesian2DGrid
.. autoclass:: pywarpx.picmi.Cartesian1DGrid
.. autoclass:: pywarpx.picmi.CylindricalGrid
.. autoclass:: pywarpx.picmi.EmbeddedBoundary
Field solvers define the updates of electric and magnetic fields.
.. autoclass:: pywarpx.picmi.ElectromagneticSolver
.. autoclass:: pywarpx.picmi.ElectrostaticSolver
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_0picmi.constants.mu0
: The vacuum permeability \mu_0picmi.constants.q_e
: The elementary charge (absolute value of the charge of an electron).picmi.constants.m_e
: The electron masspicmi.constants.m_p
: The proton mass
.. autoclass:: pywarpx.picmi.AnalyticInitialField
.. autoclass:: pywarpx.picmi.ConstantAppliedField
.. autoclass:: pywarpx.picmi.AnalyticAppliedField
.. autoclass:: pywarpx.picmi.PlasmaLens
.. autoclass:: pywarpx.picmi.Mirror
.. autoclass:: pywarpx.picmi.ParticleDiagnostic
.. autoclass:: pywarpx.picmi.FieldDiagnostic
.. autoclass:: pywarpx.picmi.ElectrostaticFieldDiagnostic
.. autoclass:: pywarpx.picmi.Checkpoint
.. autoclass:: pywarpx.picmi.ReducedDiagnostic
Lab-frame diagnostics diagnostics are used when running boosted-frame simulations.
.. autoclass:: pywarpx.picmi.LabFrameParticleDiagnostic
.. autoclass:: pywarpx.picmi.LabFrameFieldDiagnostic
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.
.. autoclass:: pywarpx.picmi.Species
.. autoclass:: pywarpx.picmi.MultiSpecies
Particle distributions can be used for to initialize particles in a particle species.
.. autoclass:: pywarpx.picmi.GaussianBunchDistribution
.. autoclass:: pywarpx.picmi.UniformDistribution
.. autoclass:: pywarpx.picmi.AnalyticDistribution
.. autoclass:: pywarpx.picmi.ParticleListDistribution
Particle layouts determine how to microscopically place macro particles in a grid cell.
.. autoclass:: pywarpx.picmi.GriddedLayout
.. autoclass:: pywarpx.picmi.PseudoRandomLayout
Other operations related to particles:
.. autoclass:: pywarpx.picmi.CoulombCollisions
.. autoclass:: pywarpx.picmi.DSMCCollisions
.. autoclass:: pywarpx.picmi.MCCCollisions
.. autoclass:: pywarpx.picmi.FieldIonization
Laser profiles can be used to initialize laser pulses in the simulation.
.. autoclass:: pywarpx.picmi.GaussianLaser
.. autoclass:: pywarpx.picmi.AnalyticLaser
Laser injectors control where to initialize laser pulses on the simulation grid.
.. autoclass:: pywarpx.picmi.LaserAntenna