Opened 16 years ago

Closed 16 years ago

# Compute flow through a cross section

Reported by: Owned by: ole ole highest Functionality and features normal

For ANUGA to be used with flood modelling it will need a way to compute flow through an arbitrary cross section. The output, Q, would be a vector of flows for each stored timesteps. This was initially suggested by Rudy van Drie.

The function could be called as follows:

```Q = flow_at_cross_section(‘model.sww’, polyline, verbose=True)

Where polyline has the form
[p_1, p_2, p_3, …..]
and
p_i = [x,y]

Q is a vector of flows with units [m^3/s]
```

The algorithm would be as follows:

```1: Obtain all intersections between polyline and triangle edges
2: From these, derive for each triangle: length of intersecting segment and its midpoint.
3: Obtain from file_function (or Interpolation_function) interpolated values for xmomentum and ymomentum at each segment midpoint. The units are [m^2/s].
4: Compute the momentum along the normal vector of the segment at its midpoint.
5: Multiply the normal momentum with the segment length to obtain flow for that triangle. The unit is now [m^3/s].
6: Sum up normal flows for all participating triangles and enter into Q.
```

A simple unit test would consist of a channel flow on a flat bed with a known inflow and the same outflow. Flow across a cross section in the channel should equal the inflow.

Issues include: What if the polyline has a corner inside a triangle? Maybe, we only do this for straight lines to begin with.

### comment:1 Changed 16 years ago by ole

• Description modified (diff)

### comment:2 Changed 16 years ago by ole

Alternatively, one could implement something like

domain.flow_across_boundary('outflow_tag')

to be computed at run-time. I don't know which would be best?

### comment:3 Changed 16 years ago by duncan

domain.flow_across_boundary('outflow_tag') seems easier, since it's using the existing mesh structure.

### comment:4 Changed 16 years ago by ole

• Priority changed from normal to highest

This was raised again by Rudy 2 April 2008 and suggested as a very high priority in order for hydrological engineers to be comfortable with the correctness of the predicted flows.

### comment:5 Changed 16 years ago by ole

• Resolution set to fixed
• Status changed from new to closed

First version implemented in changeset:5288

I will close this for now but reopen if issues arise when the function is tested in the wild.

Note: See TracTickets for help on using tickets.