Ejemplo n.º 1
0
    def testGetDisplacement(self):
        from proteus import Domain
        from proteus import SpatialTools as st
        from proteus.mprans import SpatialTools as mst
        from proteus.mprans import BodyDynamics as bd

        # parameters
        domain2D = Domain.PlanarStraightLineGraphDomain()
        pos = np.array([1.0, 1.0, 0.0])
        dim = (0.3, 0.385)
        caisson = mst.Rectangle(domain=domain2D,
                                dim=dim,
                                coords=[pos[0], pos[1]])
        caisson2D = bd.RigidBody(shape=caisson)
        mst.assembleDomain(domain2D)
        c2d = caisson2D
        c2d.nd = 2
        Ix = ((dim[0]**2) / 12.)
        Iy = ((dim[1]**2) / 12.)
        It = Ix + Iy
        mass = 50.0
        c2d.mass, c2d.It = mass, It
        Kx, Ky, Kz = K = [200000., 250000., 0.0]
        Cx, Cy, Cz = C = [2000., 4000., 0.0]
        c2d.Kx, c2d.Ky, c2d.Kz, c2d.Cx, c2d.Cy, c2d.Cz = Kx, Ky, Kz, Cx, Cy, Cz
        init_barycenter, last_position, last_velocity = pos, pos * 2.0, np.array(
            [0.05, 0.07, 0.0])
        c2d.init_barycenter, c2d.last_position, c2d.last_velocity = init_barycenter, last_position, last_velocity
        Fx, Fy, Fz = F = np.array([200., 300., 0.0])
        dt, substeps = 0.001, 50
        dt_sub = c2d.dt_sub = float(dt / substeps)
        c2d.F, c2d.substeps, c2d.dt, c2d.acceleration = F, substeps, dt, c2d.getAcceleration(
        )

        # runge-kutta calculation
        c2d.scheme = 'Runge_Kutta'
        u0 = ux0, uy0, uz0 = last_position - init_barycenter
        v0 = vx0, vy0, vz0 = last_velocity
        a0 = ax0, ay0, az0 = (F - C * v0 - K * u0) / mass
        for ii in range(substeps):
            ux, vx, ax = bd.runge_kutta(ux0, vx0, ax0, dt_sub, substeps, Fx,
                                        Kx, Cx, mass, False)
            uy, vy, ay = bd.runge_kutta(uy0, vy0, ay0, dt_sub, substeps, Fy,
                                        Ky, Cy, mass, False)
            uz, vz, az = bd.runge_kutta(uz0, vz0, az0, dt_sub, substeps, Fz,
                                        Kz, Cz, mass, False)
        h = hx, hy, hz = [ux - ux0, uy - uy0, uz - uz0]
        c2d.h = c2d.getDisplacement(dt)
        npt.assert_equal(c2d.h, h)
Ejemplo n.º 2
0
    def testOverturningModule(self):
        from proteus import Domain  
        from proteus import SpatialTools as st    
        from proteus.mprans import SpatialTools as mst
        from proteus.mprans import BodyDynamics as bd   

        # parameters
        domain2D = Domain.PlanarStraightLineGraphDomain()
        pos = np.array([1.0, 1.0, 0.0])
        dim = (0.3, 0.385)
        dt, substeps = 0.001, 20  
        caisson = mst.Rectangle(domain=domain2D, dim=dim, coords=[pos[0], pos[1]])
        caisson2D = bd.CaissonBody(shape=caisson, substeps=substeps)
        mst.assembleDomain(domain2D)      
        c2d = caisson2D
        c2d.nd = 2
        dt_sub = c2d.dt_sub = float(old_div(dt,substeps))
        Krot = 200000.
        Crot = 2000.
        c2d.Krot, c2d.Crot =  Krot, Crot
        c2d.substeps, c2d.dt, c2d.ang_acc = substeps, dt, c2d.getAngularAcceleration()
        c2d.setFriction(friction=True, m_static=0.0, m_dynamic=0.0, tolerance=0.000001, grainSize=0.02)
        rotation, last_rotation = c2d.Shape.coords_system, c2d.Shape.coords_system
        ang_vel, last_ang_vel = np.array([0., 0., 0.]), np.array([0., 0., 0.])
        F = Fx, Fy, Fz = np.array([200., -300., 0.0])
        M =  np.array([0., 0., 10.0])
        init_barycenter, last_position = pos, pos     
        c2d.F, c2d.M, c2d.init_barycenter, c2d.last_position = F, M, init_barycenter, last_position  
        eps = 10.**-30
        mass = c2d.mass = 50.0
        # moment and inertia transformations
        pivot = c2d.pivot_friction = np.array([(caisson.vertices[0][0]+caisson.vertices[1][0])*0.5, caisson.vertices[0][1], 0.0])
        barycenter = caisson.barycenter
        distance = dx, dy, dz = pivot - barycenter
        Mpivot = np.array([0., 0., dx*Fy-dy*Fx]) # Moment calculated in pivot
        Mp = M - Mpivot # Moment transformation through the new pivot
        Ix = (old_div((dim[0]**2),12.)) + dy**2
        Iy = (old_div((dim[1]**2),12.)) + dx**2
        It = Ix + Iy    
        I = It*mass
        c2d.springs = True
        # runge-kutta calculation
        c2d.scheme = 'Runge_Kutta'
        rz0, vrz0 = atan2(last_rotation[0,1], last_rotation[0,0]), last_ang_vel[2]
        arz0 = old_div((Mp[2] - Crot*vrz0 - Krot*rz0), I)
        rz, vrz, arz = bd.runge_kutta(rz0, vrz0, arz0, dt_sub, substeps, Mp[2], Krot, Crot, I, False)
        # calculation with bodydynamics mopdule
        c2d.cV_init = c2d.cV = c2d.cV_last = caisson.vertices
        c2d.inertia = c2d.getInertia(pivot=pivot)
        c2d.overturning_module(dt)    
        # test
        ang_disp = rz - rz0
        npt.assert_equal(c2d.ang_disp[2], ang_disp)
        npt.assert_equal(c2d.ang_vel[2], vrz)
        npt.assert_equal(c2d.ang_acc[2], arz)
