Ejemplo n.º 1
0
z = (3000.0 - mg.node_x) * 0.5
# z = -mg.node_x-mg.node_y
# z = np.sqrt(mg.node_x**2 + mg.node_y**2)
# z = mg.node_x + mg.node_y
# val_to_replace_with = z.reshape((nrows,ncols))[3,3]
# z.reshape((nrows,ncols))[2:5,:] = val_to_replace_with
mg.at_node["topographic__elevation"] = z

# mg.set_fixed_value_boundaries_at_grid_edges(True, True, True, True)
mg.set_closed_boundaries_at_grid_edges(False, True, True, True)
figure(3)
imshow_node_grid(mg, mg.status_at_node)

mg.at_node["water__unit_flux_in"] = np.ones_like(z)

pfr = PotentialityFlowRouter(mg, "pot_fr_params.txt")

pfr.route_flow(route_on_diagonals=True)

figure(1)
imshow_node_grid(mg, "water__discharge")
figure(2)
imshow_node_grid(mg, "topographic__elevation")

out_sum = np.sum(mg.at_node["water__discharge"].reshape((nrows, ncols))[-3, :])
print(out_sum)
print(np.sum(mg.at_node["water__unit_flux_in"]), np.sum(mg.at_node["water__discharge"][mg.boundary_nodes]))
print(out_sum - np.sum(mg.at_node["water__unit_flux_in"]))

show()
Ejemplo n.º 2
0
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__volume_flux_magnitude')

#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.
    pfr.route_flow(route_on_diagonals=True)
    #imshow(mg, 'water__volume_flux_magnitude')
    #show()
    kd = mg.at_node['water__volume_flux_magnitude']   # 0.01 m2 per year
Ejemplo n.º 3
0
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.
    pfr.route_flow(route_on_diagonals=True)
    #imshow(mg, 'water__discharge')
    #show()
Ejemplo n.º 4
0
z = (3000.-mg.node_x)*0.5
#z = -mg.node_x-mg.node_y
#z = np.sqrt(mg.node_x**2 + mg.node_y**2)
#z = mg.node_x + mg.node_y
#val_to_replace_with = z.reshape((nrows,ncols))[3,3]
#z.reshape((nrows,ncols))[2:5,:] = val_to_replace_with
mg.at_node['topographic__elevation'] = z

#mg.set_fixed_value_boundaries_at_grid_edges(True, True, True, True)
mg.set_closed_boundaries_at_grid_edges(False, True, True, True)
figure(3)
imshow_node_grid(mg, mg.status_at_node)

mg.at_node['water__unit_flux_in'] = np.ones_like(z)

pfr = PotentialityFlowRouter(mg, 'pot_fr_params.txt')

pfr.route_flow(route_on_diagonals=True)

figure(1)
imshow_node_grid(mg, 'surface_water__discharge')
figure(2)
imshow_node_grid(mg, 'topographic__elevation')

out_sum = np.sum(mg.at_node['surface_water__discharge'].reshape((nrows,ncols))[-3,:])
print(out_sum)
print(np.sum(mg.at_node['water__unit_flux_in']), np.sum(mg.at_node['surface_water__discharge'][mg.boundary_nodes]))
print(out_sum - np.sum(mg.at_node['water__unit_flux_in']))

show()