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"))
# Same material properties used in Tectonic model
density = 2.7
first_lames_param = 30
shear_modulus = 30

p.set_material(
    fdfault.material('elastic', density, first_lames_param, shear_modulus))

# # set interface types
p.set_iftype(0, 'locked')
p.set_iftype(1, 'slipweak')
p.set_iftype(2, 'locked')
p.set_iftype(3, 'locked')

# set slip weakening parameters for fault interface-1
p.add_pert(fdfault.swparam('constant', dc=0.4, mus=0.681, mud=0.25), 1)
# p.add_pert(fdfault.swparam('boxcar', 0., x0 = 65.0, dx = 0.25, mus = -0.20, c0 = 0.),1)
# p.add_pert(fdfault.swparam('boxcar', 0., x0 = 61.0, dx = 1.0, mus = 10000., c0 = 500.),1)

# # add cohesionion to top 5 km of the fault
# cohesion = np.zeros((nby1,1))
# zer = np.zeros((nby1,1))

# def get_cohesion(depth):
# 	c1 = 3.0
# 	c2 = 10.0
# 	y2 = 70.79
# 	y1 = 65.0
# 	# Interpolated cohesion
# 	icohesion = c1 + (depth - y1) * (c2-c1)/(y2-y1)
# 	return icohesion
示例#3
0
# set material

cs = 3.464
cp = 6.
rho = 2.67

p.set_material(
    fdfault.material('elastic', rho, rho * (cp**2 - 2. * cs**2), rho * cs**2))

# set interface type

p.set_iftype(0, 'slipweak')

# set slip weakening parameters

p.add_pert(fdfault.swparam('constant', 0., 0., 0., 0., 0., 0.4, 0.677, 0.525))
p.add_pert(
    fdfault.swparam('boxcar', 0., 0., 20., -17.55, 2.5, 0., 10000., 0., 10.))
p.add_pert(
    fdfault.swparam('boxcar', 0., -17.55, 2.5, -7.5, 7.5, 0., 10000., 0., 10.))
p.add_pert(
    fdfault.swparam('boxcar', 0., 17.55, 2.5, -7.5, 7.5, 0., 10000., 0., 10.))

# add load perturbations

p.add_load(fdfault.load('constant', 0., 0., 0., 0., 0., -120., 70., 0.))
p.add_load(fdfault.load('boxcar', 0., 0., 1.5, -7.5, 1.5, 0., 11.6, 0.))
p.add_load(fdfault.load('boxcar', 0., -7.5, 1.5, -7.5, 1.5, 0., 8., 0.))
p.add_load(fdfault.load('boxcar', 0., 7.5, 1.5, -7.5, 1.5, 0., -8., 0.))

# add output unit
示例#4
0
        if (maxindex >= min_range and maxindex <= max_range):
            pertcenter = surf.get_x(maxindex)
            print('center', pertcenter, 'seed', seed, 'index', maxindex)
            break

        seed += 1
    print('normal ' + str(normal))

    # Setting the stresses

    # set interface type
    p.set_iftype(0, 'slipweak')

    # set slip weakening parameters

    p.add_pert(fdfault.swparam('constant', dc=0.2, mus=MUS, mud=MUD), 0)
    p.add_pert(fdfault.swparam('boxcar', x0=2., dx=2., mus=10000.), 0)
    p.add_pert(fdfault.swparam('boxcar', x0=38., dx=2., mus=10000.), 0)

    # ______________________________________

    # --------------loading stresses through a file
    # add load perturbations
    # add load perturbations through a file

    x_diff = x[2] - x[1]  # finding the difference to know the grid spacing
    patch_length_km = 0.75  # one side patch length. Total will be 2* patch length
    no_grid_points = int(
        patch_length_km / x_diff
    )  # this will be the patch length on each side of nucleation center
    friction_coef = MUS
# ------------ set initial stress -------------
# sn, st = stressrotate_v2.calculate_fault_normal_shear_stress(sxx[nx1,:], sxy[nx1,:], syy[nx1,:], x_fault, y_fault, 'x')
# sxx, sxy, syy = set_initial_stress(20,90,20, 10)
#
# stress = np.zeros((3,(nx1+nx2),nby0))
# stress[0,:,:] = sxx
# stress[1,:,:] = sxy
# stress[2,:,:] = syy
#
p.set_het_stress(stress)

# set interface types
p.set_iftype(0,'slipweak')

# set slip weakening parameters
p.add_pert(fdfault.swparam('constant', dc = 0.4, mus = 0.677, mud = 0.44),0)
p.add_pert(fdfault.swparam('boxcar', x0 = 0.75, dx = 0.75, mus = 10000.),0)
#p.add_pert(fdfault.swparam('boxcar',0., 5., 0.25, 0., 0., 0.,-0.15, 0.),0)

# add load perturbations
p.add_load(fdfault.load('boxcar',0., 5.,0.25, 0., 0., 0.,-16.75, 0.),0)

# add cohesion to free surface
cohes = np.zeros((nby0,1))
zer = np.zeros((nby0,1))

dcohes = 3.
cmax = 20.

for i in range(nby0):
	if y_fault[i] > ycord-dcohes:
示例#6
0
# p.set_het_stress(stress)
# # p.set_stress((-120., 70., 0., -100., 0., 0.))

density = 2.7
first_lames_param = 30
shear_modulus = 30

p.set_material(
    fdfault.material('elastic', density, first_lames_param, shear_modulus))

# set interface types
p.set_iftype(1, 'slipweak')
p.add_load(fdfault.loadfile(n1, n2, sn, s2, s3))

# set slip weakening parameters
p.add_pert(fdfault.swparam('constant', dc=0.4, mus=0.55, mud=0.25), 1)
p.add_pert(fdfault.swparam('boxcar', 0., x0=61.0, dx=1.0, mus=10000., c0=500.),
           1)

# Full domain properties
p.add_output(
    fdfault.output('vxbody', 'vx', 0, nt - 1, 50 * refine, 0, nx - 1,
                   2 * refine, 0, ny - 1, 2 * refine, 0, 0, 1))
p.add_output(
    fdfault.output('vybody', 'vy', 0, nt - 1, 50 * refine, 0, nx - 1,
                   2 * refine, 0, ny - 1, 2 * refine, 0, 0, 1))
p.add_output(
    fdfault.output('sxbody', 'sxx', 0, nt - 1, 50 * refine, 0, nx - 1,
                   2 * refine, 0, ny - 1, 1 * refine, 0, 0, 1))
p.add_output(
    fdfault.output('sxybody', 'sxy', 0, nt - 1, 50 * refine, 0, nx - 1,
示例#7
0
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)
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 perturbations

p.add_load(fdfault.load('boxcar', 0., 16., 1.5, 0., 0., 0., 11.6, 0.))

# add output unit

p.add_output(
    fdfault.output('vxbody', 'vx', 0, 1600, 50, 0, 1200, 2, 0, 1600, 2, 0, 0,
                   1))
p.add_output(
    fdfault.output('vybody', 'vy', 0, 1600, 50, 0, 1200, 2, 0, 1600, 2, 0, 0,
                   1))