WarpX
Public Member Functions | Private Member Functions | Private Attributes | List of all members
BTDiagnostics Class Referencefinal

#include <BTDiagnostics.H>

Inheritance diagram for BTDiagnostics:
Diagnostics

Public Member Functions

 BTDiagnostics (int i, std::string name)
 
- Public Member Functions inherited from Diagnostics
 Diagnostics (int i, std::string name)
 
virtual ~Diagnostics ()
 
void ComputeAndPack ()
 
void InitData ()
 
void NewIteration ()
 
void FilterComputePackFlush (int step, bool force_flush=false)
 

Private Member Functions

void ReadParameters ()
 
void Flush (int i_buffer) override
 Flush m_mf_output and particles to file. Currently, a temporary customized output format for the buffer data is implemented and called in this function. After implementing OpenPMD and plotfile formats, this function can be defined and implemented in Diagnostics.H, such that, the function call to flush out buffer data for FullDiagnostics and BTDiagnostics is the same. More...
 
bool DoDump (int step, int i_buffer, bool force_flush=false) override
 
bool DoComputeAndPack (int step, bool force_flush=false) override
 
void DerivedInitData () override
 
void InitializeFieldFunctors (int lev) override
 
void InitializeParticleBuffer () override
 
void PrepareFieldDataForOutput () override
 
bool GetZSliceInDomainFlag (const int i_buffer, const int lev)
 
void InitializeFieldBufferData (int i_buffer, int lev) override
 
void TMP_writeMetaData ()
 
void TMP_createLabFrameDirectories (int i_buffer, int lev)
 
void TMP_writeLabFrameHeader (int i_buffer)
 
void TMP_FlushLabFrameData (int i_buffer)
 
void DefineCellCenteredMultiFab (int lev)
 
void DefineFieldBufferMultiFab (const int i_buffer, const int lev)
 
amrex::Real UpdateCurrentZBoostCoordinate (amrex::Real t_lab, amrex::Real t_boost)
 
amrex::Real UpdateCurrentZLabCoordinate (amrex::Real t_lab, amrex::Real t_boost)
 
amrex::Real dz_lab (amrex::Real dt, amrex::Real ref_ratio)
 
int k_index_zlab (int i_buffer, int lev)
 
bool buffer_full (int i_buffer)
 
bool buffer_empty (int i_buffer)
 
void ResetBufferCounter (int i_buffer)
 

Private Attributes

bool m_do_back_transformed_fields = true
 
bool m_do_back_transformed_particles = true
 
amrex::Real m_gamma_boost
 
amrex::Real m_beta_boost
 
int m_moving_window_dir
 
int m_num_snapshots_lab = std::numeric_limits<int>::lowest()
 
amrex::Real m_dt_snapshots_lab = std::numeric_limits<amrex::Real>::lowest()
 
amrex::Real m_dz_snapshots_lab = 0.0
 
int m_buffer_size = 256
 
int m_max_box_size = 256
 
amrex::Vector< amrex::Real > m_t_lab
 
amrex::Vector< amrex::RealBox > m_prob_domain_lab
 
amrex::Vector< amrex::RealBox > m_buffer_domain_lab
 
amrex::Vector< amrex::IntVect > m_buffer_ncells_lab
 
amrex::Vector< amrex::Box > m_buffer_box
 
amrex::Vector< amrex::Real > m_current_z_lab
 
amrex::Vector< amrex::Real > m_current_z_boost
 
amrex::Vector< int > m_buffer_counter
 
amrex::Vector< std::unique_ptr< amrex::MultiFab > > m_cell_centered_data
 
std::vector< std::string > m_file_name
 
amrex::Vector< amrex::Vector< std::unique_ptr< ComputeDiagFunctor const > > > m_cell_center_functors
 
amrex::Vector< std::string > m_cellcenter_varnames
 

Additional Inherited Members

- Protected Member Functions inherited from Diagnostics
bool BaseReadParameters ()
 
void InitBaseData ()
 
virtual void MovingWindowAndGalileanDomainShift ()
 
- Protected Attributes inherited from Diagnostics
std::string m_diag_name
 
std::string m_file_prefix
 
int m_diag_index
 
amrex::Vector< std::string > m_varnames
 
std::string m_format = "plotfile"
 
int m_already_done = false
 
FlushFormatm_flush_format
 
amrex::Vector< amrex::Vector< amrex::MultiFab > > m_mf_output
 
amrex::Vector< amrex::Vector< amrex::Geometry > > m_geom_output
 
int nlev
 
int nmax_lev
 
int nlev_output
 
std::vector< std::string > m_species_names
 
amrex::Vector< ParticleDiagm_all_species
 
amrex::Vector< amrex::Vector< std::unique_ptr< ComputeDiagFunctor > > > m_all_field_functors
 
