z = mg.create_node_array_zeros() + leftmost_elev z += initial_slope * np.amax(mg.node_y) - initial_slope * mg.node_y #put these values plus roughness into that field mg.at_node['topographic_elevation'] = z + np.random.rand(len(z)) / 100000. #set up grid's boundary conditions (bottom, right, top, left is inactive) mg.set_closed_boundaries_at_grid_edges(False, True, False, True) # Display a message print 'Running ...' #instantiate the components: fr = FlowRouter(mg) sp = SPEroder(mg, input_file) diffuse = PerronNLDiffuse(mg, input_file) lin_diffuse = DiffusionComponent(grid=mg, input_stream=input_file) #perform the loops: for i in xrange(nt): #note the input arguments here are not totally standardized between modules #mg = diffuse.diffuse(mg, i*dt) mg = lin_diffuse.diffuse(mg, dt) mg = fr.route_flow(grid=mg) mg = sp.erode(mg) ##plot long profiles along channels pylab.figure(6) profile_IDs = prf.channel_nodes(mg, mg.at_node['steepest_slope'], mg.at_node['drainage_area'], mg.at_node['upstream_ID_order'], mg.at_node['flow_receiver'])
##create the elevation field in the grid: #create the field mg.create_node_array_zeros('planet_surface__elevation') z = mg.create_node_array_zeros() + leftmost_elev z += initial_slope * np.amax(mg.node_y) - initial_slope * mg.node_y #put these values plus roughness into that field mg['node']['planet_surface__elevation'] = z + np.random.rand(len(z)) / 100000. # Display a message print 'Running ...' #instantiate the components: fr = FlowRouter(mg) sp = SPEroder(mg, input_file) diffuse = PerronNLDiffuse(mg, input_file) lin_diffuse = DiffusionComponent(grid=mg) lin_diffuse.initialize(input_file) #perform the loops: for i in xrange(nt): mg['node']['planet_surface__elevation'][ mg.get_interior_nodes()] += uplift_per_step mg = fr.route_flow(grid=mg) mg = sp.erode(mg) mg = diffuse.diffuse(mg, i * dt) #mg = lin_diffuse.diffuse(mg, dt) ##plot long profiles along channels pylab.figure(6) profile_IDs = prf.channel_nodes(mg, mg.at_node['steepest_slope'], mg.at_node['drainage_area'],