Пример #1
0
def slip_vec(x,coeff,strike,dip,seg):
  s1 = basis.slip(x,coeff[:,0],segment=seg)
  s2 = basis.slip(x,coeff[:,1],segment=seg)
  vec = np.array([s1,s2,0*s2]).transpose()
  argz = np.pi/2.0 - np.pi*strike/180
  argx = np.pi/180.0*dip
  T = trans.point_rotation_x(argx)
  T += trans.point_rotation_z(argz)
  vec = T(vec)
  return vec
Пример #2
0
def slip_mag(x,coeff,seg):
  rightlateral = basis.slip(x,coeff[:,0],segment=seg)
  thrust = basis.slip(x,coeff[:,1],segment=seg)
  return np.sqrt(rightlateral**2 + thrust**2)
Пример #3
0
def _create_formatted_regularization(params, p, slip_model="stochastic"):
    f = {}
    order = params["slip_regularization_order"]
    if order == 0:
        N = p["Ns"]
        slip_reg = params["slip_regularization"] * np.eye(N)

    elif order == 2:
        import basis

        M = basis.FAULT_SEGMENTS
        N = basis.FAULT_N
        slip_reg = np.zeros((0, N))
        for m in range(M):
            col_x = np.unique(basis.FAULT_KNOTS[m][0])
            col_x = reg_points(col_x)
            # col_x = midspace(0,1,basis.FAULT_NLENGTH[m])
            col_y = np.unique(basis.FAULT_KNOTS[m][1])
            col_y = reg_points(col_y)
            # col_y = midspace(-1,0,basis.FAULT_NWIDTH[m])
            xgrid, ygrid = np.meshgrid(col_x, col_y)
            xflat = xgrid.flatten()
            yflat = ygrid.flatten()
            zflat = 0 * yflat
            col_m = np.array([xflat, yflat, zflat]).transpose()
            col_m = basis.FAULT_TRANSFORMS[m](col_m)

            slip_reg_m = np.zeros((len(col_m), N))
            for ni, n in enumerate(Perturb(np.zeros(N), 1.0)):
                slip_reg_m[:, ni] = basis.slip(col_m, n, segment=m, diff=(2, 0)) + basis.slip(
                    col_m, n, segment=m, diff=(0, 2)
                )
            # slip_reg_m2 = np.zeros((len(col_m),N))
            # for ni,n in enumerate(Perturb(np.zeros(N),1.0)):
            #  slip_reg_m2[:,ni] = basis.slip(col_m,n,segment=m,diff=(0,2))

            # slip_reg_m = np.vstack((slip_reg_m1,slip_reg_m2))
            slip_reg = np.vstack((slip_reg, slip_reg_m))

        slip_reg = np.concatenate((slip_reg[..., None], slip_reg[..., None]), axis=-1)
        slip_reg /= np.max(np.max(np.abs(slip_reg)))
        slip_reg *= params["slip_regularization"]

    else:
        print("invalid slip order")

    if slip_model == "parameterized":
        slip_reg = np.repeat(slip_reg[None, ...], p["Nt"], axis=0)
        slip_reg = np.repeat(slip_reg[..., None], p["Ds"], axis=-1)

    if slip_model == "stochastic":
        slip_reg = np.repeat(slip_reg[..., None], p["Ds"], axis=-1)

    f["slip"] = slip_reg

    order = params["fluidity_regularization_order"]
    if order == 0:
        N = p["Nv"]
        fluidity_reg = params["fluidity_regularization"] * np.eye(N)

    elif order == 2:
        import basis

        N = basis.FLUIDITY_N
        fluidity_reg = np.zeros((0, basis.FLUIDITY_N))
        col_x = np.unique(basis.FLUIDITY_KNOTS[0])
        col_x = reg_points(col_x)
        col_y = np.unique(basis.FLUIDITY_KNOTS[1])
        col_y = reg_points(col_y)
        col_z = np.unique(basis.FLUIDITY_KNOTS[2])
        col_z = reg_points(col_z)
        xgrid, ygrid, zgrid = np.meshgrid(col_x, col_y, col_z)
        xflat = xgrid.flatten()
        yflat = ygrid.flatten()
        zflat = zgrid.flatten()
        col_m = np.array([xflat, yflat, zflat]).transpose()
        col_m = basis.FLUIDITY_TRANSFORM(col_m)
        fluidity_reg = np.zeros((len(col_m), N))
        for ni, n in enumerate(Perturb(np.zeros(N), 1.0)):
            fluidity_reg[:, ni] = basis.fluidity(col_m, n, diff=(0, 0, 2))

        fluidity_reg /= np.max(np.max(np.abs(fluidity_reg)))
        fluidity_reg *= params["fluidity_regularization"]
    else:
        print("invalid fluidity order")

    f["fluidity"] = fluidity_reg

    return f