Skip to content

Commit

Permalink
Move yield of States.stress_period_end to right place
Browse files Browse the repository at this point in the history
  • Loading branch information
pya committed Apr 6, 2024
1 parent f615ddd commit 451d8c9
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/pymf6/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ def loop(self):
verbose = self.verbose
sim = self.api

yield sim, States.initialize

current_time = mf6.get_current_time()
end_time = mf6.get_end_time()
kperold = [0 for _ in range(sim.subcomponent_count)]
Expand All @@ -97,11 +95,7 @@ def loop(self):
kperold=kperold)
mf6.finalize_time_step()
current_time = mf6.get_current_time()
sim_grp = self._sim_grp
if sim_grp.nstp == sim_grp.kstp + 1:
yield sim_grp, States.stress_period_end
try:
yield sim, States.finalize
mf6.finalize()
except Exception as err:
msg = 'MF6 simulation failed, check listing file'
Expand Down Expand Up @@ -155,6 +149,8 @@ def _solutions_loop(self, sim, mf6, current_time, kperold):
break
yield sim_grp, States.timestep_end
mf6.finalize_solve(sol_id)
if sim_grp.nstp == sim_grp.kstp + 1:
yield sim_grp, States.stress_period_end
if not has_converged:
print(f"Simulation group: {sim_grp} DID NOT CONVERGE")
self._sim_grp = sim_grp

0 comments on commit 451d8c9

Please sign in to comment.