Skip to content

Commit

Permalink
no flush if slice counter is 0
Browse files Browse the repository at this point in the history
  • Loading branch information
RevathiJambunathan committed Aug 1, 2023
1 parent eae54de commit ff88ceb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions Source/Diagnostics/StationDiagnostics.H
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ private:
int m_flush_counter = 0;

bool GetZSliceInDomain (const int lev);
bool m_last_timeslice_filled = false;
};


Expand Down
8 changes: 6 additions & 2 deletions Source/Diagnostics/StationDiagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ bool
StationDiagnostics::DoDump (int step, int /* i_buffer*/, bool force_flush)
{
// Determine criterion to dump output

return ( (m_slice_counter == m_buffer_size) || force_flush );
return ( (m_slice_counter == m_buffer_size) || force_flush || m_last_timeslice_filled);
}

bool
Expand Down Expand Up @@ -181,6 +180,9 @@ StationDiagnostics::UpdateBufferData ()
{
if (GetZSliceInDomain(0))
m_slice_counter++;
if (m_slice_counter > 0 and !GetZSliceInDomain(0)) {
m_last_timeslice_filled = true;
}
}

void
Expand All @@ -192,6 +194,7 @@ StationDiagnostics::InitializeParticleBuffer ()
void
StationDiagnostics::Flush (int i_buffer)
{
if (m_slice_counter == 0) return;
auto & warpx = WarpX::GetInstance();
m_tmax = warpx.gett_new(0);
std::string filename = m_file_prefix;
Expand All @@ -209,6 +212,7 @@ StationDiagnostics::Flush (int i_buffer)
}
}
std::string buffer_string = amrex::Concatenate("buffer-",m_flush_counter,m_file_min_digits);
amrex::Print() << " Writing station buffer " << buffer_string << "\n";
const std::string prefix = amrex::MultiFabFileFullPrefix(lev, filename, "Level_", buffer_string);
amrex::VisMF::Write(m_mf_output[i_buffer][lev], prefix);
}
Expand Down

0 comments on commit ff88ceb

Please sign in to comment.