Skip to content

Commit a693f82

Browse files
committed
udpate domain info docs
1 parent 8d018f7 commit a693f82

File tree

1 file changed

+82
-5
lines changed

1 file changed

+82
-5
lines changed

docs/source/usage/plugins/binningPlugin.rst

Lines changed: 82 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,20 +102,97 @@ For two fields with one extra data parameter:
102102
Fields and extra data may be tuples with multiple elements which are unpacked and passed to the user-defined functors. Therefore, it is the responsibility of the user to ensure that their functors have an appropriate number of arguments to match the provided tuples.
103103

104104
Domain Info
105-
"""""""""""
106-
Enables the user to find the location of the particle or field in the simulation domain. Contains
105+
-----------
106+
The binning plugin passes the domain info object to functors as a parameter to give the user access to some useful PIConGPU quantities inside the functor.
107+
Importantly, it enables the user to find the location of the particle or field in the simulation domain.
107108

108-
For particle binning, the ``DomainInfo`` class contains:
109+
The ``DomainInfo`` class contains:
109110

110111
.. doxygenclass:: picongpu::plugins::binning::DomainInfoBase
111112
:members:
112113

113114
The global and local offsets can be understood by looking at the `PIConGPU domain definitions <https://github.com/ComputationalRadiationPhysics/picongpu/wiki/PIConGPU-domain-definitions>`_.
114115

115-
For particle binning, the particle position is obtained at cell precision by default. To get sub-cell precision or SI units, use optional template parameters with ``getParticlePosition<DomainOrigin, PositionPrecision, PositionUnits>``.
116+
Particle binning
117+
^^^^^^^^^^^^^^^^
118+
119+
For particle binning, we can use the ``getParticlePosition`` function.
120+
121+
.. code-block:: cpp
122+
123+
getParticlePosition<DomainOrigin, PositionPrecision, PositionUnits>()
124+
125+
The particle position has the default precision set to cell precision, and the position is returned in cell units by default.
126+
127+
To request a different origin, precision, or unit system, use the template parameters as described below.
128+
129+
Field binning
130+
^^^^^^^^^^^^^
131+
132+
For field binning, ``DomainInfo`` additionally stores the ``localCellIndex`` within the supercell we can use the ``getCellIndex`` function.
133+
134+
.. code-block:: cpp
135+
136+
getCellIndex<DomainOrigin, PositionUnits>()
137+
138+
This returns the current cell index being binned relative to the selected origin.
139+
140+
To obtain the exact position of a field inside the cell, relative to the cell index, use the ``FieldPosition`` trait.
141+
142+
Domain origin
143+
^^^^^^^^^^^^^
144+
145+
The reference origin for returned positions is selected with ``DomainOrigin``:
146+
147+
The available origins are:
148+
149+
- ``TOTAL``
150+
Absolute origin of the simulation. This includes regions that are no longer part of the current global volume, for example because they have moved out of the sliding window.
116151

117-
For field binning, the field ``DomainInfo`` additionally holds the localCellIndex in the supercell and has a method to ``getCellIndex<DomainOrigin, PositionUnits>`` to get the current cell index being binned relative to an origin (global, total, local). To get the exact position of the fields inside the cell, relative to the cell index, use the ``FieldPosition`` trait.
152+
- ``GLOBAL``
153+
Origin of the current sliding window, i.e. the currently simulated domain across all GPUs, excluding guard cells.
154+
155+
- ``LOCAL``
156+
Origin of the local domain on the current GPU, excluding guard cells.
157+
158+
- ``MOVING_WINDOW``
159+
Origin relative to the sliding window origin. This origin starts moving only once the sliding window moves and is not discretized to the cell grid.
160+
161+
- ``LOCAL_WITH_GUARDS``
162+
Origin of the local domain on the current GPU, including guard cells. This setting is in particular used to access field data for the current cell with `getCellIndex`.
163+
164+
Position precision
165+
^^^^^^^^^^^^^^^^^^
166+
167+
For particle positions, the precision is selected with ``PositionPrecision``.
168+
169+
The available precisions are:
170+
171+
- ``CELL``
172+
Returns the particle position at cell precision, i.e. as a cell index.
173+
174+
- ``SUB_CELL``
175+
Returns the particle position with sub-cell precision, i.e. as the cell index plus the particle position inside the cell in the range ``[0,1)``. The result is therefore a floating-point position in units of cells.
176+
177+
Position units
178+
^^^^^^^^^^^^^^
179+
180+
The output units for positions are selected with ``PositionUnits``.
181+
182+
The available units are:
183+
184+
- ``SI``
185+
Returns the position in SI units.
186+
187+
- ``PIC``
188+
Returns the position in PIC units.
189+
190+
- ``CELL``
191+
Returns the position in units of cells. The result is integral for ``PositionPrecision::CELL`` and floating point for ``PositionPrecision::SUB_CELL``.
192+
193+
.. note::
118194

195+
Using positions in SI/PIC units introduces floating point numerical errors and may be especially problematic when using the ``TOTAL`` origin with moving window, because floating-point precision decreases as the distance from the origin increases.
119196

120197
Dimensionality and units
121198
^^^^^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)