(mesh.height / mesh.km) - surf_height)

p.set_block_lx((0, 0, 0), (block010_length, block000_height))
p.set_block_lx((1, 0, 0), (block110_length, block100_height))
p.set_block_lx((0, 1, 0), (block010_length, block010_height))
p.set_block_lx((1, 1, 0), (block110_length, block110_height))

# set block boundary conditions
p.set_bounds((0, 0, 0), ['absorbing', 'none', 'absorbing', 'none'])
p.set_bounds((1, 0, 0), ['none', 'absorbing', 'absorbing', 'none'])
p.set_bounds((0, 1, 0), ['absorbing', 'none', 'none', 'free'])
p.set_bounds((1, 1, 0), ['none', 'absorbing', 'none', 'free'])

# ========== set block surface ===============
# top left surface 010
surf1 = fdfault.curve(nx1, 'y', x1, y1)
p.set_block_surf((0, 1, 0), 3, surf1)

plt.plot(x1, y1 - 70, 'b-')

# # top right surface 110
surf2 = fdfault.curve(nx2, 'y', x2, y2)
p.set_block_surf((1, 1, 0), 3, surf2)

plt.plot(x2, y2 - 70, 'b-')

# fault surface
xcord = x1[-1]  # fault bottom x coordinate
ycord = y1[-1]  # fault bottom y coordinate

