# Computing flux of vector field numerically with regular grids

I would like to compute the flow rate (mL/s) of a pipe flow given the 3D velocity field $\mathbf{v} = (v_x, v_y, v_z)$ over the computational domain (a curved pipe). The field is represented in the form of a voxel grid with uniform sampling distances along each dimension. The flow field is a result of a numerical simulation of the flow.

In general the flow rate can be computed as the flux of the velocity field over a cut plane of the 3D domain (pipe).

$Q = \int_S v \mathbf{n} dA$

Using this approach however the solution only depends on samples from a subset of the available results, and in order to improve the accuracy of the computation I would like to use all available data. This could be achieved by computing the flow rate as an average of multiple flux values based on different sampling planes.

Given that the considered domain is a pipe, it is possible to estimate the centerline in the form of a curve $z$, and then using test surfaces that are planes perpendicular to the curve along equally spaced locations $z_i, i\in(1,\dots, N)$ and taking $N\to\infty$, we get the following expression

$Q = \frac{1}{L}\int_Z\int_S v \mathbf{n} dAdz$, with L the length of the curve z

In order to make the computations simpler I would like to avoid the explicit computations of the flux values for the test surfaces (cutting planes). What I am aiming for is to express the solution as a volume integral of some kind, that could be trivially evaluated without any knowledge of the topology of the domain in 3D.

I was trying to use the divergence theorem first, however when applied to the computational domain (pipe interior) it would basically contain the difference of fluxes at the inlet and outlet (assuming no flux through the walls) and I could not get anything meaningful out of this.

Any ideas / hints are very much appreciated!

• Do want an average of the flow rate, or is it constant? – shuhalo Nov 1 '12 at 18:34
• If the flow field you specify is truly divergenceless, the only sources and sinks of fluid would be the end-caps (boundary conditions) you specify. In fact, you would only need to evaluate a surface integral over either the entrance or exit of the pipe, and you would know that the other surface would have the same flux out the other side . . . – meawoppl Nov 1 '12 at 18:41
• The flow rate is constant (incompressible flow with rigid walls). The surface integral can be evaluated basically using any cross section, and it would give the flow rate I am looking for. The question I had was basically if it is possible to improve the accuracy of the computation by evaluating an average value for lots of planar cross sections perpendicular to the centerline, but using an approximation for the resulting integral expression with a volume integral of some scalar values instead of computing the surface integral repeatedly. If it is possible it would make computations easier. – user44010 Nov 5 '12 at 16:00