From f11caa0079d6443a42f6d5a3795229083975503d Mon Sep 17 00:00:00 2001 From: David Grote Date: Mon, 10 Mar 2025 13:18:02 -0700 Subject: [PATCH 1/2] Check is implicit diagnostics file exist before writing the header --- Source/NonlinearSolvers/NewtonSolver.H | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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(); From a9b6649aac8ffedcf9d2f79f475ed271c359984e Mon Sep 17 00:00:00 2001 From: David Grote Date: Mon, 10 Mar 2025 16:27:17 -0700 Subject: [PATCH 2/2] Also make the change in PicardSolver.H --- Source/NonlinearSolvers/PicardSolver.H | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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();