Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
 def testCompareElasticSolutions(self):
     x = np.arange(0.05, 5.0, 0.05)
     displacement = full_elastic.surface_elastic_half_space(lambda z: 1.0, x)
     displacement2 = full_elastic.surface_two_layer_elastic(lambda z: 1.0,
                                                    1.0, 0.0, x)
     self.assertTrue(utilities.mse(displacement, displacement2) < 0.0001)