WarpX
|
base class for diagnostics. Contains main routines to filter, compute and flush diagnostics. More...
#include <Diagnostics.H>
Public Member Functions | |
Diagnostics (int i, std::string name) | |
virtual | ~Diagnostics () |
Diagnostics (Diagnostics const &)=delete | |
Diagnostics & | operator= (Diagnostics const &)=delete |
Diagnostics (Diagnostics &&)=default | |
Diagnostics & | operator= (Diagnostics &&)=default |
void | ComputeAndPack () |
virtual void | Flush (int i_buffer, bool force_flush)=0 |
Flush particle and field buffers to file using the FlushFormat member variable. More... | |
void | InitData () |
void | InitDataBeforeRestart () |
void | InitDataAfterRestart () |
virtual void | InitializeFieldFunctors (int lev)=0 |
virtual void | InitializeFieldFunctorsRZopenPMD ([[maybe_unused]] int lev) |
virtual void | InitializeParticleFunctors () |
virtual bool | DoComputeAndPack (int step, bool force_flush=false)=0 |
virtual bool | DoDump (int step, int i_buffer, bool force_flush=false)=0 |
void | NewIteration () |
void | FilterComputePackFlush (int step, bool force_flush=false) |
bool | DoDumpLastTimestep () const |
int | getnumbuffers () const |
virtual amrex::Real | gettlab ([[maybe_unused]] int i_buffer) |
virtual void | settlab ([[maybe_unused]] int i_buffer, [[maybe_unused]] amrex::Real tlab) |
virtual int | get_buffer_k_index_hi ([[maybe_unused]] int i_buffer) |
virtual void | set_buffer_k_index_hi ([[maybe_unused]] int i_buffer, [[maybe_unused]] int kindex) |
virtual amrex::Real | get_snapshot_domain_lo ([[maybe_unused]] int i_buffer, [[maybe_unused]] int idim) |
virtual amrex::Real | get_snapshot_domain_hi ([[maybe_unused]] int i_buffer, [[maybe_unused]] int idim) |
void | setSnapshotDomainLo (int i_buffer, int idim, amrex::Real domain_lab_lo) |
void | setSnapshotDomainHi (int i_buffer, int idim, amrex::Real domain_lab_hi) |
virtual int | get_flush_counter ([[maybe_unused]] int i_buffer) |
virtual void | set_flush_counter ([[maybe_unused]] int i_buffer, [[maybe_unused]] int flush_counter) |
virtual int | get_last_valid_Zslice ([[maybe_unused]] int i_buffer) |
virtual void | set_last_valid_Zslice ([[maybe_unused]] int i_buffer, [[maybe_unused]] int last_valid_Zslice) |
virtual int | get_snapshot_full_flag ([[maybe_unused]] int i_buffer) |
virtual void | set_snapshot_full ([[maybe_unused]] int i_buffer, [[maybe_unused]] int snapshot_full) |
Protected Member Functions | |
bool | BaseReadParameters () |
void | InitBaseData () |
virtual void | InitializeBufferData (int i_buffer, int lev, bool restart=false)=0 |
virtual void | DerivedInitData () |
virtual void | InitializeParticleBuffer ()=0 |
virtual void | PrepareBufferData () |
virtual void | UpdateBufferData () |
virtual void | PrepareFieldDataForOutput () |
virtual void | PrepareParticleDataForOutput () |
virtual void | MovingWindowAndGalileanDomainShift (int step) |
base class for diagnostics. Contains main routines to filter, compute and flush diagnostics.
Each specific diagnostics derives from this class.
Diagnostics::Diagnostics | ( | int | i, |
std::string | name | ||
) |
Constructor
i | index of diagnostics in MultiDiagnostics::alldiags |
name | diagnostics name in the inputs file |
|
virtualdefault |
Virtual Destructor to handle clean destruction of derived classes
|
delete |
|
default |
|
protected |
Read Parameters of the base Diagnostics class
void Diagnostics::ComputeAndPack | ( | ) |
Pack (stack) all fields in the cell-centered output MultiFab m_mf_output.
Fields are computed (e.g., cell-centered or back-transformed) on-the-fly using a functor.
|
inlineprotectedvirtual |
Initialize member variables and arrays specific to the diagnostics in the derived classes.(FullDiagnostics, BTDiagnostics)
Reimplemented in BTDiagnostics.
|
pure virtual |
whether to compute and pack data in output buffers at this time step
[in] | step | current time step |
[in] | force_flush | if true, return true for any step |
Implemented in FullDiagnostics, BTDiagnostics, and BoundaryScrapingDiagnostics.
whether to flush at this time step
[in] | step | current time step |
[in] | i_buffer | index of the buffer data to be flushed. |
[in] | force_flush | if true, return true for any step |
Implemented in FullDiagnostics, BTDiagnostics, and BoundaryScrapingDiagnostics.
|
inline |
Whether the last timestep is always dumped
void Diagnostics::FilterComputePackFlush | ( | int | step, |
bool | force_flush = false |
||
) |
Perform necessary operations with user-defined diagnostic parameters to filter (coarsen, slice), compute (cell-center, back-transform), and flush the output data stored in buffers, m_mf_output.
[in] | step | current timestep |
[in] | force_flush | used to force-fully write data stored in buffers. |
|
pure virtual |
Flush particle and field buffers to file using the FlushFormat member variable.
This function should belong to class Diagnostics and not be virtual, as it flushes the particle buffers (name not found yet) and the field buffers (m_mf_output), both of which are members of Diagnostics. Yet, the implementation is left to derived classes for now because:
[in] | i_buffer | index of the buffer data to be flushed. |
[in] | force_flush | only used for BTD, whether to do a complete flush of the data (including metadata listing the total number of particles) even if the snapshot is incomplete |
Implemented in FullDiagnostics, BoundaryScrapingDiagnostics, and BTDiagnostics.
Returns k-index in big end of the buffer box currently being filled for the ith snapshot in BTD
[in] | i_buffer | index of the buffer |
Returns counter for the number of times buffer data for the ith snapshot has been flushed
[in] | i_buffer | index of the buffer |
Returns 0/1 if the last valid Zslice for the ith snapshot has been filled (1) or not(0)
[in] | i_buffer | index of the buffer |
|
inlinevirtual |
Returns hi-end of the lab-frame physical domain for the ith snapshot in BTD
[in] | i_buffer | index of the buffer |
[in] | idim | dimension along which the hi-end of the lab-frame physical domain is returned |
|
inlinevirtual |
Returns lo-end of the lab-frame physical domain for the ith snapshot in BTD
[in] | i_buffer | index of the buffer |
[in] | idim | dimension along which the lo-end of the lab-frame physical domain is returned |
Returns 0/1 if the snapshot is fully filled and BTD for that snapshot is complete(1) or not(0)
[in] | i_buffer | index of the buffer |
|
inline |
Returns the number of snapshots used in BTD. For Full-Diagnostics, the value is 1
|
inlinevirtual |
Time in lab-frame associated with the ith snapshot
[in] | i_buffer | index of the buffer |
|
protected |
Initialize member variables of the base Diagnostics class.
void Diagnostics::InitData | ( | ) |
Initialize pointers to main fields and allocate output multifab m_mf_output.
void Diagnostics::InitDataAfterRestart | ( | ) |
void Diagnostics::InitDataBeforeRestart | ( | ) |
|
protectedpure virtual |
Initialize m_mf_output vectors and data required to construct the buffers
[in] | i_buffer | index of buffer for which the output MultiFab is defined. |
[in] | lev | level on which the output MultiFab is defined |
Implemented in FullDiagnostics, BTDiagnostics, and BoundaryScrapingDiagnostics.
|
pure virtual |
Initialize functors that store pointers to the fields requested by the user.
Derived classes MUST implement this function, and it must allocate m_all_field_functors and fill it with ComputeDiagFunctor objects. The functions is called at initialization and when the domain is decomposed during the simulation to load-balance.
[in] | lev | level on which the vector of unique_ptrs to field functors is initialized. |
Implemented in FullDiagnostics, BTDiagnostics, and BoundaryScrapingDiagnostics.
|
inlinevirtual |
Initialize functors that store pointers to the fields requested by the user.
The function is called at initialization and when the domain is decomposed during the simulation to load-balance.
[in] | lev | level on which the vector of unique_ptrs to field functors is initialized. |
|
protectedpure virtual |
This function initialized particle buffers (not implemented in diagnostics, yet)
Implemented in FullDiagnostics, BTDiagnostics, and BoundaryScrapingDiagnostics.
|
inlinevirtual |
Initialize functors that store pointers to the species data requested by the user.
Reimplemented in BTDiagnostics.
|
inlineprotectedvirtual |
Update the physical extent of the diagnostic domain for moving window and galilean shift simulations
[in] | step | current time step |
Reimplemented in FullDiagnostics.
|
inline |
Start a new iteration, i.e., dump has not been done yet.
|
default |
|
delete |
|
inlineprotectedvirtual |
This function prepares buffer data as required for fields and particles. For back-transformed diagnostics, this function prepares the z coordinate in the boosted-frame and lab-frame.
Reimplemented in BTDiagnostics.
|
inlineprotectedvirtual |
Prepare data (either fill-boundary or cell-centered data for back-transform diagnostics) to be processed for diagnostics.
Reimplemented in FullDiagnostics, and BTDiagnostics.
|
inlineprotectedvirtual |
The Particle Geometry, BoxArray, and RealBox are set for the lab-frame output
Reimplemented in FullDiagnostics, and BTDiagnostics.
|
inlinevirtual |
Set k-index of the buffer in the moving window direction currently being filled for the ith snapshot
[in] | i_buffer | index of the buffer |
[in] | kindex | value used to set the k-index for the big end of the buffer box |
|
inlinevirtual |
Sets counter for the number of times buffer data for the ith snapshot has been flushed to parameter input in the function
[in] | i_buffer | index of the buffer |
[in] | flush_counter | value of the counter |
|
inlinevirtual |
Sets if the last valid Zslice for the ith snapshot has been filled (1) or not(0) with input parameter last_Valid_Zslice
[in] | i_buffer | index of the buffer |
[in] | last_valid_Zslice | value to set m_lastValidZSlice in BTD for the ith snapshot (i_buffer) |
|
inlinevirtual |
Sets the value for m_snapshot_full for the ith snapshot in BTD using parameter snapshot_full
[in] | i_buffer | index of the buffer |
[in] | snapshot_full | value to set m_snapshot_full in BTD for the ith snapshot (i_buffer) |
Sets hi-end of the lab-frame physical domain for the ith snapshot in BTD
[in] | i_buffer | index of the buffer |
[in] | idim | dimension along which the hi-end of the lab-frame physical domain is set |
[in] | domain_lab_hi | value of the hi-end of the lab-frame physical domain for the ith snapshot |
Sets lo-end of the lab-frame physical domain for the ith snapshot in BTD
[in] | i_buffer | index of the buffer |
[in] | idim | dimension along which the lo-end of the lab-frame physical domain is set |
[in] | domain_lab_lo | value of the lo-end of the lab-frame physical domain for the ith snapshot |
|
inlinevirtual |
Set time in lab-frame for the ith snapshot
[in] | i_buffer | index of the buffer |
[in] | tlab | value used to set the lab-frame time for the ith buffer |
|
inlineprotectedvirtual |
This function updates buffer data and computes the number of buffers filled in the output multifab as well as identifies if the last buffer has been filled as needed to close the output files.
Reimplemented in BTDiagnostics.
|
protected |
Vector of (pointers to) functors to compute output fields, per level, per component. This allows for simple operations (averaging to cell-center for standard EB fields) as well as more involved operations (back-transformed diagnostics, filtering, reconstructing cartesian fields in cylindrical).
|
protected |
Vector of pointers to functors to compute particle output per species
|
protected |
Names of all species in the simulation
|
protected |
Whether this iteration has already been dumped, to avoid writing data twice
|
protected |
Coarsening ratio such that, fields are averaged to the coarsened grid. The ratio should render the grid to be coarsenable (as defined by AMReX).
|
protected |
Index of diagnostics in MultiDiagnostics::alldiags
|
protected |
Name of diagnostics: runtime parameter given in the input file.
|
protected |
If true, a dump is performed at the last timestep regardless of the required dump timesteps
|
protected |
Minimum number of digits to iteration number in file name
|
protected |
Prefix for output directories
|
protected |
This class is responsible for flushing the data to file
|
protected |
format for output files, "plotfile" or "openpmd" or "sensei" or "ascent" The checkpoint format is applicable for FullDiagnostics only.
|
protected |
Geometry that defines the domain attributes corresponding to output multifab. Specifically, the user-defined physical co-ordinates for the diagnostics is used to construct the geometry information for each MultiFab at the respective levels. This geometry will be used to write out plotfile data using the WriteToFile() function
|
protected |
Higher corner of the diagnostics output, in physical coordinates
|
protected |
Lower corner of the diagnostics output, in physical coordinates
|
protected |
output multifab, where all fields are computed (cell-centered or back-transformed) and stacked. The first vector is for total number of snapshots. (=1 for FullDiagnostics) The second vector is loops over the total number of levels.
|
protected |
Number of output buffers. The value is set to 1 for all FullDiagnostics
|
protected |
The first vector is for total number of snapshots. (=1 for FullDiagnostics) The second vector handles output for 1 species
|
protected |
Names of species to write to output
|
protected |
Vector of particle buffer vectors for each snapshot
|
protected |
Whether to do averaging for each of the particle field diagnostics
|
protected |
Whether to use a filter function on particles before calculating particle field diagnostics
|
protected |
List of parser strings for pre-average filtering for the particle field diagnostics
|
protected |
Names of species for which to output particle field diagnostics
|
protected |
Species indices corresponding to elements of m_pfield_varnames
|
protected |
List of the parser strings for the particle field diagnostics
|
protected |
Names of particle field properties to output
|
protected |
Array of species indices that dump rho per species
|
protected |
Vector of user-defined physical region for diagnostics in lab-frame for each back-transformed snapshot
|
protected |
Vector of total number of particles in the buffer, per species, per snapshot. The first vector is for total number of snapshots and second vector loops over the total number of species selected for diagnostics.
|
protected |
Names of each component requested by the user. The list is appended with the average particle fields, if used. In cylindrical geometry, this list is also appended with automatically-constructed names for all modes of all fields.
|
protected |
Names of plotfile fields requested by the user
|
protected |
number of levels to output
|
protected |
Number of levels to be output
|
protected |
max_level to allocate output multifab and vector of field functors.