Ejemplo n.º 3
0
    def testOverturningModule(self):
        from proteus import Domain  
        from proteus import SpatialTools as st    
        from proteus.mprans import SpatialTools as mst
        from proteus.mprans import BodyDynamics as bd   

        # parameters
        domain2D = Domain.PlanarStraightLineGraphDomain()
        pos = np.array([1.0, 1.0, 0.0])
        dim = (0.3, 0.385)
        dt, substeps = 0.001, 20  
        caisson = mst.Rectangle(domain=domain2D, dim=dim, coords=[pos[0], pos[1]])
        caisson2D = bd.CaissonBody(shape=caisson, substeps=substeps)
        mst.assembleDomain(domain2D)      
        c2d = caisson2D
        c2d.nd = 2
        dt_sub = c2d.dt_sub = float(dt/substeps)
        Krot = 200000.
        Crot = 2000.
        c2d.Krot, c2d.Crot =  Krot, Crot
        c2d.substeps, c2d.dt, c2d.ang_acc = substeps, dt, c2d.getAngularAcceleration()
        c2d.setFriction(friction=True, m_static=0.0, m_dynamic=0.0, tolerance=0.000001, grainSize=0.02)
        rotation, last_rotation = c2d.Shape.coords_system, c2d.Shape.coords_system
        ang_vel, last_ang_vel = np.array([0., 0., 0.]), np.array([0., 0., 0.])
        F = Fx, Fy, Fz = np.array([200., -300., 0.0])
        M =  np.array([0., 0., 10.0])
        init_barycenter, last_position = pos, pos     
        c2d.F, c2d.M, c2d.init_barycenter, c2d.last_position = F, M, init_barycenter, last_position  
        eps = 10.**-30
        mass = c2d.mass = 50.0
        # moment and inertia transformations
        pivot = c2d.pivot_friction = np.array([(caisson.vertices[0][0]+caisson.vertices[1][0])*0.5, caisson.vertices[0][1], 0.0])
        barycenter = caisson.barycenter
        distance = dx, dy, dz = pivot - barycenter
        Mpivot = np.array([0., 0., dx*Fy-dy*Fx]) # Moment calculated in pivot
        Mp = M - Mpivot # Moment transformation through the new pivot
        Ix = ((dim[0]**2)/12.) + dy**2
        Iy = ((dim[1]**2)/12.) + dx**2
        It = Ix + Iy    
        I = It*mass
        c2d.springs = True
        # runge-kutta calculation
        c2d.scheme = 'Runge_Kutta'
        rz0, vrz0 = atan2(last_rotation[0,1], last_rotation[0,0]), last_ang_vel[2]
        arz0 = (Mp[2] - Crot*vrz0 - Krot*rz0) / I
        rz, vrz, arz = bd.runge_kutta(rz0, vrz0, arz0, dt_sub, substeps, Mp[2], Krot, Crot, I, False)
        # calculation with bodydynamics mopdule
        c2d.cV_init = c2d.cV = c2d.cV_last = caisson.vertices
        c2d.inertia = c2d.getInertia(pivot=pivot)
        c2d.overturning_module(dt)    
        # test
        ang_disp = rz - rz0
        npt.assert_equal(c2d.ang_disp[2], ang_disp)
        npt.assert_equal(c2d.ang_vel[2], vrz)
        npt.assert_equal(c2d.ang_acc[2], arz)
