def test2(self): lw = LinearWaves() lw.Uc = 5.0 lw.z_surface = 20.0 lw.hs = 2.0 lw.T = 10.0 lw.z_floor = 0.0 lw.betaWave = 3.0 lw.z = np.linspace(-5.0, 50.0, 20) names, errors = check_gradient(lw) tol = 1e-6 for name, err in zip(names, errors): try: self.assertLessEqual(err, tol) except AssertionError, e: print "*** error in:", name raise e
def test2(self): lw = LinearWaves() lw.Uc = 5.0 lw.z_surface = 20.0 lw.hs = 2.0 lw.T = 10.0 lw.z_floor = 0.0 lw.betaWave = 3.0 lw.z = np.linspace(-5.0, 50.0, 20) names, errors = check_gradient(lw) tol = 1e-6 for name, err in zip(names, errors): try: self.assertLessEqual(err, tol) except AssertionError, e: print '*** error in:', name raise e
def test1(self): lw = LinearWaves() lw.Uc = 7.0 lw.z_surface = 20.0 lw.hs = 10.0 lw.T = 2.0 lw.z_floor = 0.0 lw.betaWave = 3.0 lw.z = np.linspace(0.0, 20.0, 20) names, errors = check_gradient(lw) tol = 1e-4 for name, err in zip(names, errors): if name in ("d_U[0] / d_z[0]", "d_U[19] / d_z[19]", "d_A[0] / d_z[0]", "d_A[19] / d_z[19]"): continue # the boundaries are not differentiable across bounds. these nodes must not move try: self.assertLessEqual(err, tol) except AssertionError, e: print "*** error in:", name raise e
def test1(self): lw = LinearWaves() lw.Uc = 7.0 lw.z_surface = 20.0 lw.hs = 10.0 lw.T = 2.0 lw.z_floor = 0.0 lw.betaWave = 3.0 lw.z = np.linspace(0.0, 20.0, 20) names, errors = check_gradient(lw) tol = 1e-4 for name, err in zip(names, errors): if name in ('d_U[0] / d_z[0]', 'd_U[19] / d_z[19]', 'd_A[0] / d_z[0]', 'd_A[19] / d_z[19]'): continue # the boundaries are not differentiable across bounds. these nodes must not move try: self.assertLessEqual(err, tol) except AssertionError, e: print '*** error in:', name raise e