Esempio n. 1
0
    # print("inlet_discrepency",inlet_discrepency)

    previous_culvert_volume = culvert.volume

    # print("culvert depth",culvert.depth)

    # print('Outlet outflow', outlet.total_outflow)

    # print('Inlet coupling inflow', inlet.coupling_inflow)

    print(20 * '=')
    print("Flows for next timestep")
    print(20 * '=')

    # Setup inlet for SWMM step
    inlet.overland_depth = op_inlet.inlet.get_average_depth()
    print("inlet overland depth: ", inlet.overland_depth)

    volumes = sim.coupling_step(1.0)
    volumes_in_out = volumes[-1][-1]

    # print('Inlet volumes', op_inlet.domain.fractional_step_volume_integral)
    # print('Outlet volume', op_outlet.domain.fractional_step_volume_integral)

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

    # print(volumes)
    # Test real total volume by Chen
    total_volume_correct = t * input_velocity
    total_volume_real = domain.get_water_volume(
    ) + culvert1.volume + culvert2.volume
    loss = total_volume_real - total_volume_correct

    print('loss %.4f' % loss)
    print("correct water ", total_volume_correct)
    print("water on domain", domain.get_water_volume())
    print("expect water in pipe ",
          total_volume_correct - domain.get_water_volume())
    print("water in pipe: ", culvert1.volume + culvert2.volume)

    #overland depth will be calculated by the average value of current depth.
    inlet1_pyswmm_node.overland_depth = inlet1_anuga_inlet_op.inlet.get_average_depth(
    )
    inlet2_pyswmm_node.overland_depth = inlet2_anuga_inlet_op.inlet.get_average_depth(
    )

    #volumes parameter refers to a list of tuple of dictionary, formatted by k-v: nodes, volumes during simulation.
    volumes = sim.coupling_step(1.0)
    volumes_in_out = volumes[-1][-1]

    # FIXME: determine Q_inlet1, Q_outlet
    Q_inlet1 = -volumes[-1][1]['J1']
    Q_inlet2 = -volumes[-1][1]['J2']
    Q_outlet = outlet_pyswmm_node.total_inflow
    total_input_flow += Q_inlet1 + Q_inlet2 + Q_outlet

    print("Q_inlet1/inlet1 flow: %.4f/%.4f" %
          (Q_inlet1, inlet1_pyswmm_node.coupling_inflow))