Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions Source/Evolve/WarpXComputeDt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,33 +236,33 @@ WarpX::WriteDtUpdateFileHeader ()
const bool IsNotRestart = restart_chkfile.empty();

// If not a restart, discard the file if already exists.
auto file_mode = std::ofstream::out;
if (IsNotRestart) { file_mode |= std::ofstream::trunc; }

std::ofstream diagnostic_file{m_dt_update_diagnostic_file, file_mode};
if (!diagnostic_file.is_open()) {
amrex::Abort("Failed to open file: " + m_dt_update_diagnostic_file);
}

int c = 0;
diagnostic_file << "#";
diagnostic_file << "[" << c++ << "]step()";
diagnostic_file << " ";
diagnostic_file << "[" << c++ << "]time(s)";
diagnostic_file << " ";
diagnostic_file << "[" << c++ << "]new_dt";
diagnostic_file << " ";
diagnostic_file << "[" << c++ << "]vmax_dt";
if (m_max_omegap_dt.has_value()) {
if (IsNotRestart) {
auto file_mode = std::ofstream::out | std::ofstream::trunc;
std::ofstream diagnostic_file{m_dt_update_diagnostic_file, file_mode};
if (!diagnostic_file.is_open()) {
amrex::Abort("Failed to open file: " + m_dt_update_diagnostic_file);
}

int c = 0;
diagnostic_file << "#";
diagnostic_file << "[" << c++ << "]step()";
diagnostic_file << " ";
diagnostic_file << "[" << c++ << "]omegap_dt";
}
if (m_max_omegac_dt.has_value()) {
diagnostic_file << "[" << c++ << "]time(s)";
diagnostic_file << " ";
diagnostic_file << "[" << c++ << "]omegac_dt";
diagnostic_file << "[" << c++ << "]new_dt";
diagnostic_file << " ";
diagnostic_file << "[" << c++ << "]vmax_dt";
if (m_max_omegap_dt.has_value()) {
diagnostic_file << " ";
diagnostic_file << "[" << c++ << "]omegap_dt";
}
if (m_max_omegac_dt.has_value()) {
diagnostic_file << " ";
diagnostic_file << "[" << c++ << "]omegac_dt";
}
diagnostic_file << "\n";
diagnostic_file.close();
}
diagnostic_file << "\n";
diagnostic_file.close();
}

}
Expand Down
Loading