Ejemplo n.º 4
0
    def testGetDisplacement(self):
        from proteus import Domain  
        from proteus import SpatialTools as st    
        from proteus.mprans import SpatialTools as mst
        from proteus.mprans import BodyDynamics as bd   

        # parameters
        domain2D = Domain.PlanarStraightLineGraphDomain()
        pos = np.array([1.0, 1.0, 0.0])
        dim = (0.3, 0.385)
        caisson = mst.Rectangle(domain=domain2D, dim=dim, coords=[pos[0], pos[1]])
        caisson2D = bd.RigidBody(shape=caisson)
        mst.assembleDomain(domain2D)      
        c2d = caisson2D
        c2d.nd = 2
        Ix = ((dim[0]**2)/12.)
        Iy = ((dim[1]**2)/12.)
        It = Ix + Iy 
        mass = 50.0
        c2d.mass, c2d.It = mass, It
        Kx, Ky, Kz = K = [200000., 250000., 0.0]
        Cx, Cy, Cz = C = [2000., 4000., 0.0]
        c2d.Kx, c2d.Ky, c2d.Kz, c2d.Cx, c2d.Cy, c2d.Cz =  Kx, Ky, Kz, Cx, Cy, Cz
        init_barycenter, last_position, last_velocity = pos, pos*2.0, np.array([0.05, 0.07, 0.0])
        c2d.init_barycenter, c2d.last_position, c2d.last_velocity = init_barycenter, last_position, last_velocity 
        Fx, Fy, Fz = F = np.array([200., 300., 0.0])
        dt, substeps = 0.001, 50  
        dt_sub = c2d.dt_sub = float(dt/substeps)
        c2d.F, c2d.substeps, c2d.dt, c2d.acceleration = F, substeps, dt, c2d.getAcceleration()

        # runge-kutta calculation
        c2d.scheme = 'Runge_Kutta'
        u0 = ux0, uy0, uz0 = last_position - init_barycenter
        v0 = vx0, vy0, vz0 = last_velocity
        a0 = ax0, ay0, az0 = (F - C*v0 - K*u0) / mass
        for ii in range(substeps):
            ux, vx, ax = bd.runge_kutta(ux0, vx0, ax0, dt_sub, substeps, Fx, Kx, Cx, mass, False)
            uy, vy, ay = bd.runge_kutta(uy0, vy0, ay0, dt_sub, substeps, Fy, Ky, Cy, mass, False)
            uz, vz, az = bd.runge_kutta(uz0, vz0, az0, dt_sub, substeps, Fz, Kz, Cz, mass, False)
        h = hx, hy, hz = [ux-ux0, uy-uy0, uz-uz0]
        c2d.h = c2d.getDisplacement(dt)
        npt.assert_equal(c2d.h, h)
