Ejemplo n.º 1
0
def getWave2DMatrix(N, h, bc_hor, bc_ver):
    Dx_u, Dz_u = get2DMatrix(N, h, bc_hor[0], bc_ver[0])
    Dx_w, Dz_w = get2DMatrix(N, h, bc_hor[1], bc_ver[1])
    Dx_p, Dz_p = get2DMatrix(N, h, bc_hor[2], bc_ver[2])

    Id_N = sp.eye(N[0] * N[1])

    Zero = np.zeros((N[0] * N[1], N[0] * N[1]))
    M1 = sp.hstack((Zero, Zero, Dx_p), format="csr")
    M2 = sp.hstack((Zero, Zero, Dz_p), format="csr")
    M3 = sp.hstack((Dx_u, Dz_w, Zero), format="csr")
    M = sp.vstack((M1, M2, M3), format="csr")

    Id = sp.eye(3 * N[0] * N[1])

    return sp.csc_matrix(Id), sp.csc_matrix(M)
Ejemplo n.º 2
0
def getWave2DMatrix(N, h, bc_hor, bc_ver):
  Dx_u, Dz_u = get2DMatrix(N, h, bc_hor[0], bc_ver[0])
  Dx_w, Dz_w = get2DMatrix(N, h, bc_hor[1], bc_ver[1])
  Dx_p, Dz_p = get2DMatrix(N, h, bc_hor[2], bc_ver[2])

  Id_N = sp.eye(N[0]*N[1])

  Zero = np.zeros((N[0]*N[1],N[0]*N[1]))
  M1 = sp.hstack((Zero, Zero, Dx_p), format="csr")
  M2 = sp.hstack((Zero, Zero, Dz_p), format="csr")
  M3 = sp.hstack((Dx_u, Dz_w, Zero), format="csr")
  M  = sp.vstack((M1,M2,M3), format="csr")

  Id = sp.eye(3*N[0]*N[1])

  return sp.csc_matrix(Id), sp.csc_matrix(M)
Ejemplo n.º 3
0
def getBoussinesq2DMatrix(N, h, bc_hor, bc_ver, c_s, Nfreq, order):
  Dx_u, Dz_u = get2DMatrix(N, h, bc_hor[0], bc_ver[0])
  Dx_w, Dz_w = get2DMatrix(N, h, bc_hor[1], bc_ver[1])
  Dx_b, Dz_b = get2DMatrix(N, h, bc_hor[2], bc_ver[2])
  Dx_p, Dz_p = get2DMatrix(N, h, bc_hor[3], bc_ver[3])
  Id_N = sp.eye(N[0]*N[1])

  Zero = np.zeros((N[0]*N[1],N[0]*N[1]))
  Id_w = sp.eye(N[0]*N[1])

  # Note: Bring all terms to right hand side, therefore a couple of minus signs
  # are needed

  M1 = sp.hstack((        Zero,          Zero,  Zero, -Dx_p), format="csr")
  M2 = sp.hstack((        Zero,          Zero,  Id_w, -Dz_p), format="csr")
  M3 = sp.hstack((        Zero, -Nfreq**2*Id_w,  Zero, Zero), format="csr")
  M4 = sp.hstack((-c_s**2*Dx_u,   -c_s**2*Dz_w,  Zero, Zero), format="csr")
  M  = sp.vstack((M1,M2,M3,M4), format="csr")

  Id = sp.eye(4*N[0]*N[1])

  return sp.csc_matrix(Id), sp.csc_matrix(M)