#modify the fields in the grid z = mg.zeros(at='node') + init_elev z_slope = (49000. - mg.node_y) / mg.node_y.max() / 20. mg.at_node[ 'topographic__elevation'] = z + z_slope #+ np.random.rand(len(z))/1000. mg.add_zeros('water__unit_flux_in', at='node') mg.add_zeros('link', 'water__discharge') #Set boundary conditions inlet_node = np.array((int((1.5 * mg.number_of_node_columns) // 1))) section_col = int((0.5 * mg.number_of_node_columns) // 1) mg.at_node['topographic__elevation'][section_col] = 1. mg.set_closed_boundaries_at_grid_edges(False, False, False, True) mg.set_fixed_value_boundaries_at_grid_edges(False, True, True, True) mg.status_at_node[section_col] = 2 mg._update_links_nodes_cells_to_new_BCs() mg.at_node['water__unit_flux_in'].fill(0.) mg.at_node['water__unit_flux_in'][inlet_node] = 1. pfr = PotentialityFlowRouter(mg, 'pot_fr_params.txt') interior_nodes = mg.core_nodes #store profiles here section_downfan = [] # do the loop for i in range(3000): #mg.at_node['topographic__elevation'][inlet_node] = 1. #maintain flux like this now instead: mg.at_node['topographic__elevation'][ section_col] = mg.at_node['topographic__elevation'][inlet_node] + 1.
# attempt to implement diffusion with flow routing... #modify the fields in the grid z = mg.zeros(at='node') + init_elev mg.at_node['topographic__elevation'] = z + np.random.rand(len(z))/1000. mg.add_zeros('water__unit_flux_in', at='node') mg.add_zeros('surface_water__discharge', at='link') #Set boundary conditions inlet_node = np.array((int((1.5*mg.number_of_node_columns)//1))) section_col = int((0.5*mg.number_of_node_columns)//1) mg.at_node['topographic__elevation'][section_col] = 1. mg.set_closed_boundaries_at_grid_edges(False, False, False, True) mg.set_fixed_value_boundaries_at_grid_edges(False, True, True, True) mg.status_at_node[section_col] = 2 mg._update_links_nodes_cells_to_new_BCs() mg.at_node['water__unit_flux_in'].fill(0.) mg.at_node['water__unit_flux_in'][inlet_node] = 1. pfr = PotentialityFlowRouter(mg, 'pot_fr_params.txt') interior_nodes = mg.core_nodes #store profiles here section_downfan = [] # do the loop for i in range(2000): #mg.at_node['topographic__elevation'][inlet_node] = 1. #maintain flux like this now instead: mg.at_node['topographic__elevation'][section_col] = mg.at_node['topographic__elevation'][inlet_node]+1. pfr.route_flow(route_on_diagonals=True)