Ejemplo n.º 5
0
    def testFrictionModule(self):
        from proteus import Domain  
        from proteus import SpatialTools as st    
        from proteus.mprans import SpatialTools as mst
        from proteus.mprans import BodyDynamics as bd   

        #########################
        # 1st case              #
        #########################
        # When sliding is true and caisson already experiences plastic displacements

        # parameters
        domain2D = Domain.PlanarStraightLineGraphDomain()
        pos = np.array([1.0, 1.0, 0.0])
        dim = (0.3, 0.385)
        dt, substeps = 0.001, 20  
        caisson = mst.Rectangle(domain=domain2D, dim=dim, coords=[pos[0], pos[1]])
        caisson2D = bd.CaissonBody(shape=caisson, substeps=substeps)
        mst.assembleDomain(domain2D)      
        c2d = caisson2D
        c2d.nd = 2
        dt_sub = c2d.dt_sub = float(old_div(dt,substeps))
        Ix = (old_div((dim[0]**2),12.))
        Iy = (old_div((dim[1]**2),12.))
        It = Ix + Iy 
        mass = 50.0
        c2d.mass, c2d.It = mass, It
        K = Kx, Ky, Kz = [200000., 250000., 0.0]
        C = Cx, Cy, Cz = [2000., 4000., 0.0]
        c2d.Kx, c2d.Ky, c2d.Kz, c2d.Cx, c2d.Cy, c2d.Cz =  Kx, Ky, Kz, Cx, Cy, Cz
        c2d.substeps, c2d.dt, c2d.acceleration = substeps, dt, c2d.getAcceleration()
        m_static, m_dynamic = 0.6, 0.4
        c2d.setFriction(friction=True, m_static=m_static, m_dynamic=m_dynamic, tolerance=0.000001, grainSize=0.02)
        # sliding == True. dynamic sign and dynamic friction
        F = Fx, Fy, Fz = np.array([200., -300., 0.0])
        disp = np.array([0.001, 0.001, 0.0])
        init_barycenter, last_position, last_velocity = pos, pos+disp, np.array([0.05, 0.07, 0.0])
        c2d.last_uxEl = pos[0]+disp[0]-init_barycenter[0]           
        c2d.F, c2d.init_barycenter, c2d.last_position, c2d.last_velocity = F, init_barycenter, last_position, last_velocity  
        eps = 10.**-30
        sign_static, sign_dynamic = old_div(Fx,abs(Fx+eps)), old_div(last_velocity[0],abs(last_velocity[0]+eps))
        c2d.sliding, sign, m = True, sign_dynamic, m_dynamic
        # vertical calculation and frictional force        
        uy0, vy0 = (last_position[1] - init_barycenter[1]), last_velocity[1]
        ay0 = old_div((Fy - Cy*vy0 - Ky*uy0), mass)
        uy, vy, ay = bd.runge_kutta(uy0, vy0, ay0, dt_sub, substeps, Fy, Ky, Cy, mass, False)
        Rx = -Kx*(last_position[0]-init_barycenter[0])
        Ry = -Ky*uy
        Ftan = -sign*abs(Ry)*m
        if Ftan == 0.0: 
            Ftan = -sign*abs(Fy)*m
        # runge-kutta calculation
        c2d.scheme = 'Runge_Kutta'
        ux0, uz0 = last_position[0] - init_barycenter[0], last_position[2] - init_barycenter[2]
        vx0, vz0 = last_velocity[0], last_velocity[2]
        Fh = Fx+Ftan
        Kx, Cx = 0.0, 0.0
        ax0, az0 = old_div((Fh - Cx*vx0 - Kx*ux0), mass) , old_div((Fz - Cz*vz0 - Kz*uz0), mass)
        ux, vx, ax = bd.runge_kutta(ux0, vx0, ax0, dt_sub, substeps, Fh, Kx, Cx, mass, True)
        uz, vz, az = bd.runge_kutta(uz0, vz0, az0, dt_sub, substeps, Fz, Kz, Cz, mass, False)
        # bodydynamics calculation
        c2d.friction_module(dt) 
        # tests
        npt.assert_equal(c2d.ux, ux)
        EL1, PL1 = 0.0, 1.0 # elastic and plastic motion parameters
        npt.assert_equal(c2d.EL, EL1)
        npt.assert_equal(c2d.PL, PL1)
         

        #########################
        # 2nd case              #
        #########################
        # When sliding is false but the caisson starts to experience sliding motion

        # parameters
        domain2D = Domain.PlanarStraightLineGraphDomain()
        pos = np.array([1.0, 1.0, 0.0])
        dim = (0.3, 0.385)
        dt, substeps = 0.001, 20  
        caisson = mst.Rectangle(domain=domain2D, dim=dim, coords=[pos[0], pos[1]])
        caisson2D = bd.CaissonBody(shape=caisson, substeps=substeps)
        mst.assembleDomain(domain2D)      
        c2d = caisson2D
        c2d.nd = 2
        dt_sub = c2d.dt_sub = float(old_div(dt,substeps))
        Ix = (old_div((dim[0]**2),12.))
        Iy = (old_div((dim[1]**2),12.))
        It = Ix + Iy 
        mass = 50.0
        c2d.mass, c2d.It = mass, It
        K = Kx, Ky, Kz = [200000., 250000., 0.0]
        C = Cx, Cy, Cz = [2000., 4000., 0.0]
        c2d.Kx, c2d.Ky, c2d.Kz, c2d.Cx, c2d.Cy, c2d.Cz =  Kx, Ky, Kz, Cx, Cy, Cz
        c2d.substeps, c2d.dt, c2d.acceleration = substeps, dt, c2d.getAcceleration()
        m_static, m_dynamic = 0.6, 0.4
        c2d.setFriction(friction=True, m_static=m_static, m_dynamic=m_dynamic, tolerance=0.000001, grainSize=0.02)
        # sliding == False. static sign and static friction
        F = Fx, Fy, Fz = np.array([200., -300., 0.0])
        disp = np.array([0.001, 0.001, 0.0])
        init_barycenter, last_position, last_velocity = pos, pos+disp, np.array([0.05, 0.07, 0.0])
        c2d.last_uxEl = pos[0]+disp[0]-init_barycenter[0]           
        c2d.F, c2d.init_barycenter, c2d.last_position, c2d.last_velocity = F, init_barycenter, last_position, last_velocity  
        eps = 10.**-30
        sign_static, sign_dynamic = old_div(Fx,abs(Fx+eps)), old_div(last_velocity[0],abs(last_velocity[0]+eps))
        c2d.sliding, sign, m = False, sign_static, m_static
        # vertical calculation and frictional force        
        uy0, vy0 = (last_position[1] - init_barycenter[1]), last_velocity[1]
        ay0 = old_div((Fy - Cy*vy0 - Ky*uy0), mass)
        uy, vy, ay = bd.runge_kutta(uy0, vy0, ay0, dt_sub, substeps, Fy, Ky, Cy, mass, False)
        Rx = -Kx*(last_position[0]-init_barycenter[0])
        Ry = -Ky*uy
        Ftan = -sign*abs(Ry)*m
        if Ftan == 0.0: 
            Ftan = -sign*abs(Fy)*m
        # runge-kutta calculation
        c2d.scheme = 'Runge_Kutta'
        ux0, uz0 = last_position[0] - init_barycenter[0], last_position[2] - init_barycenter[2]
        vx0, vz0 = last_velocity[0], last_velocity[2]
        Fh = Fx+Ftan
        Kx, Cx = 0.0, 0.0
        ax0, az0 = old_div((Fh - Cx*vx0 - Kx*ux0), mass) , old_div((Fz - Cz*vz0 - Kz*uz0), mass)
        ux, vx, ax = bd.runge_kutta(ux0, vx0, ax0, dt_sub, substeps, Fh, Kx, Cx, mass, True)
        uz, vz, az = bd.runge_kutta(uz0, vz0, az0, dt_sub, substeps, Fz, Kz, Cz, mass, False)
        # bodydynamics calculation
        c2d.friction_module(dt)
        # tests
        npt.assert_equal(c2d.ux, ux)
        EL1, PL1 = 0.0, 1.0 # elastic and plastic motion parameters
        npt.assert_equal(c2d.EL, EL1)
        npt.assert_equal(c2d.PL, PL1)
         

        #########################
        # 3rd case              #
        #########################
        # When caisson experiences vibration motion

        # parameters
        domain2D = Domain.PlanarStraightLineGraphDomain()
        pos = np.array([1.0, 1.0, 0.0])
        dim = (0.3, 0.385)
        dt, substeps = 0.001, 20  
        caisson = mst.Rectangle(domain=domain2D, dim=dim, coords=[pos[0], pos[1]])
        caisson2D = bd.CaissonBody(shape=caisson, substeps=substeps)
        mst.assembleDomain(domain2D)      
        c2d = caisson2D
        c2d.nd = 2
        dt_sub = c2d.dt_sub = float(old_div(dt,substeps))
        Ix = (old_div((dim[0]**2),12.))
        Iy = (old_div((dim[1]**2),12.))
        It = Ix + Iy 
        mass = 50.0
        c2d.mass, c2d.It = mass, It
        K = Kx, Ky, Kz = [200000., 250000., 0.0]
        C = Cx, Cy, Cz = [2000., 4000., 0.0]
        c2d.Kx, c2d.Ky, c2d.Kz, c2d.Cx, c2d.Cy, c2d.Cz =  Kx, Ky, Kz, Cx, Cy, Cz
        c2d.substeps, c2d.dt, c2d.acceleration = substeps, dt, c2d.getAcceleration()
        m_static, m_dynamic = 0.6, 0.4
        c2d.setFriction(friction=True, m_static=m_static, m_dynamic=m_dynamic, tolerance=0.000001, grainSize=0.02)
        # sliding == False. static sign and static friction. Kx and Cx different from 0!
        F = Fx, Fy, Fz = np.array([200., -300., 0.0])
        disp = np.array([0.00001, 0.00001, 0.0])
        init_barycenter, last_position, last_velocity = pos, pos+disp, np.array([0.05, 0.07, 0.0])
        c2d.last_uxEl = pos[0]+disp[0]-init_barycenter[0]           
        c2d.F, c2d.init_barycenter, c2d.last_position, c2d.last_velocity = F, init_barycenter, last_position, last_velocity  
        eps = 10.**-30
        sign_static, sign_dynamic = old_div(Fx,abs(Fx+eps)), old_div(last_velocity[0],abs(last_velocity[0]+eps))
        c2d.sliding, sign, m = False, sign_static, m_static
        # vertical calculation and frictional force        
        uy0, vy0 = (last_position[1] - init_barycenter[1]), last_velocity[1]
        ay0 = old_div((Fy - Cy*vy0 - Ky*uy0), mass)
        uy, vy, ay = bd.runge_kutta(uy0, vy0, ay0, dt_sub, substeps, Fy, Ky, Cy, mass, False)
        Rx = -Kx*(last_position[0]-init_barycenter[0])
        Ry = -Ky*uy
        Ftan = -sign*abs(Ry)*m
        if Ftan == 0.0: 
            Ftan = -sign*abs(Fy)*m
        # runge-kutta calculation
        c2d.scheme = 'Runge_Kutta'
        ux0, uz0 = last_position[0] - init_barycenter[0], last_position[2] - init_barycenter[2]
        vx0, vz0 = last_velocity[0], last_velocity[2]
        Fh = Fx        
        ax0, az0 = old_div((Fh - Cx*vx0 - Kx*ux0), mass) , old_div((Fz - Cz*vz0 - Kz*uz0), mass)
        ux, vx, ax = bd.runge_kutta(ux0, vx0, ax0, dt_sub, substeps, Fh, Kx, Cx, mass, True)
        uz, vz, az = bd.runge_kutta(uz0, vz0, az0, dt_sub, substeps, Fz, Kz, Cz, mass, False)
        # bodydynamics calculation
        c2d.friction_module(dt)
        # tests
        npt.assert_equal(c2d.ux, ux)
        EL1, PL1 = 1.0, 0.0 # elastic and plastic motion parameters
        npt.assert_equal(c2d.EL, EL1)
        npt.assert_equal(c2d.PL, PL1)
