コード例 #1
0
    #Q_in = np.where(superlink.H_j <= anuga_stages,
    #               C_w * L_w * np.sqrt(anuga_depths) * anuga_depths, 0.0 )

    print(anuga_depths)
    print(anuga_elevs)
    print(anuga_stages)

    print(superlink.H_j)
    print(Q_in)

    # 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])
    inlet2_anuga_inlet_op.set_Q(-Q_in[1])
    inlet3_anuga_inlet_op.set_Q(-Q_in[2])
    inlet4_anuga_inlet_op.set_Q(-Q_in[3])
    inlet4_anuga_inlet_op.set_Q(-Q_in[4])

    # 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

    boundary_flow = domain.get_boundary_flux_integral()
    total_volume_correct = t * input_rate + boundary_flow
コード例 #2
0
                    #label = 'culvert_output',
                    verbose=False)
"""
line = [[3.0, 2.5], [14.0, 2.5],[5.5,4.0]]
Q = -25.0


def dynamic_Q (t,yieldstep):
    t = t+yieldstep
    return Q+t


inlet0 = Inlet_operator(domain, line,Q=0.0)

for t in domain.evolve(yieldstep=0.5, finaltime=20.0):
    Q = dynamic_Q(0,0.5)
    inlet0.set_Q(dynamic_Q(0,0.5))
    domain.print_timestepping_statistics()
    #domain.set_quantity('stage',None,None)
    #print(inlet0.timestepping_statistics())
    #Q = dynamic_Q(0,yieldstep=0.5)

    print(inlet0.get_Q(),"Q")
    print(inlet0.inlet.get_average_speed(),"avsp")
    print(inlet0.inlet.get_depths(),"dp")





コード例 #3
0
ファイル: pipedream.py プロジェクト: stoiver/anuga-swmm
    ])

    # Compute inflow/outflow to sewer
    C_o = 0.67
    A_o = 2 * np.pi
    Q_in = C_o * A_o * np.sign(anuga_depths -
                               (superlink.H_j - superlink._z_inv_j)) * np.sqrt(
                                   np.abs(anuga_depths - (superlink.H_j -
                                                          superlink._z_inv_j)))

    # 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())
コード例 #4
0
    print('Culvert volume', Culvert.volume)

    print('Culvert Flow', Culvert.flow)

    print("inlet overland depth: ", nodes[0].overland_depth)

    print('Inlet inflow', nodes[0].total_inflow)
    print('Inlet ourflow', nodes[0].total_outflow)
    print('Outlet inflow', nodes[1].total_inflow)
    print('Outlet outflow', nodes[1].total_outflow)

    #print ("node area", nodes[0].coupling_area)
    #print ("node inflow", nodes[0].coupling_inflow)
    #print ("node volume", nodes[0].volume)
    #print("node stuff", nodes[0].statistics)

    #print(volumes)

    #print(volumes_in_out)

    print("Volume total at node Inlet" ":", volumes_in_out["Inlet"])
    print("Volume total at node Outlet" ":", volumes_in_out["Outlet"])
    print("Outlet: ", nodes[1].total_inflow)
    op_inlet.set_Q(-volumes_in_out['Inlet'])

    #op_inlet.set_Q(-nodes[0].total_inflow)
    op_outlet.set_Q(nodes[1].total_inflow)

    previous_inlet_flow = nodes[0].total_inflow  #volumes_in_out['Inlet']
    previous_outlet_flow = nodes[1].total_inflow
コード例 #5
0
    # print('Change in culvert volume',culvert.volume-previous_culvert_volume)
    print('Culvert Flow', culvert.flow)
    print('Inlet inflow', inlet.total_inflow)
    # print('Inlet ourflow', inlet.total_outflow)
    # inlet_residual = inlet.total_inflow - inlet.total_outflow
    # print('inlet_residual',inlet_residual)
    print('Outlet inflow', outlet.total_inflow)

    # print(volumes_in_out)

    # print("Volume total at node Inlet" ":", volumes_in_out["Inlet"])
    # print("Volume total at node Outlet" ":", volumes_in_out["Outlet"])

    # inlet_Q  = -volumes_in_out['Inlet']
    # inlet_Q = - inlet.coupling_inflow
    inlet_Q = -inlet.total_inflow
    outlet_Q = outlet.total_inflow

    op_inlet.set_Q(inlet_Q)
    op_outlet.set_Q(outlet_Q)

    inlet_flow = inlet_flow + inlet_Q
    outlet_flow = outlet_flow + outlet_Q

    # inlet_discrepency = inlet.total_inflow + inlet_Q

    # print("inlet_discrepency",inlet_discrepency)

    previous_inlet_flow = inlet.total_inflow  # volumes_in_out['Inlet']
    previous_outlet_flow = outlet.total_inflow
コード例 #6
0
    print(inlet1_pyswmm_node.statistics['flooding_volume'] * 0.0283168466)
    print(inlet1_pyswmm_node.flooding * 0.0283168466)
    print(inlet2_pyswmm_node.flooding * 0.0283168466)

    flood += (inlet1_pyswmm_node.flooding + inlet2_pyswmm_node.flooding
              ) * 0.0283168466  #coefficiency between cubid meter and gallon.

    print("cumulative flood ", flood)

    # if inlet1_pyswmm_node.flooding > 0 and Q_inlet1 < 0:
    #     Q_inlet1 = 0
    # if inlet2_pyswmm_node.flooding > 0 and Q_inlet2 < 0:
    #     Q_inlet2 = 0

    #Q: recorded as the raw data of next stage to be calculated as average depth.
    inlet1_anuga_inlet_op.set_Q(Q_inlet1 +
                                inlet1_pyswmm_node.flooding * 0.0283168466)
    inlet2_anuga_inlet_op.set_Q(Q_inlet2 +
                                inlet2_pyswmm_node.flooding * 0.0283168466)
    outlet_anuga_inlet_op.set_Q(Q_outlet)

    losses.append(loss)

print('visualize the loss curve')

t = int(t)
import matplotlib.pyplot as plt
plt.subplot(2, 2, 1)
plt.title('loss')
plt.plot(range(t + 1), losses)
plt.show()