amrex::IntVect m_crse_ratio = amrex::IntVect(1)
 
amrex::Vector< amrex::Real > m_lo
 
amrex::Vector< amrex::Real > m_hi
 
int m_num_buffers
 
amrex::Vector< int > m_rho_per_species_index
 

Constructor & Destructor Documentation

◆ BTDiagnostics()

BTDiagnostics::BTDiagnostics ( int  i,
std::string  name 
)

Member Function Documentation

◆ buffer_empty()

bool BTDiagnostics::buffer_empty ( int  i_buffer)
inlineprivate

whether field buffer is empty.

Parameters
[in]i_bufferbuffer id for which the buffer size is checked. returns bool = true is buffer is empty i.e., when buffer counter is zero.

◆ buffer_full()

bool BTDiagnostics::buffer_full ( int  i_buffer)
inlineprivate

whether field buffer is full

Parameters
[in]i_bufferbuffer id for which the buffer size is checked. returns bool = true is buffer is full, that is, when buffer counter is equal to m_buffer_size

◆ DefineCellCenteredMultiFab()

void BTDiagnostics::DefineCellCenteredMultiFab ( int  lev)
private

Define the cell-centered multi-component MultiFab at level, lev. This function is called when the buffer counter for a snapshot is zero, or when the buffer is empty. Checked using buffer_empty(i_buffer)

Parameters
[in]levlevel at which the cell-centered MultiFab is defined.

◆ DefineFieldBufferMultiFab()

void BTDiagnostics::DefineFieldBufferMultiFab ( const int  i_buffer,
const int  lev 
)
private

Define the cell-centered multi-component output buffer MultiFab for snapshot, i_buffer, at level, lev.

Parameters
[in]i_bufferbuffer-id of the back-transformed snapshot
[in]lev,levelat which the output buffer MultiFab is defined

◆ DerivedInitData()

void BTDiagnostics::DerivedInitData ( )
overrideprivatevirtual

Initialize Data required to compute back-transformed diagnostics

Reimplemented from Diagnostics.

◆ DoComputeAndPack()

bool BTDiagnostics::DoComputeAndPack ( int  step,
bool  force_flush = false 
)
overrideprivatevirtual

whether to compute the back-transformed data and store buffer in this timestep The field-data is back-transformed from boosted-frame to lab-frame at every time step within the PIC loop. Back-transformation is not performed at initialization.

Parameters
[in]stepcurrent time step, return true for any step >= 0
[in]force_flushif true, return true for any step

Implements Diagnostics.

◆ DoDump()

bool BTDiagnostics::DoDump ( int  step,
int  i_buffer,
bool  force_flush = false 
)
overrideprivatevirtual

whether to write output files at this time step The data is flushed when the buffer is full and/or when the simulation ends or when forced.

Parameters
[in]stepcurrent time step
[in]force_flushif true, return true for any step The return bool is used to determine when to write buffer data out

Implements Diagnostics.

◆ dz_lab()

amrex::Real BTDiagnostics::dz_lab ( amrex::Real  dt,
amrex::Real  ref_ratio 
)
private

Compute and return cell-size in z-dimension in the lab-frame at level, lev

Parameters
[in]dt,timestepin boosted-frame at level, lev
[in]ref_ratio,refinementratio in the z-direction at level, lev-1. The ref-ratio in the z-direction for single-level diagnostics is 1.

◆ Flush()

void BTDiagnostics::Flush ( int  i_buffer)
overrideprivatevirtual

Flush m_mf_output and particles to file. Currently, a temporary customized output format for the buffer data is implemented and called in this function. After implementing OpenPMD and plotfile formats, this function can be defined and implemented in Diagnostics.H, such that, the function call to flush out buffer data for FullDiagnostics and BTDiagnostics is the same.

Implements Diagnostics.

◆ GetZSliceInDomainFlag()

bool BTDiagnostics::GetZSliceInDomainFlag ( const int  i_buffer,
const int  lev 
)
private

whether z-slice that corresponds to the buffer, i_buffer, is within the boosted-domain and lab-frame domains at level, lev.

Parameters
[in]i_bufferindex of the buffer for which the z-coordinates are checked Return true if the z co-ordinates stored in m_current_z_boost and m_current_z_lab for buffer, i_buffer, are within the bounds of the boosted-frame and lab-frame domain.

◆ InitializeFieldBufferData()

void BTDiagnostics::InitializeFieldBufferData ( int  i_buffer,
int  lev 
)
overrideprivatevirtual

Initialize buffer domain, buffer box and lab-frame parameters such as m_t_lab, and z-positions for the i^th snapshot, i_buffer, and level, lev.

Parameters
[in]i_bufferi^th snapshot or buffer
[in]levlevel for which the field buffer data is initialized.

