Skip to content

Commit

Permalink
Print warning if epsilon < 1 (NanoComp#356)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherHogan authored and stevengj committed May 28, 2018
1 parent 6c62dbc commit baa1510
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions python/geom.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import math
import numbers
import operator
import warnings
from collections import namedtuple
from copy import deepcopy
from numbers import Number
Expand Down Expand Up @@ -164,6 +165,15 @@ def __init__(self, epsilon_diag=Vector3(1, 1, 1),
i2 = index * index
epsilon_diag = Vector3(i2, i2, i2)

if ((epsilon_diag.x < 1 and epsilon_diag.x > -mp.inf) or
(epsilon_diag.y < 1 and epsilon_diag.y > -mp.inf) or
(epsilon_diag.z < 1 and epsilon_diag.z > -mp.inf)):

eps_warning = ("Epsilon < 1 may require adjusting the Courant parameter. " +
"See the 'Numerical Stability' entry under the 'Materials' " +
"section of the documentation")
warnings.warn(eps_warning, RuntimeWarning)

if mu:
mu_diag = Vector3(mu, mu, mu)

Expand Down

0 comments on commit baa1510

Please sign in to comment.