Exemplo n.º 1
0
Arquivo: sem.py Projeto: maxhutch/sem
def dhat(x):
  """ Compute the interpolatory derivative matrix D_ij associated  with nodes x_j such that
                ^
            w = D*u   
            -     -
     returns the derivative of u at the points x_i.
  """
  from sem import fd_weights_full
  import numpy as np
  n1 = x.shape[0]
  w = np.zeros((n1,2), dtype=np.float64)
  Dh = np.zeros((n1,n1), dtype=np.float64);

  for i in range(n1):
    w = fd_weights_full(x[i],x,1)
    Dh[:,i] = w[:,1]

  Dh = np.transpose(Dh)
  return Dh
Exemplo n.º 2
0
def dhat(x):
    """ Compute the interpolatory derivative matrix D_ij associated  with nodes x_j such that
                ^
            w = D*u   
            -     -
     returns the derivative of u at the points x_i.
  """
    from sem import fd_weights_full
    import numpy as np
    n1 = x.shape[0]
    w = np.zeros((n1, 2), dtype=np.float64)
    Dh = np.zeros((n1, n1), dtype=np.float64)

    for i in range(n1):
        w = fd_weights_full(x[i], x, 1)
        Dh[:, i] = w[:, 1]

    Dh = np.transpose(Dh)
    return Dh
Exemplo n.º 3
0
Arquivo: sem.py Projeto: maxhutch/sem
def interp_mat(x, y, order = 0):
  """ Compute the interpolatory derivative matrix P_ij associated with nodes x_j such that
                ^
            w = D*u   
            -     -
     returns the order-th derivative of u at the points y_i.
  """
  from sem import fd_weights_full
  import numpy as np
  n1 = x.shape[0]
  n2 = y.shape[0]
  w = np.zeros((n1,order+1))
  Ph = np.zeros((n1,n2));

  for i in range(n2):
    w = fd_weights_full(y[i],x,order)
    Ph[:,i] = w[:,order]

  Ph = np.transpose(Ph)
  return Ph
Exemplo n.º 4
0
def interp_mat(x, y, order=0):
    """ Compute the interpolatory derivative matrix P_ij associated with nodes x_j such that
                ^
            w = D*u   
            -     -
     returns the order-th derivative of u at the points y_i.
  """
    from sem import fd_weights_full
    import numpy as np
    n1 = x.shape[0]
    n2 = y.shape[0]
    w = np.zeros((n1, order + 1))
    Ph = np.zeros((n1, n2))

    for i in range(n2):
        w = fd_weights_full(y[i], x, order)
        Ph[:, i] = w[:, order]

    Ph = np.transpose(Ph)
    return Ph