WarpX
Public Member Functions | Private Member Functions | Private Attributes | List of all members
BackTransformedDiagnostic Class Reference

BackTransformedDiagnostic class handles the back-transformation of data when running simulations in a boosted frame of reference to the lab-frame. Because of the relativity of simultaneity, events that are synchronized in the simulation boosted frame are not synchronized in the lab frame. Thus, at a given t_boost, we must write slices of back-transformed data to multiple output files, each one corresponding to a given time in the lab frame. The member function writeLabFrameData() orchestrates the operations required to Lorentz-transform data from boosted-frame to lab-frame and store them in the LabFrameDiag class, which writes out the field and particle data to the output directory. The functions Flush() and writeLabFrameData() are called at the end of the simulation and when the the buffer for data storage is full, respectively. The particle data is collected and written only if particle.do_back_transformed_diagnostics = 1. More...

#include <BackTransformedDiagnostic.H>

Public Member Functions

 BackTransformedDiagnostic (amrex::Real zmin_lab, amrex::Real zmax_lab, amrex::Real v_window_lab, amrex::Real dt_snapshots_lab, int N_snapshots, amrex::Real dt_slice_snapshots_lab, int N_slice_snapshots, amrex::Real gamma_boost, amrex::Real t_boost, amrex::Real dt_boost, int boost_direction, const amrex::Geometry &geom, amrex::RealBox &slice_realbox, amrex::Real particle_slice_width_lab)
 
void Flush (const amrex::Geometry &geom)
 
void writeLabFrameData (const amrex::MultiFab *cell_centered_data, const MultiParticleContainer &mypc, const amrex::Geometry &geom, const amrex::Real t_boost, const amrex::Real dt)
 The order of operations performed in writeLabFrameData is as follows : More...
 
void writeMetaData ()
 The metadata containg information on t_boost, num_snapshots, and Lorentz parameters. More...
 

Private Member Functions

void writeParticleData (const WarpXParticleContainer::DiagnosticParticleData &pdata, const std::string &name, const int i_lab)
 

Private Attributes

amrex::Real m_gamma_boost_
 
amrex::Real m_inv_gamma_boost_
 
amrex::Real m_beta_boost_
 
amrex::Real m_inv_beta_boost_
 
amrex::Real m_dz_lab_
 
amrex::Real m_inv_dz_lab_
 
amrex::Real m_dt_snapshots_lab_
 
amrex::Real m_dt_boost_
 
int m_N_snapshots_
 
int m_boost_direction_
 
int m_N_slice_snapshots_
 
amrex::Real m_dt_slice_snapshots_lab_
 
amrex::Real m_particle_slice_width_lab_
 
int m_num_buffer_ = 256
 
int m_max_box_size_ = 256
 
std::vector< std::unique_ptr< LabFrameDiag > > m_LabFrameDiags_
 
std::map< std::string, int > m_possible_fields_to_dump
 
amrex::Vector< int > map_actual_fields_to_dump
 
std::vector< std::string > m_mesh_field_names
 
int m_ncomp_to_dump = 10
 

Detailed Description

BackTransformedDiagnostic class handles the back-transformation of data when running simulations in a boosted frame of reference to the lab-frame. Because of the relativity of simultaneity, events that are synchronized in the simulation boosted frame are not synchronized in the lab frame. Thus, at a given t_boost, we must write slices of back-transformed data to multiple output files, each one corresponding to a given time in the lab frame. The member function writeLabFrameData() orchestrates the operations required to Lorentz-transform data from boosted-frame to lab-frame and store them in the LabFrameDiag class, which writes out the field and particle data to the output directory. The functions Flush() and writeLabFrameData() are called at the end of the simulation and when the the buffer for data storage is full, respectively. The particle data is collected and written only if particle.do_back_transformed_diagnostics = 1.

Constructor & Destructor Documentation

◆ BackTransformedDiagnostic()

BackTransformedDiagnostic::BackTransformedDiagnostic ( amrex::Real  zmin_lab,
amrex::Real  zmax_lab,
amrex::Real  v_window_lab,
amrex::Real  dt_snapshots_lab,
int  N_snapshots,
amrex::Real  dt_slice_snapshots_lab,
int  N_slice_snapshots,
amrex::Real  gamma_boost,
amrex::Real  t_boost,
amrex::Real  dt_boost,
int  boost_direction,
const amrex::Geometry &  geom,
amrex::RealBox &  slice_realbox,
amrex::Real  particle_slice_width_lab 
)

Member Function Documentation

◆ Flush()

void BackTransformedDiagnostic::Flush ( const amrex::Geometry &  geom)

Flush() is called at the end of the simulation when the buffers that contain back-transformed lab-frame data even if they are not full.

