Skip to content

Commit e785f00

Browse files
ax3latmyersRemiLehetitoiride
committed
Checkpoint/Plotfile: Robust Bounds Calc
The calculation of the bounds in plotfiles (incl. checkpoints) appears fishy. It relies on the order of the boxes in the box array, which is not always pointing to a box on the lower/upper bound of the simulation when load balancing is used. This can corrupt checkpoints (plotfiles) when writing, by a) filtering out valid particles & fields and b) remembering the wrong simulation meta-data for the simulation geometry of fields/particles. Co-authored-by: Andrew Myers <[email protected]> Co-authored-by: Remi Lehe <[email protected]> Co-authored-by: Davide Terzani <[email protected]>
1 parent ef6e84c commit e785f00

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Source/Diagnostics/FullDiagnostics.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -764,13 +764,16 @@ FullDiagnostics::InitializeBufferData (int i_buffer, int lev, bool restart ) {
764764
// Coarsen and refine so that the new BoxArray is coarsenable.
765765
ba.coarsen(m_crse_ratio).refine(m_crse_ratio);
766766

767+
// Box covering the extent of the user-defined diagnostic domain
768+
amrex::Box const domain = ba.minimalBox();
769+
767770
// Update the physical co-ordinates m_lo and m_hi using the final index values
768771
// from the coarsenable, cell-centered BoxArray, ba.
769772
for ( int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
770773
diag_dom.setLo( idim, warpx.Geom(lev).ProbLo(idim) +
771-
ba.getCellCenteredBox(0).smallEnd(idim) * warpx.Geom(lev).CellSize(idim));
774+
domain.smallEnd(idim) * warpx.Geom(lev).CellSize(idim));
772775
diag_dom.setHi( idim, warpx.Geom(lev).ProbLo(idim) +
773-
(ba.getCellCenteredBox( static_cast<int>(ba.size())-1 ).bigEnd(idim) + 1) * warpx.Geom(lev).CellSize(idim));
776+
(domain.bigEnd(idim) + 1) * warpx.Geom(lev).CellSize(idim));
774777
}
775778

776779
}

0 commit comments

Comments
 (0)