Skip to content

Commit e6c1eb5

Browse files
authored
Diagnostics: Fix Position Selection (#4914)
* Diagnostics: Warn w/o Positions If a user specifies `<diag_name>.<species_name>.variables` without including particle position arguments we now warn. * openPMD: Skip 0-positions for deselected comps * Clang-Tidy: Braces * Update Examples * RZ: x,y,z * Fix: openPMD Low-D position/positionOffset Continue to write defaults for coarse and fine position of omitted dimensions to zero.
1 parent fee6c4e commit e6c1eb5

File tree

21 files changed

+169
-136
lines changed

21 files changed

+169
-136
lines changed

Docs/source/usage/parameters.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -2689,10 +2689,11 @@ In-situ capabilities can be used by turning on Sensei or Ascent (provided they a
26892689

26902690
* ``<diag_name>.<species_name>.variables`` (list of `strings` separated by spaces, optional)
26912691
List of particle quantities to write to output.
2692-
Choices are ``w`` for the particle weight and ``ux`` ``uy`` ``uz`` for the particle momenta.
2692+
Choices are ``x``, ``y``, ``z`` for the particle positions (3D and RZ), ``x`` & ``z`` in 2D, ``z`` in 1D,
2693+
``w`` for the particle weight and ``ux``, ``uy``, ``uz`` for the particle momenta.
26932694
When using the lab-frame electrostatic solver, ``phi`` (electrostatic potential, on the macroparticles) is also available.
26942695
By default, all particle quantities (except ``phi``) are written.
2695-
If ``<diag_name>.<species_name>.variables = none``, no particle data are written, except for particle positions, which are always included.
2696+
If ``<diag_name>.<species_name>.variables = none``, no particle data are written.
26962697

26972698
* ``<diag_name>.<species_name>.random_fraction`` (`float`) optional
26982699
If provided ``<diag_name>.<species_name>.random_fraction = a``, only `a` fraction of the particle data of this species will be dumped randomly in diag ``<diag_name>``, i.e. if `rand() < a`, this particle will be dumped, where `rand()` denotes a random number generator.

Examples/Physics_applications/laser_acceleration/inputs_rz

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,5 @@ diagnostics.diags_names = diag1
8989
diag1.intervals = 10
9090
diag1.diag_type = Full
9191
diag1.fields_to_plot = Er Et Ez Br Bt Bz jr jt jz rho
92-
diag1.electrons.variables = w ux uy uz orig_x orig_z
93-
diag1.beam.variables = w ux uy uz
92+
diag1.electrons.variables = x y z w ux uy uz orig_x orig_z
93+
diag1.beam.variables = x y z w ux uy uz

Examples/Physics_applications/uniform_plasma/inputs_3d

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ electrons.uz_th = 0.01 # uth the std of the (unitless) momentum
4545
diagnostics.diags_names = diag1 chk
4646
diag1.intervals = 4
4747
diag1.diag_type = Full
48-
diag1.electrons.variables = ux uy uz w
48+
diag1.electrons.variables = x y z ux uy uz w
4949
diag1.fields_to_plot = Bx By Bz Ex Ey Ez jx jy jz rho
5050

5151
chk.intervals = 6

Examples/Tests/Implicit/inputs_1d

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ diagnostics.diags_names = diag1
7171
diag1.intervals = 100
7272
diag1.diag_type = Full
7373
diag1.fields_to_plot = Ex Ey Ez Bx By Bz jx jy jz rho divE
74-
diag1.electrons.variables = w ux uy uz
75-
diag1.protons.variables = w ux uy uz
74+
diag1.electrons.variables = z w ux uy uz
75+
diag1.protons.variables = z w ux uy uz
7676

7777
warpx.reduced_diags_names = particle_energy field_energy
7878
particle_energy.type = ParticleEnergy

Examples/Tests/Implicit/inputs_1d_semiimplicit

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ diagnostics.diags_names = diag1
7171
diag1.intervals = 100
7272
diag1.diag_type = Full
7373
diag1.fields_to_plot = Ex Ey Ez Bx By Bz jx jy jz rho divE
74-
diag1.electrons.variables = w ux uy uz
75-
diag1.protons.variables = w ux uy uz
74+
diag1.electrons.variables = z w ux uy uz
75+
diag1.protons.variables = z w ux uy uz
7676

7777
warpx.reduced_diags_names = particle_energy field_energy
7878
particle_energy.type = ParticleEnergy

Examples/Tests/Implicit/inputs_vandb_2d

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ diagnostics.diags_names = diag1
8282
diag1.intervals = 20
8383
diag1.diag_type = Full
8484
diag1.fields_to_plot = Ex Ey Ez Bx By Bz jx jy jz rho divE
85-
diag1.electrons.variables = w ux uy uz
86-
diag1.protons.variables = w ux uy uz
85+
diag1.electrons.variables = x z w ux uy uz
86+
diag1.protons.variables = x z w ux uy uz
8787

8888
warpx.reduced_diags_names = particle_energy field_energy
8989
particle_energy.type = ParticleEnergy

Examples/Tests/electrostatic_sphere/inputs_rz

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ diag1.fields_to_plot = Er Et Ez rho
3939
diag2.intervals = 30
4040
diag2.diag_type = Full
4141
diag2.fields_to_plot = none
42-
diag2.electron.variables = ux uy uz w phi
42+
diag2.electron.variables = x y z ux uy uz w phi
4343
diag2.format = openpmd

Examples/Tests/langmuir/inputs_3d

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,5 @@ diagnostics.diags_names = diag1
9393
diag1.intervals = max_step
9494
diag1.diag_type = Full
9595
diag1.fields_to_plot = Ex Ey Ez Bx By Bz jx jy jz part_per_cell rho
96-
diag1.electrons.variables = w ux
97-
diag1.positrons.variables = uz
96+
diag1.electrons.variables = x y z w ux
97+
diag1.positrons.variables = x y z uz

Examples/Tests/photon_pusher/inputs_3d

+16-16
Original file line numberDiff line numberDiff line change
@@ -140,19 +140,19 @@ p_dn_10.single_particle_weight = 1.0
140140
diagnostics.diags_names = diag1
141141
diag1.intervals = 50
142142
diag1.diag_type = Full
143-
diag1.p_xp_1.variables = ux uy uz
144-
diag1.p_xn_1.variables = ux uy uz
145-
diag1.p_yp_1.variables = ux uy uz
146-
diag1.p_yn_1.variables = ux uy uz
147-
diag1.p_zp_1.variables = ux uy uz
148-
diag1.p_zn_1.variables = ux uy uz
149-
diag1.p_dp_1.variables = ux uy uz
150-
diag1.p_dn_1.variables = ux uy uz
151-
diag1.p_xp_10.variables = ux uy uz
152-
diag1.p_xn_10.variables = ux uy uz
153-
diag1.p_yp_10.variables = ux uy uz
154-
diag1.p_yn_10.variables = ux uy uz
155-
diag1.p_zp_10.variables = ux uy uz
156-
diag1.p_zn_10.variables = ux uy uz
157-
diag1.p_dp_10.variables = ux uy uz
158-
diag1.p_dn_10.variables = ux uy uz
143+
diag1.p_xp_1.variables = x y z ux uy uz
144+
diag1.p_xn_1.variables = x y z ux uy uz
145+
diag1.p_yp_1.variables = x y z ux uy uz
146+
diag1.p_yn_1.variables = x y z ux uy uz
147+
diag1.p_zp_1.variables = x y z ux uy uz
148+
diag1.p_zn_1.variables = x y z ux uy uz
149+
diag1.p_dp_1.variables = x y z ux uy uz
150+
diag1.p_dn_1.variables = x y z ux uy uz
151+
diag1.p_xp_10.variables = x y z ux uy uz
152+
diag1.p_xn_10.variables = x y z ux uy uz
153+
diag1.p_yp_10.variables = x y z ux uy uz
154+
diag1.p_yn_10.variables = x y z ux uy uz
155+
diag1.p_zp_10.variables = x y z ux uy uz
156+
diag1.p_zn_10.variables = x y z ux uy uz
157+
diag1.p_dp_10.variables = x y z ux uy uz
158+
diag1.p_dn_10.variables = x y z ux uy uz

Examples/Tests/plasma_lens/inputs_3d

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ particles.repeated_plasma_lens_strengths_B = 0.0 0.0 0.0 0.0
4848
diagnostics.diags_names = diag1
4949
diag1.intervals = 84
5050
diag1.diag_type = Full
51-
diag1.electrons.variables = ux uy uz
51+
diag1.electrons.variables = x y z ux uy uz

Examples/Tests/plasma_lens/inputs_boosted_3d

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ particles.repeated_plasma_lens_strengths_B = 0.0 0.0 0.0 0.0
5050
diagnostics.diags_names = diag1
5151
diag1.intervals = 84
5252
diag1.diag_type = Full
53-
diag1.electrons.variables = ux uy uz
53+
diag1.electrons.variables = x y z ux uy uz

Examples/Tests/plasma_lens/inputs_lattice_3d

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,4 @@ plasmalens4.dEdx = 200000.
7070
diagnostics.diags_names = diag1
7171
diag1.intervals = 84
7272
diag1.diag_type = Full
73-
diag1.electrons.variables = ux uy uz
73+
diag1.electrons.variables = x y z ux uy uz

Examples/Tests/plasma_lens/inputs_short_3d

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ particles.repeated_plasma_lens_strengths_B = 0.0 0.0 0.0 0.0
5252
diagnostics.diags_names = diag1
5353
diag1.intervals = 1 #84
5454
diag1.diag_type = Full
55-
diag1.electrons.variables = ux uy uz
55+
diag1.electrons.variables = x y z ux uy uz

Examples/Tests/qed/breit_wheeler/inputs_2d

+14-14
Original file line numberDiff line numberDiff line change
@@ -201,19 +201,19 @@ diagnostics.diags_names = diag1
201201
diag1.intervals = 2
202202
diag1.diag_type = Full
203203
diag1.fields_to_plot = Ex
204-
diag1.p1.variables = ux uy uz w opticalDepthBW
205-
diag1.p2.variables = ux uy uz w opticalDepthBW
206-
diag1.p3.variables = ux uy uz w opticalDepthBW
207-
diag1.p4.variables = ux uy uz w opticalDepthBW
208-
209-
diag1.ele1.variables = ux uy uz w opticalDepthQSR
210-
diag1.ele2.variables = ux uy uz w opticalDepthQSR
211-
diag1.ele3.variables = ux uy uz w opticalDepthQSR
212-
diag1.ele4.variables = ux uy uz w opticalDepthQSR
213-
214-
diag1.pos1.variables = ux uy uz w opticalDepthQSR
215-
diag1.pos2.variables = ux uy uz w opticalDepthQSR
216-
diag1.pos3.variables = ux uy uz w opticalDepthQSR
217-
diag1.pos4.variables = ux uy uz w opticalDepthQSR
204+
diag1.p1.variables = x z ux uy uz w opticalDepthBW
205+
diag1.p2.variables = x z ux uy uz w opticalDepthBW
206+
diag1.p3.variables = x z ux uy uz w opticalDepthBW
207+
diag1.p4.variables = x z ux uy uz w opticalDepthBW
208+
209+
diag1.ele1.variables = x z ux uy uz w opticalDepthQSR
210+
diag1.ele2.variables = x z ux uy uz w opticalDepthQSR
211+
diag1.ele3.variables = x z ux uy uz w opticalDepthQSR
212+
diag1.ele4.variables = x z ux uy uz w opticalDepthQSR
213+
214+
diag1.pos1.variables = x z ux uy uz w opticalDepthQSR
215+
diag1.pos2.variables = x z ux uy uz w opticalDepthQSR
216+
diag1.pos3.variables = x z ux uy uz w opticalDepthQSR
217+
diag1.pos4.variables = x z ux uy uz w opticalDepthQSR
218218

219219
diag1.format = plotfile

Examples/Tests/qed/breit_wheeler/inputs_3d

+14-14
Original file line numberDiff line numberDiff line change
@@ -201,19 +201,19 @@ diagnostics.diags_names = diag1
201201
diag1.intervals = 2
202202
diag1.diag_type = Full
203203
diag1.fields_to_plot = Ex
204-
diag1.p1.variables = ux uy uz w opticalDepthBW
205-
diag1.p2.variables = ux uy uz w opticalDepthBW
206-
diag1.p3.variables = ux uy uz w opticalDepthBW
207-
diag1.p4.variables = ux uy uz w opticalDepthBW
208-
209-
diag1.ele1.variables = ux uy uz w opticalDepthQSR
210-
diag1.ele2.variables = ux uy uz w opticalDepthQSR
211-
diag1.ele3.variables = ux uy uz w opticalDepthQSR
212-
diag1.ele4.variables = ux uy uz w opticalDepthQSR
213-
214-
diag1.pos1.variables = ux uy uz w opticalDepthQSR
215-
diag1.pos2.variables = ux uy uz w opticalDepthQSR
216-
diag1.pos3.variables = ux uy uz w opticalDepthQSR
217-
diag1.pos4.variables = ux uy uz w opticalDepthQSR
204+
diag1.p1.variables = x y z ux uy uz w opticalDepthBW
205+
diag1.p2.variables = x y z ux uy uz w opticalDepthBW
206+
diag1.p3.variables = x y z ux uy uz w opticalDepthBW
207+
diag1.p4.variables = x y z ux uy uz w opticalDepthBW
208+
209+
diag1.ele1.variables = x y z ux uy uz w opticalDepthQSR
210+
diag1.ele2.variables = x y z ux uy uz w opticalDepthQSR
211+
diag1.ele3.variables = x y z ux uy uz w opticalDepthQSR
212+
diag1.ele4.variables = x y z ux uy uz w opticalDepthQSR
213+
214+
diag1.pos1.variables = x y z ux uy uz w opticalDepthQSR
215+
diag1.pos2.variables = x y z ux uy uz w opticalDepthQSR
216+
diag1.pos3.variables = x y z ux uy uz w opticalDepthQSR
217+
diag1.pos4.variables = x y z ux uy uz w opticalDepthQSR
218218

219219
diag1.format = plotfile

Examples/Tests/qed/quantum_synchrotron/inputs_2d

+9-9
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,12 @@ diagnostics.diags_names = diag1
178178
diag1.intervals = 2
179179
diag1.diag_type = Full
180180
diag1.fields_to_plot = Ex
181-
diag1.p1.variables = ux uy uz w opticalDepthQSR
182-
diag1.p2.variables = ux uy uz w opticalDepthQSR
183-
diag1.p3.variables = ux uy uz w opticalDepthQSR
184-
diag1.p4.variables = ux uy uz w opticalDepthQSR
185-
186-
diag1.qsp_1.variables = ux uy uz w opticalDepthBW
187-
diag1.qsp_2.variables = ux uy uz w opticalDepthBW
188-
diag1.qsp_3.variables = ux uy uz w opticalDepthBW
189-
diag1.qsp_4.variables = ux uy uz w opticalDepthBW
181+
diag1.p1.variables = x z ux uy uz w opticalDepthQSR
182+
diag1.p2.variables = x z ux uy uz w opticalDepthQSR
183+
diag1.p3.variables = x z ux uy uz w opticalDepthQSR
184+
diag1.p4.variables = x z ux uy uz w opticalDepthQSR
185+
186+
diag1.qsp_1.variables = x z ux uy uz w opticalDepthBW
187+
diag1.qsp_2.variables = x z ux uy uz w opticalDepthBW
188+
diag1.qsp_3.variables = x z ux uy uz w opticalDepthBW
189+
diag1.qsp_4.variables = x z ux uy uz w opticalDepthBW

Examples/Tests/qed/quantum_synchrotron/inputs_3d

+9-9
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,12 @@ diagnostics.diags_names = diag1
178178
diag1.intervals = 2
179179
diag1.diag_type = Full
180180
diag1.fields_to_plot = Ex
181-
diag1.p1.variables = ux uy uz w opticalDepthQSR
182-
diag1.p2.variables = ux uy uz w opticalDepthQSR
183-
diag1.p3.variables = ux uy uz w opticalDepthQSR
184-
diag1.p4.variables = ux uy uz w opticalDepthQSR
185-
186-
diag1.qsp_1.variables = ux uy uz w opticalDepthBW
187-
diag1.qsp_2.variables = ux uy uz w opticalDepthBW
188-
diag1.qsp_3.variables = ux uy uz w opticalDepthBW
189-
diag1.qsp_4.variables = ux uy uz w opticalDepthBW
181+
diag1.p1.variables = x y z ux uy uz w opticalDepthQSR
182+
diag1.p2.variables = x y z ux uy uz w opticalDepthQSR
183+
diag1.p3.variables = x y z ux uy uz w opticalDepthQSR
184+
diag1.p4.variables = x y z ux uy uz w opticalDepthQSR
185+
186+
diag1.qsp_1.variables = x y z ux uy uz w opticalDepthBW
187+
diag1.qsp_2.variables = x y z ux uy uz w opticalDepthBW
188+
diag1.qsp_3.variables = x y z ux uy uz w opticalDepthBW
189+
diag1.qsp_4.variables = x y z ux uy uz w opticalDepthBW

0 commit comments

Comments
 (0)