Skip to content

Commit

Permalink
[1D] Set overwrite flag when saving debug output files
Browse files Browse the repository at this point in the history
This prevents errors that could occur if the steady-state Newton solver
experiences failures after previous successful Newton solves. In this situation,
the data group at the highest level already exists in the debug file, and must
explicitly be overwritten.
  • Loading branch information
wandadars authored and speth committed Jan 18, 2024
1 parent 7efb996 commit a25d7b6
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/oneD/Sim1D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,34 +448,34 @@ void Sim1D::solve(int loglevel, bool refine_grid)

if (loglevel > 6) {
save("debug_sim1d.yaml", "debug",
"After successful Newton solve");
"After successful Newton solve", true);
}
if (loglevel > 7) {
saveResidual("debug_sim1d.yaml", "residual",
"After successful Newton solve");
"After successful Newton solve", true);
}
ok = true;
} else {
debuglog(" failure. \n", loglevel);
if (loglevel > 6) {
save("debug_sim1d.yaml", "debug",
"After unsuccessful Newton solve");
"After unsuccessful Newton solve", true);
}
if (loglevel > 7) {
saveResidual("debug_sim1d.yaml", "residual",
"After unsuccessful Newton solve");
"After unsuccessful Newton solve", true);
}
if (loglevel > 0) {
writelog("Take {} timesteps ", nsteps);
}
dt = timeStep(nsteps, dt, m_state->data(), m_xnew.data(), loglevel-1);
m_xlast_ts = *m_state;
if (loglevel > 6) {
save("debug_sim1d.yaml", "debug", "After timestepping");
save("debug_sim1d.yaml", "debug", "After timestepping", true);
}
if (loglevel > 7) {
saveResidual("debug_sim1d.yaml", "residual",
"After timestepping");
"After timestepping", true);
}

if (loglevel == 1) {
Expand Down Expand Up @@ -506,11 +506,11 @@ void Sim1D::solve(int loglevel, bool refine_grid)
dt = m_tstep;
}
if (new_points && loglevel > 6) {
save("debug_sim1d.yaml", "debug", "After regridding");
save("debug_sim1d.yaml", "debug", "After regridding", true);
}
if (new_points && loglevel > 7) {
saveResidual("debug_sim1d.yaml", "residual",
"After regridding");
"After regridding", true);
}
} else {
debuglog("grid refinement disabled.\n", loglevel);
Expand Down

0 comments on commit a25d7b6

Please sign in to comment.