◆ writeLabFrameData()

void BackTransformedDiagnostic::writeLabFrameData ( const amrex::MultiFab *  cell_centered_data,
const MultiParticleContainer mypc,
const amrex::Geometry &  geom,
const amrex::Real  t_boost,
const amrex::Real  dt 
)

The order of operations performed in writeLabFrameData is as follows :

  1. Loops over the sorted back-transformed diags and for each diag steps 2-7 are performed
  2. Based on t_lab and t_boost, obtain z_lab and z_boost.
  3. Define data_buffer multifab that will store the data in the BT diag.
  4. Define slice multifab at z_index that corresponds to z_boost and getslicedata using cell-centered data at z_index and its distribution map.
  5. Lorentz transform data stored in slice from z_boost,t_Boost to z_lab,t_lab and store in slice multifab.
  6. Generate a temporary slice multifab with distribution map of lab-frame data but at z_boost and ParallelCopy data from the slice multifab to the temporary slice.
  7. Finally, AddDataToBuffer is called where the data from temporary slice is simply copied from tmp_slice(i,j,k_boost) to LabFrameDiagSnapshot(i,j,k_lab) for full BT lab-frame diagnostic OR from tmp_slice(i,j,k_boost) to LabFrameDiagSlice(i,j,k_lab) for the reduced slice diagnostic
  8. Similarly, particles that crossed the z_boost plane are selected and lorentz-transformed to the lab-frame and copied to the full and reduce diagnostic and stored in particle_buffer.

◆ writeMetaData()

void BackTransformedDiagnostic::writeMetaData ( )

The metadata containg information on t_boost, num_snapshots, and Lorentz parameters.

◆ writeParticleData()

void BackTransformedDiagnostic::writeParticleData ( const WarpXParticleContainer::DiagnosticParticleData pdata,
const std::string &  name,
const int  i_lab 
)
private

Member Data Documentation

◆ m_beta_boost_

amrex::Real BackTransformedDiagnostic::m_beta_boost_
private

◆ m_boost_direction_

int BackTransformedDiagnostic::m_boost_direction_
private

◆ m_dt_boost_

amrex::Real BackTransformedDiagnostic::m_dt_boost_
private

◆ m_dt_slice_snapshots_lab_

amrex::Real BackTransformedDiagnostic::m_dt_slice_snapshots_lab_
private

◆ m_dt_snapshots_lab_

amrex::Real BackTransformedDiagnostic::m_dt_snapshots_lab_
private

◆ m_dz_lab_

amrex::Real BackTransformedDiagnostic::m_dz_lab_
private

◆ m_gamma_boost_

amrex::Real BackTransformedDiagnostic::m_gamma_boost_
private

◆ m_inv_beta_boost_

amrex::Real BackTransformedDiagnostic::m_inv_beta_boost_
private

◆ m_inv_dz_lab_

amrex::Real BackTransformedDiagnostic::m_inv_dz_lab_
private

◆ m_inv_gamma_boost_

amrex::Real BackTransformedDiagnostic::m_inv_gamma_boost_
private

◆ m_LabFrameDiags_

std::vector<std::unique_ptr<LabFrameDiag> > BackTransformedDiagnostic::m_LabFrameDiags_
private

◆ m_max_box_size_

int BackTransformedDiagnostic::m_max_box_size_ = 256
private

◆ m_mesh_field_names

std::vector<std::string> BackTransformedDiagnostic::m_mesh_field_names
private
Initial value:
= {"Ex", "Ey", "Ez",
"Bx", "By", "Bz",
"jx", "jy", "jz", "rho"}

◆ m_N_slice_snapshots_

int BackTransformedDiagnostic::m_N_slice_snapshots_
private

◆ m_N_snapshots_

int BackTransformedDiagnostic::m_N_snapshots_
private

◆ m_ncomp_to_dump

int BackTransformedDiagnostic::m_ncomp_to_dump = 10
private

◆ m_num_buffer_

int BackTransformedDiagnostic::m_num_buffer_ = 256
private

◆ m_particle_slice_width_lab_

amrex::Real BackTransformedDiagnostic::m_particle_slice_width_lab_
private

◆ m_possible_fields_to_dump

std::map<std::string, int> BackTransformedDiagnostic::m_possible_fields_to_dump
private
Initial value:
= {
{"Ex" , 0},
{"Ey" , 1},
{"Ez" , 2},
{"Bx" , 3},
{"By" , 4},
{"Bz" , 5},
{"jx" , 6},
{"jy" , 7},
{"jz" , 8},
{"rho", 9} }

◆ map_actual_fields_to_dump

amrex::Vector<int> BackTransformedDiagnostic::map_actual_fields_to_dump
private

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