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"))
no_grid_points = int( patch_length_km / x_diff ) # this will be the patch length on each side of nucleation center friction_coef = MUS sn = np.zeros((nx, 1)) s2 = np.zeros((nx, 1)) s3 = np.zeros((nx, 1)) s2[:, 0] = shear[:] sn[:, 0] = normal[:] s2[maxindex - no_grid_points:maxindex + no_grid_points, 0] = abs(normal[maxindex - no_grid_points:maxindex + no_grid_points]) * friction_coef s2[maxindex - no_grid_points:maxindex + no_grid_points, 0] += 0.1 print(np.max(s2)) p.set_loadfile(0, fdfault.loadfile(nx, 1, sn, s2, s3)) # add another loadfile for pore pressure '''A = np.ones((extent, 1))*pore_pressure B = np.zeros((nx - extent, 1)) sn1 = np.concatenate((A, B), axis = 0) s21 = sn1 start_point = maxindex- no_grid_points # the start grid point of the rupture nucleation zone end_point = maxindex + no_grid_points s21[start_point : end_point,0 ] = abs(normal[maxindex-no_grid_points: maxindex+no_grid_points]) *friction_coef s21[maxindex-no_grid_points: maxindex+no_grid_points,0 ] += 0.1 s31 = np.zeros((nx,1))''' # adding these to rotated frame of reference
if y_fault[i] > ycord-dcohes: cohes[i,0] = cmax*(y_fault[i]-(ycord-dcohes))/dcohes if y_fault[i] < 0.4: cohes[i,0] = cmax for i in range(nby0): if y_fault[i] > 7.6: cohes[i,0] += cmax p.set_paramfile(0,fdfault.swparamfile(nby0,1,zer,zer,zer,cohes,zer,zer)) p.set_stress plt.plot(cohes[:,0], y_fault) plt.show() fdfault.loadfile() # add output unit p.add_output(fdfault.output('vxbody','vx',0, nt-1, 50*refine, 0, nx-1, 2*refine, 0, nby0-1, 2*refine, 0, 0, 1)) p.add_output(fdfault.output('vybody','vy',0, nt-1, 50*refine, 0, nx-1, 2*refine, 0, nby0-1, 2*refine, 0, 0, 1)) p.add_output(fdfault.output('vfault','V', 0, nt-1, 50*refine, nx1, nx1, refine, 0, nby0-1, 2*refine, 0, 0, 1)) p.add_output(fdfault.output('sxbody','sxx',0, nt-1, 50*refine, 0, nx-1, 2*refine, 0, nby0-1, 1*refine, 0, 0, 1)) p.add_output(fdfault.output('sxybody','sxy',0, nt-1, 50*refine, 0, nx-1, 2*refine, 0, nby0-1, 2*refine, 0, 0, 1)) p.add_output(fdfault.output('sybody','syy',0, nt-1, 50*refine, 0, nx-1, 2*refine, 0, nby0-1, 2*refine, 0, 0, 1)) p.add_output(fdfault.output('sfault','S', 0, nt-1, 50*refine, nx1, nx1, refine, 0, nby0-1, 2*refine, 0, 0, 1)) p.add_output(fdfault.output('snfault','Sn', 0, nt-1, 50*refine, nx1, nx1, refine, 0, nby0-1, 2*refine, 0, 0, 1)) # -- add output for seismogram # off fault stations offfault = [('000', '000', '000'), ('100', '000', '000'), ('200', '000', '000'), ('300', '000', '000'), ('400', '000', '000'),('500', '000', '000'),('600', '000', '000'), ('700', '000', '000'), ('800', '000', '000')]
p.set_block_surf((1, 0, 0), 2, surf12) 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') # Add stress sn, s2, s3 = lithostatic_stress(y_fault) p.set_loadfile(1, fdfault.loadfile(1, nby1, sn, s2, s3)) # 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 = 69.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) # 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,
# stress[1, :, nby0-1] = stress[1, :, nby0] # stress[2, :, nby0-1] = stress[2, :, nby0] # 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,