Skip to content

Commit

Permalink
Terminate sweeps if they go too long
Browse files Browse the repository at this point in the history
PETSc's LinearLUSolver presently doesn't converge, causing this example to
run forever.

Addresses usnistgov#644
  • Loading branch information
guyer committed Sep 24, 2019
1 parent 63dd289 commit 288f472
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions examples/phase/binaryCoupled.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,12 +514,14 @@ def deltaChemPot(phase, C, T):
>>> C.updateOld()
>>> res = 1.
>>> initialRes = None
>>> sweep = 0
>>> while res > 1e-4:
>>> while res > 1e-4 and sweep < 20:
... res = eq.sweep(dt=dt, solver=solver)
... if initialRes is None:
... initialRes = res
... res = res / initialRes
... sweep += 1
>>> from fipy import input
>>> if __name__ == '__main__':
Expand Down Expand Up @@ -604,8 +606,10 @@ def deltaChemPot(phase, C, T):
... phase.updateOld()
... C.updateOld()
... res = 1e+10
... while res > 1e-3:
... sweep = 0
... while res > 1e-3 and sweep < 20:
... res = eq.sweep(dt=dt, solver=solver)
... sweep += 1
... if __name__ == '__main__':
... viewer.plot()
Expand Down

0 comments on commit 288f472

Please sign in to comment.