ARTEMIS
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 
22 using namespace amrex::literals;
23 
27 enum struct DetectorGeometry
28 {
29  Point = 0,
30  Line,
31  Plane
32 };
33 
38 class FieldProbe : public ReducedDiags
39 {
40 public:
41 
46  FieldProbe (std::string rd_name);
47 
51  void InitData () override final;
52 
55  void LoadBalance () override final;
56 
62  void ComputeDiags (int step) override final;
63 
64  /*
65  * Define constants used throughout FieldProbe
66  */
67 
69  static constexpr int noutputs = FieldProbePIdx::nattribs + 3 + 1;
70 
71 private:
72  amrex::Real x_probe = 0._rt;
73  amrex::Real y_probe = 0._rt;
74  amrex::Real x1_probe = 0._rt;
75  amrex::Real y1_probe = 0._rt;
76  amrex::Real target_normal_x = 0._rt;
77  amrex::Real target_normal_y = 1._rt;
78  amrex::Real target_normal_z = 0._rt;
79  amrex::Real target_up_x = 0._rt;
80  amrex::Real target_up_y = 0._rt;
81  amrex::Real target_up_z = 1._rt;
82  amrex::Real z_probe, z1_probe;
83  amrex::Real detector_radius;
84 
86  long m_valid_particles {0};
87 
89  int m_last_compute_step = 0;
90 
93 
95  int m_resolution = 0;
96 
99 
102 
105 
107  bool m_field_probe_integrate = false;
108 
110  int interp_order = 1;
111 
113  bool raw_fields = false;
114 
116  bool do_moving_window_FP = false;
117 
121  virtual void WriteToFile (int step) const override;
122 
125  bool ProbeInDomain () const;
126 
130  void normalize(amrex::Real &AMREX_RESTRICT x, amrex::Real &AMREX_RESTRICT y,
131  amrex::Real &AMREX_RESTRICT z){
132  amrex::Real mag = std::sqrt(x*x + y*y + z*z);
133  x /= mag;
134  y /= mag;
135  z /= mag;
136  }
137 };
138 
139 #endif // WARPX_DIAGNOSTICS_REDUCEDDIAGS_FIELDPROBE_H_
DetectorGeometry
Definition: FieldProbe.H:28
Definition: FieldProbe.H:39
amrex::Vector< amrex::Real > m_data_out
Empty array to be used by IOProcessor node to store and output data.
Definition: FieldProbe.H:101
FieldProbeParticleContainer m_probe
this is the particle container in which probe particles are stored
Definition: FieldProbe.H:104
void normalize(amrex::Real &AMREX_RESTRICT x, amrex::Real &AMREX_RESTRICT y, amrex::Real &AMREX_RESTRICT z)
Definition: FieldProbe.H:130
amrex::Real z1_probe
Definition: FieldProbe.H:82
amrex::Vector< amrex::Real > m_data
Empty vector for to which data is pushed.
Definition: FieldProbe.H:98
amrex::Real detector_radius
Definition: FieldProbe.H:83
Definition: FieldProbeParticleContainer.H:41
Definition: ReducedDiags.H:24
def y
Definition: Excitation_Flag_Generator.py:76
def z
Definition: Excitation_Flag_Generator.py:77
@ nattribs
Definition: FieldProbeParticleContainer.H:30