Skip to content

Commit cb87d48

Browse files
authored
doc(runner): refactor runner output (#83)
1 parent 3e0cd10 commit cb87d48

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

modflowapi/extensions/runner.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def run_simulation(dll, sim_path, callback, verbose=False, _develop=False):
5555
callback(sim, Callbacks.initialize)
5656

5757
has_converged = False
58+
failed_timesteps = 0
5859
current_time = mf6.get_current_time()
5960
end_time = mf6.get_end_time()
6061
kperold = [0 for _ in range(sim.subcomponent_count)]
@@ -115,12 +116,20 @@ def run_simulation(dll, sim_path, callback, verbose=False, _develop=False):
115116
current_time = mf6.get_current_time()
116117

117118
if not has_converged:
118-
print(f"Simulation group: {sim_grp} DID NOT CONVERGE")
119+
failed_timesteps += 1
120+
msg = f".........Stress Period {sim_grp.kper + 1}; "
121+
msg += f"Timestep {sim_grp.kstp + 1} did not converge"
122+
print(msg)
119123

120124
try:
121125
callback(sim, Callbacks.finalize)
122126
mf6.finalize()
123127
except Exception:
124128
raise RuntimeError("MF6 simulation failed, check listing file")
125129

126-
print("NORMAL TERMINATION OF SIMULATION")
130+
if failed_timesteps > 0:
131+
msg = "\nAbnormal termination of simulation.\n"
132+
msg += f"Convergence failed {failed_timesteps} times."
133+
print(msg)
134+
else:
135+
print("\nNormal termination of simulation.")

0 commit comments

Comments
 (0)