Skip to content

Commit

Permalink
changed the error term in check_vertical_flux
Browse files Browse the repository at this point in the history
  • Loading branch information
amirDahari1 committed Nov 8, 2023
1 parent 3b0c37f commit b87a515
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion taufactor/taufactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ def solve(self, iter_limit=5000, verbose=True, conv_crit=2*10**-2):
out /= self.nn
# check convergence using criteria
if self.iter % 100 == 0:
# plt.imshow(self.conc[0,0,3:-2,290:-2].cpu().numpy())
# print('hello')
# plt.show()
self.converged = self.check_convergence(
verbose, conv_crit, start, iter_limit)
# efficient way of adding flux to old conc with overrelaxation
Expand Down Expand Up @@ -198,7 +201,7 @@ def check_vertical_flux(self, conv_crit):
vert_flux[self.conc[:, :-2, 1:-1, 1:-1] == 0] = 0
vert_flux[self.conc[:, 1:-1, 1:-1, 1:-1] == 0] = 0
fl = torch.sum(vert_flux, (0, 2, 3))[1:-1]
err = (fl.max() - fl.min())*2/(fl.max() + fl.min())
err = (fl.max() - fl.min())/(fl.max())
if fl.min() == 0:
return 'zero_flux', torch.mean(fl), err
if err < conv_crit or torch.isnan(err).item():
Expand Down

0 comments on commit b87a515

Please sign in to comment.