WarpX
FieldProbe.H
Go to the documentation of this file.
1 /* Copyright 2021 Lorenzo Giacomel, Neil Zaim, Yinjian Zhao
2  * Elisa Rheaume, Axel Huebl
3  *
4  * This file is part of WarpX.
5  *
6  * License: BSD-3-Clause-LBNL
7  */
8 
9 #ifndef WARPX_DIAGNOSTICS_REDUCEDDIAGS_FIELDPROBE_H_
10 #define WARPX_DIAGNOSTICS_REDUCEDDIAGS_FIELDPROBE_H_
11 
12 #include "ReducedDiags.H"
14 
15 #include <AMReX.H>
16 #include <AMReX_Vector.H>
17 
18 #include <unordered_map>
19 #include <string>
20 #include <vector>
21 
25 enum struct DetectorGeometry
26 {
27  Point = 0,
28  Line,
29  Plane
30 };
31 
36 class FieldProbe : public ReducedDiags
37 {
38 public:
39 
44  FieldProbe (const std::string& rd_name);
45 
49  void InitData () final;
50 
53  void LoadBalance () final;
54 
60  void ComputeDiags (int step) final;
61 
62  /*
63  * Define constants used throughout FieldProbe
64  */
65 
67  static const int noutputs = 11;
68 
69 private:
70  amrex::Real x_probe = 0.;
71  amrex::Real y_probe = 0.;
72  amrex::Real x1_probe = 0.;
73  amrex::Real y1_probe = 0.;
74  amrex::Real target_normal_x = 0.;
75  amrex::Real target_normal_y = 1.;
76  amrex::Real target_normal_z = 0.;
77  amrex::Real target_up_x = 0.;
78  amrex::Real target_up_y = 0.;
79  amrex::Real target_up_z = 1.;
80  amrex::Real z_probe, z1_probe;
81  amrex::Real detector_radius;
82 
85 
88 
91 
93  int m_resolution = 0;
94 
97 
100 
103 
106 
108  int interp_order = 1;
109 
111  bool do_moving_window_FP = false;
112 
116  void WriteToFile (int step) const override;
117 
120  bool ProbeInDomain () const;
121 
125  void normalize(amrex::Real &AMREX_RESTRICT x, amrex::Real &AMREX_RESTRICT y,
126  amrex::Real &AMREX_RESTRICT z){
127  const amrex::Real mag = std::sqrt(x*x + y*y + z*z);
128  x /= mag;
129  y /= mag;
130  z /= mag;
131  }
132 };
133 
134 #endif // WARPX_DIAGNOSTICS_REDUCEDDIAGS_FIELDPROBE_H_
DetectorGeometry
Definition: FieldProbe.H:26
Definition: FieldProbe.H:37
int interp_order
particle shape used for field gather
Definition: FieldProbe.H:108
amrex::Vector< amrex::Real > m_data_out
Empty array to be used by IOProcessor node to store and output data.
Definition: FieldProbe.H:99
amrex::Real target_up_z
Definition: FieldProbe.H:79
bool ProbeInDomain() const
Definition: FieldProbe.cpp:339
void InitData() final
Definition: FieldProbe.cpp:231
bool m_field_probe_integrate
if true, integrate values over time instead of probing instantaneous values
Definition: FieldProbe.H:105
static const int noutputs
noutputs is 11 for particle id + (x, y, z, Ex, Ey, Ez, Bx, By, Bz, S)
Definition: FieldProbe.H:67
amrex::Real y1_probe
Definition: FieldProbe.H:73
FieldProbeParticleContainer m_probe
this is the particle container in which probe particles are stored
Definition: FieldProbe.H:102
amrex::Real target_up_y
Definition: FieldProbe.H:78
amrex::Real target_up_x
Definition: FieldProbe.H:77
int m_last_compute_step
remember the last time
Definition: FieldProbe.H:87
amrex::Real target_normal_y
Definition: FieldProbe.H:75
long m_valid_particles
counts number of particles for all MPI ranks
Definition: FieldProbe.H:84
FieldProbe(const std::string &rd_name)
Definition: FieldProbe.cpp:52
amrex::Real target_normal_x
Definition: FieldProbe.H:74
void normalize(amrex::Real &AMREX_RESTRICT x, amrex::Real &AMREX_RESTRICT y, amrex::Real &AMREX_RESTRICT z)
Definition: FieldProbe.H:125
amrex::Real z1_probe
Definition: FieldProbe.H:80
void ComputeDiags(int step) final
Definition: FieldProbe.cpp:366
bool do_moving_window_FP
Judges whether to follow a moving window.
Definition: FieldProbe.H:111
void WriteToFile(int step) const override
Definition: FieldProbe.cpp:631
amrex::Vector< amrex::Real > m_data
Empty vector for to which data is pushed.
Definition: FieldProbe.H:96
amrex::Real x1_probe
Definition: FieldProbe.H:72
amrex::Real z_probe
Definition: FieldProbe.H:80
amrex::Real detector_radius
Definition: FieldProbe.H:81
int m_resolution
determines number of particles places for non-point geometries
Definition: FieldProbe.H:93
DetectorGeometry m_probe_geometry
determines geometry of detector point distribution
Definition: FieldProbe.H:90
amrex::Real x_probe
Definition: FieldProbe.H:70
amrex::Real target_normal_z
Definition: FieldProbe.H:76
void LoadBalance() final
Definition: FieldProbe.cpp:334
amrex::Real y_probe
Definition: FieldProbe.H:71
Definition: FieldProbeParticleContainer.H:51
Definition: ReducedDiags.H:24