stop_release_water_time = 2 # the time for stopping releasing the water domain.set_name("anuga_swmm") for t in domain.evolve(yieldstep=1.0, finaltime=60.0): print("\n") #print(f"coupling step: {t}") domain.print_timestepping_statistics() if t < stop_release_water_time: # assume we need to release the water into the domain for first two seconds pass #op_inlet.set_rate(flow) else: # set the overland_depth # TODO: set up the overland depth, modify this function print("total volume: ",domain.get_water_volume()) volumes = sim.coupling_step(1.0) print(volumes) nodes[0].overland_depth = get_depth(op_inlet) print("inlet overland depth: ", get_depth(op_inlet)) volumes_in_out = volumes[-1][-1] print(volumes_in_out) if t <= stop_release_water_time+1: # no water exchange as the first two steps from swmm and anuga did not match. print("Volume total at node Inlet" ":", volumes_in_out["Inlet"]) print("Oulet: ", nodes[1].total_inflow) op_inlet.set_rate(0) op_outlet.set_rate(0)
# type, area, length, orifice_coeff, free_weir_coeff, submerged_weir_coeff inlet_opening = inlet.create_opening(4, 2.0, 1.0, 0.6, 1.6, 1.0) inlet.coupling_area = 0.5 print('inlet_opening', inlet_opening) # TODO: setup the outlet node # outlet.create_opening(4, 1.0, 1.0, 0.6, 1.6, 1.0) # outlet.coupling_area = 1.0 print("inlet_is_open?:", inlet.is_coupled) print("outlet_is_open?:", outlet.is_coupled) flow = 1.0 stop_release_water_time = 0 # the time for stopping releasing the water initial_volume = domain.get_water_volume() inlet_flow = 0.0 outlet_flow = 0.0 inlet_residual = 0.0 inlet_discrepency = 0.0 previous_culvert_volume = 0.0 domain.set_name("anuga_swmm") for t in domain.evolve(yieldstep=1.0, finaltime=120.0): print("\n") # print(f"coupling step: {t}") domain.print_timestepping_statistics() print('culvert volume', culvert.volume)
# Simulate sewer with flow input superlink.step(Q_in=Q_in, dt=dt) superlink.reposition_junctions() # Add/remove flows from surface domain inlet1_anuga_inlet_op.set_Q(-Q_in[0]) outlet_anuga_inlet_op.set_Q(-Q_in[1]) # Compute volumes link_volume = ((superlink._A_ik * superlink._dx_ik).sum() + (superlink._A_SIk * superlink._h_Ik).sum()) node_volume = (superlink._A_sj * (superlink.H_j - superlink._z_inv_j)).sum() sewer_volume = link_volume + node_volume total_volume_correct = t * input_velocity total_volume_real = domain.get_water_volume() + sewer_volume loss = total_volume_real - total_volume_correct # Append data losses.append(loss) H_js.append(superlink.H_j.copy()) # record flow time series in each pipe Q_iks.append(superlink.Q_ik.copy()) Q_uks.append(superlink.Q_ik.copy()) Q_dks.append(superlink.Q_ik.copy()) H_j = np.vstack(H_js) plt.plot(H_j[:, 0], label='Inlet 1') plt.plot(H_j[:, 1], label='Inlet 2')
# type, area, length, orifice_coeff, free_weir_coeff, submerged_weir_coeff nodes[0].create_opening(4, 1.0, 1.0, 0.6, 1.6, 1.0) nodes[0].coupling_area = 0.25 # TODO: setup the outlet node nodes[1].create_opening(4, 1.0, 1.0, 0.6, 1.6, 1.0) nodes[1].coupling_area = 0.25 print('') print("node0_is_open?:", nodes[0].is_coupled) print("node1_is_open?:", nodes[1].is_coupled) flow = 1.0 stop_release_water_time = 0 # the time for stopping releasing the water initial_volume = domain.get_water_volume() previous_inlet_flow = 0.0 previous_outlet_flow = 0.0 domain.set_name("anuga_swmm") for t in domain.evolve(yieldstep=1.0, finaltime=120.0): print("\n") # print(f"coupling step: {t}") domain.print_timestepping_statistics() # set the overland_depth # TODO: set up the overland depth, modify this function volumes = sim.coupling_step(1.0) volumes_in_out = volumes[-1][-1]