Implements Diagnostics.

◆ InitializeFieldFunctors()

void BTDiagnostics::InitializeFieldFunctors ( int  lev)
overrideprivatevirtual

Initialize functors that store pointers to the fields requested by the user. Additionally, the cell-center functors that stores pointers to all fields, namely, Ex, Ey, Ez, Bx, By, Bz, jx, jy, jz, and rho is also initialized.

Parameters
[in]levlevel on which the vector of unique_ptrs to field functors is initialized.

Implements Diagnostics.

◆ InitializeParticleBuffer()

void BTDiagnostics::InitializeParticleBuffer ( )
inlineoverrideprivatevirtual

This function allocates and initializes particle buffers for all the snapshots. This is currently an empty function: The particle containers required for this must be added to populate this function.

Implements Diagnostics.

◆ k_index_zlab()

int BTDiagnostics::k_index_zlab ( int  i_buffer,
int  lev 
)
private

Compute k-index corresponding to current lab-frame z co-ordinate (m_current_z_lab) for the ith buffer, i_buffer, and at level, lev.

Parameters
[in]i_buffer,ithbuffer
[in]lev,levelat which the lab-frame z-index is computed

◆ PrepareFieldDataForOutput()

void BTDiagnostics::PrepareFieldDataForOutput ( )
overrideprivatevirtual

The cell-centered data for all fields, namely, Ex, Ey, Ez, Bx, By, Bz, jx, jy, jz, and rho is computed and stored in the multi-level cell-centered multifab, m_mf_cc. This MultiFab extends over the entire domain and is coarsened using the user-defined crse_ratio. For every lab-frame buffer, the data stored in this cell-centered MultiFab is sliced, back-transformed, and stored in the output multifab, m_mf_output.

Reimplemented from Diagnostics.

◆ ReadParameters()

void BTDiagnostics::ReadParameters ( )
private

Read relevant parameters for BTD

◆ ResetBufferCounter()

void BTDiagnostics::ResetBufferCounter ( int  i_buffer)
inlineprivate

Reset buffer counter to zero.

Parameters
[in]i_buffer,ithbuffer for which the bounter is set to zero.

◆ TMP_createLabFrameDirectories()

void BTDiagnostics::TMP_createLabFrameDirectories ( int  i_buffer,
int  lev 
)
private

Customized (temporary) functions creating lab-frame directories to flush out back-transformed data

Parameters
[in]i_buffer,indexof the buffer data that is being flushed out
[in]lev,levelof the buffer data. (Currently only single-level data is supported.)

◆ TMP_FlushLabFrameData()

void BTDiagnostics::TMP_FlushLabFrameData ( int  i_buffer)
private

Customized (temporary) output format for flushing out lab-frame data stored in the output buffer, m_mf_output.

Parameters
[in]i_buffer,ithbuffer for which the lab-farme data is flushed out.

◆ TMP_writeLabFrameHeader()

void BTDiagnostics::TMP_writeLabFrameHeader ( int  i_buffer)
private

Customized (temporary) functions creating header files to flush out back-transformed data for the ith buffer

Parameters
[in]i_buffer,ithbuffer storing data for the ith snapshot

◆ TMP_writeMetaData()

void BTDiagnostics::TMP_writeMetaData ( )
private

Customized (temporary) function to flush out back-transformed data

◆ UpdateCurrentZBoostCoordinate()

amrex::Real BTDiagnostics::UpdateCurrentZBoostCoordinate ( amrex::Real  t_lab,
amrex::Real  t_boost 
)
inlineprivate

Compute and return z-position in the boosted-frame at the current timestep

Parameters
[in]t_lab,lab-frametime of the snapshot
[in]t_boost,boosted-frametime at level, lev

◆ UpdateCurrentZLabCoordinate()

amrex::Real BTDiagnostics::UpdateCurrentZLabCoordinate ( amrex::Real  t_lab,
amrex::Real  t_boost 
)
inlineprivate

Compute and return z-position in the lab-frame at the current timestep

Parameters
[in]t_lab,lab-frametime of the snapshot
[in]t_boost,boosted-frametime at level, lev

Member Data Documentation

◆ m_beta_boost

amrex::Real BTDiagnostics::m_beta_boost
private

◆ m_buffer_box

amrex::Vector<amrex::Box> BTDiagnostics::m_buffer_box
private

Vector of Box-dimension in boosted-frame index space for each back-transformed snapshot

◆ m_buffer_counter

amrex::Vector<int> BTDiagnostics::m_buffer_counter
private

Vector of counters tracking number of back-transformed z-slices filled in the output buffer multifab, m_mf_output, for each snapshot. When the buffer counter for a snapshot is equal to the maximum number of buffers (m_buffer_size), i.e., when the buffer is full, the data stored in the buffer multifab is flushed out and the counter is reset is zero.

