Skip to content

Commit

Permalink
check if index of zslice is within index bounds of patch in boosted f…
Browse files Browse the repository at this point in the history
…rame
  • Loading branch information
RevathiJambunathan committed Dec 15, 2023
1 parent 61f125b commit 78ad4d2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 0 additions & 2 deletions Source/Diagnostics/BTDiagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,6 @@ BTDiagnostics::DefineFieldBufferMultiFab (const int i_buffer, const int lev)
auto & warpx = WarpX::GetInstance();

const int hi_k_lab = m_buffer_k_index_hi[i_buffer][lev];
amrex::Print() << "hi_k_lab = " << hi_k_lab << "\n";
m_buffer_box[i_buffer][lev].setSmall( m_moving_window_dir, hi_k_lab - m_buffer_size + 1);
m_buffer_box[i_buffer][lev].setBig( m_moving_window_dir, hi_k_lab );
amrex::BoxArray buffer_ba( m_buffer_box[i_buffer][lev] );
Expand Down Expand Up @@ -957,7 +956,6 @@ BTDiagnostics::DefineFieldBufferMultiFab (const int i_buffer, const int lev)
// Refine the geometry object defined at the previous level, lev-1
m_geom_output[i_buffer][lev] = amrex::refine( m_geom_output[i_buffer][lev-1],
WarpX::RefRatio(lev-1) );
//amrex::Print() << "DefineFieldBufferMultiFab lev == 1 : m_geom_output[i_buffer][lev] = " << m_geom_output[i_buffer][lev] << "\n";
}
m_field_buffer_multifab_defined[i_buffer] = 1;
WARPX_ALWAYS_ASSERT_WITH_MESSAGE( m_mf_output[i_buffer][lev].boxArray().size() == 1,
Expand Down
14 changes: 8 additions & 6 deletions Source/Diagnostics/ComputeDiagFunctors/BackTransformFunctor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ BackTransformFunctor::operator ()(amrex::MultiFab& mf_dst, int /*dcomp*/, const
const int scomp = 0;
// Generate slice of the cell-centered multifab containing boosted-frame field-data
// at current z-boost location for the ith buffer
// Create a 2D box for the slice in the boosted frame
const amrex::Real dx = geom.CellSize(moving_window_dir);
// index corresponding to z_boost location in the boost-frame
const int i_boost = static_cast<int> ( ( m_current_z_boost[i_buffer]
- geom.ProbLo(moving_window_dir) ) / dx );
amrex::Box box = warpx.boxArray(m_lev).minimalBox() ;
// Checking if the index of the slice is within the box of the boosted frame region at level, m_lev
if ( !( (i_boost > box.smallEnd(moving_window_dir) ) && (i_boost < box.bigEnd(moving_window_dir) ) ) ) return;
slice = amrex::get_slice_data(moving_window_dir,
m_current_z_boost[i_buffer],
*m_mf_src,
Expand All @@ -70,12 +78,6 @@ BackTransformFunctor::operator ()(amrex::MultiFab& mf_dst, int /*dcomp*/, const
// Perform in-place Lorentz-transform of all the fields stored in the slice.
LorentzTransformZ( *slice, gamma_boost, beta_boost);

// Create a 2D box for the slice in the boosted frame
const amrex::Real dx = geom.CellSize(moving_window_dir);
// index corresponding to z_boost location in the boost-frame
const int i_boost = static_cast<int> ( ( m_current_z_boost[i_buffer]
- geom.ProbLo(moving_window_dir) ) / dx );
// z-Slice at i_boost with x,y indices same as buffer_box
amrex::Box slice_box = m_buffer_box[i_buffer];
slice_box.setSmall(moving_window_dir, i_boost);
slice_box.setBig(moving_window_dir, i_boost);
Expand Down

0 comments on commit 78ad4d2

Please sign in to comment.