diff --git a/Source/NonlinearSolvers/NewtonSolver.H b/Source/NonlinearSolvers/NewtonSolver.H index 9a1a7d5034a..9b87f2e8103 100644 --- a/Source/NonlinearSolvers/NewtonSolver.H +++ b/Source/NonlinearSolvers/NewtonSolver.H @@ -204,7 +204,9 @@ void NewtonSolver::Define ( const Vec& a_U, this->m_is_defined = true; // Create diagnostic file and write header - if (!this->m_diagnostic_file.empty() && amrex::ParallelDescriptor::IOProcessor()) { + if (amrex::ParallelDescriptor::IOProcessor() + && !this->m_diagnostic_file.empty() + && !amrex::FileExists(this->m_diagnostic_file)) { std::filesystem::path const diagnostic_path(this->m_diagnostic_file); std::filesystem::path const diagnostic_dir = diagnostic_path.parent_path(); diff --git a/Source/NonlinearSolvers/PicardSolver.H b/Source/NonlinearSolvers/PicardSolver.H index 448fea7e75d..ec53bf94587 100644 --- a/Source/NonlinearSolvers/PicardSolver.H +++ b/Source/NonlinearSolvers/PicardSolver.H @@ -118,7 +118,9 @@ void PicardSolver::Define ( const Vec& a_U, this->m_is_defined = true; // Create diagnostic file and write header - if (!this->m_diagnostic_file.empty() && amrex::ParallelDescriptor::IOProcessor()) { + if (amrex::ParallelDescriptor::IOProcessor() + && !this->m_diagnostic_file.empty() + && !amrex::FileExists(this->m_diagnostic_file)) { std::filesystem::path const diagnostic_path(this->m_diagnostic_file); std::filesystem::path const diagnostic_dir = diagnostic_path.parent_path();