Ejemplo n.º 6
0
    def testFrictionModule(self):
        from proteus import Domain  
        from proteus import SpatialTools as st    
        from proteus.mprans import SpatialTools as mst
        from proteus.mprans import BodyDynamics as bd   

        #########################
        # 1st case              #
        #########################
        # When sliding is true and caisson already experiences plastic displacements

        # parameters
        domain2D = Domain.PlanarStraightLineGraphDomain()
        pos = np.array([1.0, 1.0, 0.0])
        dim = (0.3, 0.385)
        dt, substeps = 0.001, 20  
        caisson = mst.Rectangle(domain=domain2D, dim=dim, coords=[pos[0], pos[1]])
        caisson2D = bd.CaissonBody(shape=caisson, substeps=substeps)
        mst.assembleDomain(domain2D)      
        c2d = caisson2D
        c2d.nd = 2
        dt_sub = c2d.dt_sub = float(dt/substeps)
        Ix = ((dim[0]**2)/12.)
        Iy = ((dim[1]**2)/12.)
        It = Ix + Iy 
        mass = 50.0
        c2d.mass, c2d.It = mass, It
        K = Kx, Ky, Kz = [200000., 250000., 0.0]
        C = Cx, Cy, Cz = [2000., 4000., 0.0]
        c2d.Kx, c2d.Ky, c2d.Kz, c2d.Cx, c2d.Cy, c2d.Cz =  Kx, Ky, Kz, Cx, Cy, Cz
        c2d.substeps, c2d.dt, c2d.acceleration = substeps, dt, c2d.getAcceleration()
        m_static, m_dynamic = 0.6, 0.4
        c2d.setFriction(friction=True, m_static=m_static, m_dynamic=m_dynamic, tolerance=0.000001, grainSize=0.02)
        # sliding == True. dynamic sign and dynamic friction
        F = Fx, Fy, Fz = np.array([200., -300., 0.0])
        disp = np.array([0.001, 0.001, 0.0])
        init_barycenter, last_position, last_velocity = pos, pos+disp, np.array([0.05, 0.07, 0.0])
        c2d.last_uxEl = pos[0]+disp[0]-init_barycenter[0]           
        c2d.F, c2d.init_barycenter, c2d.last_position, c2d.last_velocity = F, init_barycenter, last_position, last_velocity  
        eps = 10.**-30
        sign_static, sign_dynamic = Fx/abs(Fx+eps), last_velocity[0]/abs(last_velocity[0]+eps)
        c2d.sliding, sign, m = True, sign_dynamic, m_dynamic
        # vertical calculation and frictional force        
        uy0, vy0 = (last_position[1] - init_barycenter[1]), last_velocity[1]
        ay0 = (Fy - Cy*vy0 - Ky*uy0) / mass
        uy, vy, ay = bd.runge_kutta(uy0, vy0, ay0, dt_sub, substeps, Fy, Ky, Cy, mass, False)
        Rx = -Kx*(last_position[0]-init_barycenter[0])
        Ry = -Ky*uy
        Ftan = -sign*abs(Ry)*m
        if Ftan == 0.0: 
            Ftan = -sign*abs(Fy)*m
        # runge-kutta calculation
        c2d.scheme = 'Runge_Kutta'
        ux0, uz0 = last_position[0] - init_barycenter[0], last_position[2] - init_barycenter[2]
        vx0, vz0 = last_velocity[0], last_velocity[2]
        Fh = Fx+Ftan
        Kx, Cx = 0.0, 0.0
        ax0, az0 = (Fh - Cx*vx0 - Kx*ux0) / mass , (Fz - Cz*vz0 - Kz*uz0) / mass
        ux, vx, ax = bd.runge_kutta(ux0, vx0, ax0, dt_sub, substeps, Fh, Kx, Cx, mass, True)
        uz, vz, az = bd.runge_kutta(uz0, vz0, az0, dt_sub, substeps, Fz, Kz, Cz, mass, False)
        # bodydynamics calculation
        c2d.friction_module(dt) 
        # tests
        npt.assert_equal(c2d.ux, ux)
        EL1, PL1 = 0.0, 1.0 # elastic and plastic motion parameters
        npt.assert_equal(c2d.EL, EL1)
        npt.assert_equal(c2d.PL, PL1)
         

        #########################
        # 2nd case              #
        #########################
        # When sliding is false but the caisson starts to experience sliding motion

        # parameters
        domain2D = Domain.PlanarStraightLineGraphDomain()
        pos = np.array([1.0, 1.0, 0.0])
        dim = (0.3, 0.385)
        dt, substeps = 0.001, 20  
        caisson = mst.Rectangle(domain=domain2D, dim=dim, coords=[pos[0], pos[1]])
        caisson2D = bd.CaissonBody(shape=caisson, substeps=substeps)
        mst.assembleDomain(domain2D)      
        c2d = caisson2D
        c2d.nd = 2
        dt_sub = c2d.dt_sub = float(dt/substeps)
        Ix = ((dim[0]**2)/12.)
        Iy = ((dim[1]**2)/12.)
        It = Ix + Iy 
        mass = 50.0
        c2d.mass, c2d.It = mass, It
        K = Kx, Ky, Kz = [200000., 250000., 0.0]
        C = Cx, Cy, Cz = [2000., 4000., 0.0]
        c2d.Kx, c2d.Ky, c2d.Kz, c2d.Cx, c2d.Cy, c2d.Cz =  Kx, Ky, Kz, Cx, Cy, Cz
        c2d.substeps, c2d.dt, c2d.acceleration = substeps, dt, c2d.getAcceleration()
        m_static, m_dynamic = 0.6, 0.4
        c2d.setFriction(friction=True, m_static=m_static, m_dynamic=m_dynamic, tolerance=0.000001, grainSize=0.02)
        # sliding == False. static sign and static friction
        F = Fx, Fy, Fz = np.array([200., -300., 0.0])
        disp = np.array([0.001, 0.001, 0.0])
        init_barycenter, last_position, last_velocity = pos, pos+disp, np.array([0.05, 0.07, 0.0])
        c2d.last_uxEl = pos[0]+disp[0]-init_barycenter[0]           
        c2d.F, c2d.init_barycenter, c2d.last_position, c2d.last_velocity = F, init_barycenter, last_position, last_velocity  
        eps = 10.**-30
        sign_static, sign_dynamic = Fx/abs(Fx+eps), last_velocity[0]/abs(last_velocity[0]+eps)
        c2d.sliding, sign, m = False, sign_static, m_static
        # vertical calculation and frictional force        
        uy0, vy0 = (last_position[1] - init_barycenter[1]), last_velocity[1]
        ay0 = (Fy - Cy*vy0 - Ky*uy0) / mass
        uy, vy, ay = bd.runge_kutta(uy0, vy0, ay0, dt_sub, substeps, Fy, Ky, Cy, mass, False)
        Rx = -Kx*(last_position[0]-init_barycenter[0])
        Ry = -Ky*uy
        Ftan = -sign*abs(Ry)*m
        if Ftan == 0.0: 
            Ftan = -sign*abs(Fy)*m
        # runge-kutta calculation
        c2d.scheme = 'Runge_Kutta'
        ux0, uz0 = last_position[0] - init_barycenter[0], last_position[2] - init_barycenter[2]
        vx0, vz0 = last_velocity[0], last_velocity[2]
        Fh = Fx+Ftan
        Kx, Cx = 0.0, 0.0
        ax0, az0 = (Fh - Cx*vx0 - Kx*ux0) / mass , (Fz - Cz*vz0 - Kz*uz0) / mass
        ux, vx, ax = bd.runge_kutta(ux0, vx0, ax0, dt_sub, substeps, Fh, Kx, Cx, mass, True)
        uz, vz, az = bd.runge_kutta(uz0, vz0, az0, dt_sub, substeps, Fz, Kz, Cz, mass, False)
        # bodydynamics calculation
        c2d.friction_module(dt)
        # tests
        npt.assert_equal(c2d.ux, ux)
        EL1, PL1 = 0.0, 1.0 # elastic and plastic motion parameters
        npt.assert_equal(c2d.EL, EL1)
        npt.assert_equal(c2d.PL, PL1)
         

        #########################
        # 3rd case              #
        #########################
        # When caisson experiences vibration motion

        # parameters
        domain2D = Domain.PlanarStraightLineGraphDomain()
        pos = np.array([1.0, 1.0, 0.0])
        dim = (0.3, 0.385)
        dt, substeps = 0.001, 20  
        caisson = mst.Rectangle(domain=domain2D, dim=dim, coords=[pos[0], pos[1]])
        caisson2D = bd.CaissonBody(shape=caisson, substeps=substeps)
        mst.assembleDomain(domain2D)      
        c2d = caisson2D
        c2d.nd = 2
        dt_sub = c2d.dt_sub = float(dt/substeps)
        Ix = ((dim[0]**2)/12.)
        Iy = ((dim[1]**2)/12.)
        It = Ix + Iy 
        mass = 50.0
        c2d.mass, c2d.It = mass, It
        K = Kx, Ky, Kz = [200000., 250000., 0.0]
        C = Cx, Cy, Cz = [2000., 4000., 0.0]
        c2d.Kx, c2d.Ky, c2d.Kz, c2d.Cx, c2d.Cy, c2d.Cz =  Kx, Ky, Kz, Cx, Cy, Cz
        c2d.substeps, c2d.dt, c2d.acceleration = substeps, dt, c2d.getAcceleration()
        m_static, m_dynamic = 0.6, 0.4
        c2d.setFriction(friction=True, m_static=m_static, m_dynamic=m_dynamic, tolerance=0.000001, grainSize=0.02)
        # sliding == False. static sign and static friction. Kx and Cx different from 0!
        F = Fx, Fy, Fz = np.array([200., -300., 0.0])
        disp = np.array([0.00001, 0.00001, 0.0])
        init_barycenter, last_position, last_velocity = pos, pos+disp, np.array([0.05, 0.07, 0.0])
        c2d.last_uxEl = pos[0]+disp[0]-init_barycenter[0]           
        c2d.F, c2d.init_barycenter, c2d.last_position, c2d.last_velocity = F, init_barycenter, last_position, last_velocity  
        eps = 10.**-30
        sign_static, sign_dynamic = Fx/abs(Fx+eps), last_velocity[0]/abs(last_velocity[0]+eps)
        c2d.sliding, sign, m = False, sign_static, m_static
        # vertical calculation and frictional force        
        uy0, vy0 = (last_position[1] - init_barycenter[1]), last_velocity[1]
        ay0 = (Fy - Cy*vy0 - Ky*uy0) / mass
        uy, vy, ay = bd.runge_kutta(uy0, vy0, ay0, dt_sub, substeps, Fy, Ky, Cy, mass, False)
        Rx = -Kx*(last_position[0]-init_barycenter[0])
        Ry = -Ky*uy
        Ftan = -sign*abs(Ry)*m
        if Ftan == 0.0: 
            Ftan = -sign*abs(Fy)*m
        # runge-kutta calculation
        c2d.scheme = 'Runge_Kutta'
        ux0, uz0 = last_position[0] - init_barycenter[0], last_position[2] - init_barycenter[2]
        vx0, vz0 = last_velocity[0], last_velocity[2]
        Fh = Fx        
        ax0, az0 = (Fh - Cx*vx0 - Kx*ux0) / mass , (Fz - Cz*vz0 - Kz*uz0) / mass
        ux, vx, ax = bd.runge_kutta(ux0, vx0, ax0, dt_sub, substeps, Fh, Kx, Cx, mass, True)
        uz, vz, az = bd.runge_kutta(uz0, vz0, az0, dt_sub, substeps, Fz, Kz, Cz, mass, False)
        # bodydynamics calculation
        c2d.friction_module(dt)
        # tests
        npt.assert_equal(c2d.ux, ux)
        EL1, PL1 = 1.0, 0.0 # elastic and plastic motion parameters
        npt.assert_equal(c2d.EL, EL1)
        npt.assert_equal(c2d.PL, PL1)