◆ m_buffer_domain_lab

amrex::Vector<amrex::RealBox> BTDiagnostics::m_buffer_domain_lab
private

Vector of user-defined physical region for diagnostics in lab-frame for each back-transformed snapshot

◆ m_buffer_ncells_lab

amrex::Vector<amrex::IntVect> BTDiagnostics::m_buffer_ncells_lab
private

Vector of number of cells in the lab-frame for each back-transformed snapshot

◆ m_buffer_size

int BTDiagnostics::m_buffer_size = 256
private

Number of z-slices in each buffer of the snapshot

◆ m_cell_center_functors

amrex::Vector< amrex::Vector <std::unique_ptr<ComputeDiagFunctor const> > > BTDiagnostics::m_cell_center_functors
private

Vector of pointers to compute cell-centered data, per level, per component using the coarsening-ratio provided by the user.

◆ m_cell_centered_data

amrex::Vector<std::unique_ptr<amrex::MultiFab> > BTDiagnostics::m_cell_centered_data
private

Multi-level cell-centered multifab with all field-data components, namely, Ex, Ey, Ez, Bx, By, Bz, jx, jy, jz, and rho. This cell-centered data extending over the entire domain will be used by all snapshots to obtain lab-frame data at the respective z slice location.

◆ m_cellcenter_varnames

amrex::Vector< std::string > BTDiagnostics::m_cellcenter_varnames
private
Initial value:
= {"Ex", "Ey", "Ez",
"Bx", "By", "Bz",
"jx", "jy", "jz", "rho"}

Vector of field-data stored in the cell-centered multifab, m_cell_centered_data. All the fields are stored regardless of the specific fields to plot selected by the user.

◆ m_current_z_boost

amrex::Vector<amrex::Real> BTDiagnostics::m_current_z_boost
private

Vector of boosted-frame z co-ordinate corresponding to each back-transformed snapshot at the current timestep

◆ m_current_z_lab

amrex::Vector<amrex::Real> BTDiagnostics::m_current_z_lab
private

Vector of lab-frame z co-ordinate of each back-transformed snapshot at the current timestep

◆ m_do_back_transformed_fields

bool BTDiagnostics::m_do_back_transformed_fields = true
private

Whether to compute back-tranformed values for field-data. default value is true.

◆ m_do_back_transformed_particles

bool BTDiagnostics::m_do_back_transformed_particles = true
private

Whether to compute back-tranformed values for particle-data default value is true.

◆ m_dt_snapshots_lab

amrex::Real BTDiagnostics::m_dt_snapshots_lab = std::numeric_limits<amrex::Real>::lowest()
private

Time interval in lab-frame between the back-transformed snapshots

◆ m_dz_snapshots_lab

amrex::Real BTDiagnostics::m_dz_snapshots_lab = 0.0
private

Distance between the back-transformed snapshots in lab-frame m_dz_snapshots_lab = m_dt_snapshots_lab/c

◆ m_file_name

std::vector<std::string> BTDiagnostics::m_file_name
private

Name of the output directories where the lab-frame data is dumped out in a custom format. This is a TMP variable, which may not be required after including OpenPMD and plotfile formats.

◆ m_gamma_boost

amrex::Real BTDiagnostics::m_gamma_boost
private

m_gamma_boost, is a copy of warpx.gamma_boost That is, the Lorentz factor of the boosted frame in which the simulation is run. The direction for Lorentz transformation is assumed to be along warpx.boost_direction, which is the same as the moving window direction. Currently, back-transformed diagnostics only works if the boost-direction and moving window direction are along the z-direction in Cartesian co-ordinates.

◆ m_max_box_size

int BTDiagnostics::m_max_box_size = 256
private

max grid size used to generate BoxArray to define output MultiFabs

◆ m_moving_window_dir

int BTDiagnostics::m_moving_window_dir
private

m_moving_window_dir is a copy of warpx.moving_window_dir Currently, back-transformed diagnostics only works if moving window is in z-direction for both 2D and 3D simulations in the Cartesian frame of reference.

◆ m_num_snapshots_lab

int BTDiagnostics::m_num_snapshots_lab = std::numeric_limits<int>::lowest()
private

Number of back-transformed snapshots in the lab-frame requested by the user

◆ m_prob_domain_lab

amrex::Vector<amrex::RealBox> BTDiagnostics::m_prob_domain_lab
private

Vector of lab-frame physical domain corresponding to the boosted-frame simulation domain at lab-frame time corresponding to each snapshot

◆ m_t_lab

amrex::Vector<amrex::Real> BTDiagnostics::m_t_lab
private

Vector of lab-frame time corresponding to each snapshot


The documentation for this class was generated from the following files: