def testSlipLimit(self): slip = lambda z: 0 x = np.arange(0.05, 10.0, 0.05) t = [0] alpha = 1.0 u_t = np.array(map(lambda t_in: full_viscoelastic.solution(slip, x, t_in, alpha), t)) self.assertTrue((u_t == 0.0).all())
def testAlphaLimit(self): slip = lambda z: 1 x = np.arange(0.05, 10.0, 0.50) t = np.arange(0.0, 5.0) alpha = 1000000000.0 u_t = np.array(map(lambda t_in: full_viscoelastic.solution(slip, x, t_in, alpha), t)) self.assertTrue((u_t < 0.000000001).all())
def testXLimit(self): slip = lambda z: 1 x = np.array([0.001, 100000000]) t = [0] alpha = 1.0 u_t = np.array(map(lambda t_in: full_viscoelastic.solution(slip, x, t_in, alpha), t)) self.assertTrue((abs(u_t[0][0] - 0.5) < 0.001).all()) self.assertTrue((abs(u_t[0][1] - 0.0) < 0.001).all())
def testCompareVariableSlip(self): slip = lambda z: 1 x = np.arange(0.05, 10.0, 0.5) t = np.arange(0.0, 5.0) alpha = 1 u_t = map(lambda t_in: full_viscoelastic.solution(slip, x, t_in, alpha), t) #first compare to elastic solutions -- they should match at t=0 u_e = full_elastic.surface_elastic_half_space(slip, x) # print utilities.mse(u_t[0], u_elastic) self.assertTrue(utilities.mse(u_t[0], u_e) < 0.0001) #then compare to viscoelastic solutions -- they should match at all times because slip is constant u_constant_slip_ve = map(lambda t_in: constant_slip_maxwell_dimensionless.solution(x, t_in, alpha), t) # pyp.figure(1) # utilities.plot_time_series_1D(x, u_t, t, show = False) # pyp.figure(2) # utilities.plot_time_series_1D(x, u_constant_slip_ve, t, show = False) # pyp.show() for i in range(len(t)): # print u_t[i] - u_constant_slip_ve[i] self.assertTrue(utilities.mse(u_t[i], u_constant_slip_ve[i]) < 0.0001)
def standard_params(slip): x = np.arange(0.05, 10.0, 0.05) t = np.arange(0.0, 5.0) alpha = 0.0 u_t = map(lambda t_in: full_viscoelastic.solution(slip, x, t_in, alpha), t) utilities.plot_time_series_1D(x, u_t, t)