x_fault = np.linspace(block010_length, xcord, nby1)
Пример #2
0
def create_problem(arg, name="rough_example", outname="ufault", refine=1):
    """
    Create demo problem

    Inputs:
    Required:
    arg = 1d array of length 3 holding simulation inputs
          (shear/normal stress, normal stress, ratio of out of plane to in plane normal component)
    Optional:
    name = problem name (string)
    outname = name of output file (string)
    refine = simulation refinement (default is 1, which should be fine for this)

    Outputs:
    None

    Note: function will fail if the stress on any point of the fault exceeds the strength. Should
    (probably) not occur for the parameter range specified in the demo, but in here for safety purposes.
    """

    assert len(arg) == 3

    syy, ston, sxtosy = arg

    p = fdfault.problem(name)

    # set rk and fd order

    p.set_rkorder(4)
    p.set_sbporder(4)

    # set problem info

    nt = 800*refine + 1
    nx = 400*refine + 1
    ny = 150*refine + 1
    lx = 32.
    ly = 12.

    p.set_nt(nt)
    p.set_cfl(0.3)
    p.set_ninfo((nt-1)//4)

    # set number of blocks and coordinate information

    p.set_nblocks((1,2,1))
    p.set_nx_block(([nx], [ny, ny], [1]))

    # set block dimensions

    p.set_block_lx((0,0,0),(lx, ly))
    p.set_block_lx((0,1,0),(lx, ly))

    # set block boundary conditions

    p.set_bounds((0,0,0),['absorbing', 'absorbing', 'absorbing', 'none'])
    p.set_bounds((0,1,0),['absorbing', 'absorbing', 'none', 'absorbing'])

    # set block surface

    sxx = sxtosy*syy
    sxy = -syy*ston

    x = np.linspace(0., lx, nx)
    y = ly*np.ones(nx)+generate_profile(nx, lx, 1.e-2, 20, 1., 18749)

    surf = fdfault.curve(nx, 'y', x, y)

    # set initial fields

    norm_x, norm_y = generate_normals_2d(x, y, 'y')
    sn = np.zeros(nx)
    st = np.zeros(nx)

    for i in range(nx):
        sn[i], st[i] = rotate_xy2nt_2d(sxx, sxy, syy, (norm_x[i], norm_y[i]), 'y')

    assert np.all(st+0.7*sn < 0.), "shear stress is too high"

    p.set_block_surf((0,0,0), 3, surf)
    p.set_block_surf((0,1,0), 2, surf)

    p.set_stress((sxx, sxy, 0., syy, 0., 0.))

    # set interface type

    p.set_iftype(0,'slipweak')

    # set slip weakening parameters

    p.add_pert(fdfault.swparam('constant', dc = 0.8, mus = 0.7, mud = 0.2),0)
    p.add_pert(fdfault.swparam('boxcar', x0 = 2., dx = 2., mus = 10000.),0)
    p.add_pert(fdfault.swparam('boxcar', x0 = 30., dx = 2., mus = 10000.),0)

    # add load perturbation

    nuc_pert = np.zeros((nx, 1))
    idx = (np.abs(x - lx/2.) < 2.)
    nuc_pert[idx, 0] = (-0.7*sn[idx]-st[idx])+0.1

    p.set_loadfile(0, fdfault.loadfile(nx, 1, np.zeros((nx, 1)), nuc_pert, np.zeros((nx, 1))))

    # add output unit

    outname = "ufault"

    p.add_output(fdfault.output(outname,'U', nt, nt, 1, 0, nx - 1, 1, ny, ny, 1, 0, 0, 1))

    p.write_input(directory=join(fdfault_path,"problems"))
p.set_nblocks((2,1,1))
p.set_nx_block(([nx1, nx2], [nby0], [1]))

# set block dimensions
p.set_block_lx((0,0,0),(block000_length, surf_height))
p.set_block_lx((1,0,0),(block100_length, surf_height))


# set block boundary conditions
p.set_bounds((0,0,0),['absorbing', 'none', 'absorbing', 'free'])
p.set_bounds((1,0,0),['none', 'absorbing', 'absorbing', 'free'])


# ========== set block surface ===============
# top left surface
surf1 = fdfault.curve(nx1, 'y', x1, y1)
p.set_block_surf((0,0,0), 3, surf1)


# top right surface
surf2 = fdfault.curve(nx2, 'y', x2, y2)
p.set_block_surf((1,0,0), 3, surf2)

# fault surface
xcord = x1[-1]
ycord = y1[-1]

x_fault = np.linspace(block000_length, xcord, nby0)
y_fault = np.linspace(0., ycord, nby0)
fault_bottom = x_fault[0]
Пример #4
0
    # what should the output be? it's currently an integer but should it be an array?
    min_range = np.where(x >= 4)[0][0]
    # sets maximum location (in km) for region in which rupture can occur
    # I know this should be less than or equal. why isn't it working?
    max_range = np.where(x >= extent_km)[0][0]
    snst = np.empty(nx)
    normal = np.empty(nx)
    failure_stress = np.empty(nx)
    shear = np.empty(nx)

    #____________________________________

    while True:
        y = 10. * np.ones(nx) + seistools.rough.generate_profile(
            nx, 40, rms_ratio[0], 10, 1, seed)
        surf = fdfault.curve(nx, 'y', x, y)
        p.set_block_surf((0, 0, 0), 3, surf)
        p.set_block_surf((0, 1, 0), 2, surf)
        normx, normy = seistools.rough.generate_normals_2d(x, y, 'y')
        for i in range(nx):
            if i <= extent:
                sxx_p = sxx + pore_pressure
                syy_p = syy + pore_pressure
            else:
                sxx_p = sxx
                syy_p = syy
            # put in for loop for determining whether a value is sxx or sxx + pore_pressure
            sn, st = seistools.coulomb.rotate_xy2nt_2d(sxx_p, sxy, syy_p,
                                                       (normx[i], normy[i]))
            # normal, shear, snst are lists where each item corresponds to a grid point on the fault
            normal[i] = sn
Пример #5
0
# set block dimensions

p.set_block_lx((0, 0, 0), (12., 32.))
p.set_block_lx((1, 0, 0), (12., 32.))

# set block boundary conditions

p.set_bounds((0, 0, 0), ['absorbing', 'none', 'absorbing', 'absorbing'])
p.set_bounds((1, 0, 0), ['none', 'absorbing', 'absorbing', 'absorbing'])

# set block surface

y = np.linspace(0., 32., 1601)
x = 12. * np.ones(1601) + 0.5 * np.sin(np.pi * y / 32.)

surf = fdfault.curve(1601, 'x', x, y)

p.set_block_surf((0, 0, 0), 1, surf)
p.set_block_surf((1, 0, 0), 0, surf)

# set initial fields

p.set_stress((-120., 70., 0., -100., 0., 0.))

# set interface type

p.set_iftype(0, 'slipweak')

# set slip weakening parameters

p.add_pert(fdfault.swparam('constant', dc=0.4, mus=0.676, mud=0.525), 0)