Exemplo n.º 1
0
hydrograph_time_hrs = []

## Setting initial fields...
rmg['node']['topographic__elevation'] = z
rmg['link']['water_discharge'] = np.zeros(rmg.number_of_links)
rmg['node']['water_depth'] = np.zeros(rmg.number_of_nodes)

## and fixed link boundary conditions...
rmg.set_fixed_link_boundaries_at_grid_edges(
    True, True, True, True, fixed_link_value_of='water_discharge')

## Setting the outlet node to OPEN_BOUNDARY
rmg.status_at_node[100] = 1

## Initialize the OverlandFlow() class.
of = OverlandFlow(rmg, use_fixed_links=True)

## Record the start time so we know how long it runs.
start_time = time.time()

## Link to sample at the outlet
link_to_sample = 299

## Storm duration in seconds
storm_duration = 7200.0

## Running the overland flow component.
while elapsed_time < model_run_time:

    ## At the start of each loop, we calculate a new time step.
    #of.dt = of.gear_time_step()#rmg)
Exemplo n.º 2
0
hydrograph_time_hrs = []

## Setting initial fields...
rmg['node']['topographic__elevation'] = z
rmg['link']['water_discharge'] = np.zeros(rmg.number_of_links)
rmg['node']['water_depth'] = np.zeros(rmg.number_of_nodes)

## and fixed link boundary conditions...
rmg.set_fixed_link_boundaries_at_grid_edges(True, True, True, True, fixed_link_value_of='water_discharge')

## Setting the outlet node to OPEN_BOUNDARY
rmg.status_at_node[50] = 1


## Initialize the OverlandFlow() class.
of = OverlandFlow(rmg, use_fixed_links=True)

## Record the start time so we know how long it runs.
start_time = time.time()

## Link to sample at the outlet
link_to_sample = 149

## Storm duration in seconds
storm_duration = 7200.0


## Running the overland flow component.
while elapsed_time < model_run_time:

    ## At the start of each loop, we calculate a new time step.
rmg.set_closed_boundaries_at_grid_edges(True, True, True, True)

# Create fields in the grid for topographic elevation, water depth and discharge.
rmg.create_node_array_zeros('topographic__elevation')        # topographic elevation (m)
rmg.create_node_array_zeros('water_depth')                   # water depth (m)
rmg.add_zeros('active_link', 'water_discharge')              # unit discharge (m2/s)

# Add our initial thin layer of water to the field of water depth.
rmg['node']['water_depth'] += h_init

# Now we'll identify our leftmost, but interior, column and the IDs of those nodes.
leftside = rmg.left_edge_node_ids()
leftside = leftside+1                     # One column in to prevent issues with BC

# Initializing our class...
of = OverlandFlow(rmg)

# Now, we need to set a fixed value on the left edge, so we find the link neighbor arrays...
of.set_up_neighbor_arrays(rmg)

# ... and get a list of all horizonal ids, not just active ids (which is what the deAlmeida solution uses)
all_horizontal_ids = links.horizontal_link_ids(rmg.shape)

# from there, we are going to reset our west neighbor array...
of.west_neighbors = links.horizontal_west_link_neighbor(rmg.shape, all_horizontal_ids)

# and find the ids of the arrays along the west edge of the grid. We actually
# will set the discharge values here at every time step in the loop.
left_inactive_ids = links.left_edge_horizontal_ids(rmg.shape)

# Let's see how long this run takes...
Exemplo n.º 4
0
## Setting initial fields...
rmg['node']['topographic__elevation'] = z
rmg['link']['water_discharge'] = np.zeros(rmg.number_of_links)
rmg['node']['water_depth'] = np.zeros(rmg.number_of_nodes)


## and fixed link boundary conditions...
rmg.set_fixed_link_boundaries_at_grid_edges(True, True, True, True, fixed_link_value_of='water_discharge')

## Setting the outlet node to OPEN_BOUNDARY
rmg.status_at_node[50] = 1


## Initialize the OverlandFlow() class.
of = OverlandFlow(rmg, use_fixed_links=True)

## Record the start time so we know how long it runs.
start_time = time.time()

## Link to sample at the outlet
link_to_sample = 149

## Storm duration in seconds
storm_duration = 7200.0


## Running the overland flow component.
while elapsed_time < model_run_time:

    ## At the start of each loop, we calculate a new time step.