picongpu.pypicongpu.species

Data structures to specify and initialize particle species.

Note that the data structure (the classes) here use a different architecure than both (!) PIConGPU and PICMI.

Please refer to the documentation for a deeper discussion.

Subpackages

Submodules

Package Contents

Classes

Species

PyPIConGPU species definition

InitManager

Helper to manage species translation to PIConGPU

class picongpu.pypicongpu.species.Species

Bases: picongpu.pypicongpu.rendering.RenderedObject

Inheritance diagram of picongpu.pypicongpu.species.Species

PyPIConGPU species definition

A “species” is a set of particles, which is defined by:

  • A set of species constants (mass, charge, etc.),

  • a set of species attributes (position, number of bound electrons), and

  • a set of operations which collectively initialize these attributes, where one attribute is initializated by exactly one operation.

  • (and a name)

Note that some of the species attributes or constants are considered mandatory. Each species constant or attribute may only be defined once.

constants

PIConGPU particle flags

attributes

PIConGPU particle attributes

name

name of the species

get_cxx_typename() str

get (standalone) C++ name for this species

check() None

sanity-check self, if ok pass silently

Ensure that:

  • species has valid name

  • constants have unique types

  • attributes have unique types

get_constant_by_type(needle_type: Type[picongpu.pypicongpu.species.constant.Constant]) picongpu.pypicongpu.species.constant.Constant

retrieve constant of given type, raise if not found

Searches through constants of this species and returns the constant of the given type if found. If no constant of this type is found, an error is raised.

Parameters:

needle_type – constant type to look for

Raises:

RuntimeError – on failure to find constant of given type

Returns:

constant of given type

has_constant_of_type(needle_type: Type[picongpu.pypicongpu.species.constant.Constant]) bool

lookup if constant of given type is present

Searches through constants of this species and returns true iff a constant of the given type is present.

Parameters:

needle_type – constant type to look for

Returns:

whether constant of needle_type exists

get_rendering_context() dict

get rendering context representation of this object

delegates work to _get_serialized and invokes checks performed by check_context_for_type(). :raise ValidationError: on schema violiation :raise RuntimeError: on schema not found :return: self as rendering context

static check_context_for_type(type_to_check: type, context: dict) None

check if the given context is valid for the given type

Raises on error, passes silently if okay.

Raises:
  • ValidationError – on schema violiation

  • RuntimeError – on schema not found

class picongpu.pypicongpu.species.InitManager

Bases: picongpu.pypicongpu.rendering.RenderedObject

Inheritance diagram of picongpu.pypicongpu.species.InitManager

Helper to manage species translation to PIConGPU

Collects all species to be initialized and the operations initializing them.

Invokes the methods of the Operation lifecycle (check, prebook, bake).

Workflow:

  1. Fill InitManager (from outside) with

    • Species and their constants (no attributes!)

    • Operations, fully initialized (all params set)

  2. invoke InitManager.bake(), which

    • checks the Species for conflicts (name…)

    • performs dependency checks, possibly reorders species

    • invokes the Operation lifecycle (check, prebook, bake)

    • sanity-checks the results

  3. retrieve rendering context

    • organizes operations into lists

Note: The InitManager manages a lifecycle, it does not perform deep checks

-> most errors have to be caught by delegated checks.

all_species

all species to be initialized

all_operations

all species to be initialized

bake() None

apply operations to species

get_typical_particle_per_cell() int

get typical number of macro particles per cell(ppc) of simulation

@returns middle value of ppc-range of all operations, minimum 1

get_rendering_context() dict

get rendering context representation of this object

delegates work to _get_serialized and invokes checks performed by check_context_for_type(). :raise ValidationError: on schema violiation :raise RuntimeError: on schema not found :return: self as rendering context

static check_context_for_type(type_to_check: type, context: dict) None

check if the given context is valid for the given type

Raises on error, passes silently if okay.

Raises:
  • ValidationError – on schema violiation

  • RuntimeError – on schema not found