forked from ComputationalRadiationPhysics/picongpu
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphase_space.py
More file actions
66 lines (49 loc) · 1.92 KB
/
phase_space.py
File metadata and controls
66 lines (49 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
"""
This file is part of PIConGPU.
Copyright 2021-2025 PIConGPU contributors
Authors: Masoud Afshari, Julian Lenz
License: GPLv3+
"""
from typing import Literal
from pydantic import BaseModel
from picongpu.picmi.copy_attributes import default_converts_to
from ...pypicongpu.output.phase_space import PhaseSpace as PyPIConGPUPhaseSpace
from ..species import Species as Species
from .timestepspec import TimeStepSpec
@default_converts_to(PyPIConGPUPhaseSpace)
class PhaseSpace(BaseModel):
"""
Specifies the parameters for the output of Phase Space of species such as electrons.
This plugin extracts phase-space data from the simulation, allowing
for detailed analysis of particle distributions in position-momentum space.
Parameters
----------
species: string
Name of the particle species to track (e.g., "electron", "proton").
period: TimeStepSpec
Specify on which time steps the plugin should run.
Unit: steps (simulation time steps).
spatial_coordinate: string
Spatial coordinate used in phase space (e.g., 'x', 'y', 'z').
momentum: string
Momentum coordinate used in phase space (e.g., 'px', 'py', 'pz').
min_momentum: float
Minimum value for the phase-space coordinate range.
Unit: kg*m/s (momentum in SI units).
max_momentum: float
Maximum value for the phase-space coordinate range.
Unit: kg*m/s (momentum in SI units).
name: string, optional
Optional name for the phase-space plugin.
"""
species: Species
period: TimeStepSpec
spatial_coordinate: Literal["x", "y", "z"]
momentum_coordinate: Literal["px", "py", "pz"]
min_momentum: float
max_momentum: float
def check(self, *args, **kwargs):
if self.min_momentum >= self.max_momentum:
raise ValueError("min_momentum must be less than max_momentum")
class Config:
arbitrary_types_allowed = True