aboutsummaryrefslogtreecommitdiff
path: root/Source/Diagnostics/FullDiagnostics.H
blob: 4bb3e27895af290be6cb9bcdafda5d8fb8afa5d2 (plain) (blame)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#ifndef WARPX_FULLDIAGNOSTICS_H_
#define WARPX_FULLDIAGNOSTICS_H_

#include "Diagnostics.H"
#include "Utils/Parser/IntervalsParser.H"

#include <string>

class
FullDiagnostics final : public Diagnostics
{
public:
    FullDiagnostics (int i, std::string name);
private:
    /** Read user-requested parameters for full diagnostics */
    void ReadParameters ();
    /** Determines timesteps at which full diagnostics are written to file */
    utils::parser::IntervalsParser m_intervals;
    /** Whether to plot raw (i.e., NOT cell-centered) fields */
    bool m_plot_raw_fields = false;
    /** Whether to plot guard cells of raw fields */
    bool m_plot_raw_fields_guards = false;
    /** Whether to dump the RZ modes */
    bool m_dump_rz_modes = false;
    /** Whether the field solver deposits current density, if not it will be done
     * before writing the diagnostic.
     */
    bool m_solver_deposits_current = true;
    /** Flush m_mf_output and particles to file for the i^th buffer */
    void Flush (int i_buffer) override;
    /** Flush raw data */
    void FlushRaw ();
    /** whether to compute and pack cell-centered data in m_mf_output
     * \param[in] step current time step
     * \param[in] force_flush if true, return true for any step since output must be
                  computed in this case
     * \return bool, whether to flush
     */
    bool DoComputeAndPack (int step, bool force_flush=false) override;
    /** whether to flush at this time step
     * \param[in] step current time step
     * \param[in] i_buffer index of a back-transformed snapshot
     * \param[in] force_flush if true, return true for any step
     * \return bool, whether to flush
     */
    bool DoDump (int step, int i_buffer, bool force_flush=false) override;
    /** Append varnames with names for all modes of a field
     * \param[in] field field name (includes component, e.g., Er)
     * \param[in] ncomp number of components (modes, real and imag)
     */
    void AddRZModesToOutputNames (const std::string& field, int ncomp);
    /** Define the cell-centered multifab m_mf_output depending on user-defined
      * lo and hi and coarsening ratio. This MultiFab may have a different BoxArray and
      * DistributionMap than field MultiFabs in the simulation.
      *
      * \param[in] i_buffer index of a back-transformed snapshot
      * \param[in] lev level on which source multifabs are defined
      */
    void InitializeBufferData ( int i_buffer, int lev, bool restart=false ) override;
    /** Initialize functors that store pointers to the RZ fields requested by the user.
     * \param[in] lev level on which the vector of unique_ptrs to field functors is initialized.
     */
    void InitializeFieldFunctorsRZopenPMD (int lev) override;
    /** Append m_all_field_functors[lev] with all modes of all components of E B and j
     * and add name to varnames.
     * \param[in] lev level on which source multifabs are defined.
     */
    void AddRZModesToDiags (int lev);
    /** Initialize functors that store pointers to the fields requested by the user.
      * \param[in] lev level on which the vector of unique_ptrs to field functors is initialized.
      */
    void InitializeFieldFunctors (int lev) override;
    void InitializeParticleBuffer () override;
    /** Prepare field data to be used for diagnostics */
    void PrepareFieldDataForOutput () override;
    /** Prepare particle data to be used for diagnostics. */
    void PrepareParticleDataForOutput() override {}
    /** Update the physical extent of the diagnostic domain for moving window and
     *  galilean shift simulations
     *
     * \param[in] step current time step
     */
    void MovingWindowAndGalileanDomainShift (int step) override;
    /** This function queries deprecated input parameters and abort
     *  the run if one of them is specified.
     */
    void BackwardCompatibility ();
};

#endif // WARPX_FULLDIAGNOSTICS_H_