# Surface integral through a cube.

I am doing some fluid dynamics work and the question asks:

Consider the mass flow vector:

$$\rho \vec{u} = (4x^2y,xyz,yz^2)$$

Compute the net mass outflow through the cube formed by the planes x=0, x=1, y=0, y=1, z=0, z=1

So I figure that in order to find the net mass outflow I compute the surface integral of the mass flow normal to each plane and add them all up. That is:

$$\iint_S (\rho \vec{u} \cdot \hat{n}) dA$$

To make the work easier I use the divergence theorem, to replace the surface integral with a volume integral and a much shorter integration:

Volume Integral:

$$\rightarrow \iint_S (\rho \vec{u} \cdot \hat{n}) dA = \iiint_V (\nabla \cdot \rho \vec{u})dV$$

$$\rightarrow \iiint_V(\nabla \cdot (4x^2y,xyz,yz^2))dV$$

$$\rightarrow \int \limits_0^1 \int \limits_0^1 \int \limits_0^1(8xy+xz+2yz)dxdy dz$$

$$\rightarrow\int \limits_0^1\int \limits_0^1(4y +\frac{z}{2}+2yz) dy dz$$

$$\rightarrow\int \limits_0^1(2 +\frac{z}{2}+z) dz$$

$$\rightarrow \iiint_V (\nabla \cdot \rho \vec{u})dV = \frac{11}{4}$$

I am pretty sure this part is done correctly, however just to check I do the question the long way as well; obtaining 6 surface integrals:

Surface Integral:

$$\hat{n} = (1,0,0) \; \; \; \; \; \int \limits_0^1 \int \limits_0^1 (4x^2y) dy dz = \int \limits_0^1 2x^2dz = 2x^2$$

$$\hat{n} = (-1,0,0) \; \; \int \limits_0^1 \int \limits_0^1 (-4x^2y) dy dz = \int \limits_0^1 -2x^2dz = -2x^2$$

$$\hat{n} = (0,1,0) \; \; \; \; \; \int \limits_0^1 \int \limits_0^1 (xyz) dx dz = \int \limits_0^1 \frac{yz}{2}dz = \frac{y}{4}$$

$$\hat{n} = (0,-1,0) \; \; \int \limits_0^1 \int \limits_0^1 (-xyz) dx dz = \int \limits_0^1 \frac{-yz}{2}dz = \frac{-y}{4}$$

$$\hat{n} = (0,0,1) \; \; \; \; \; \int \limits_0^1 \int \limits_0^1 (yz^2) dy dx = \frac{z^2}{2}$$

$$\hat{n} = (0,0,-1) \; \; \int \limits_0^1 \int \limits_0^1 (-yz^2) dy dx = \frac{-z^2}{2}$$

Summing all of these results in zero which contradicts the answer I obtained earlier of $$\frac{11}{4}$$. What am i doing wrong can someone please explain, I am sure it is some trivial mistake but I have checked it over and am not sure. Thanks to all for your time!

I have determined my mistake I have to input the values of the planes to get my final answer :

Surface Integral:

$$\hat{n} = (1,0,0) \; \; \; \; \; \int \limits_0^1 \int \limits_0^1 (4x^2y) dy dz = \int \limits_0^1 2x^2dz = 2x^2 = \;2 \rightarrow at \; x = 1$$

$$\hat{n} = (-1,0,0) \; \; \int \limits_0^1 \int \limits_0^1 (-4x^2y) dy dz = \int \limits_0^1 -2x^2dz = -2x^2 = \;0 \rightarrow at \; x = 0$$

$$\hat{n} = (0,1,0) \; \; \; \; \; \int \limits_0^1 \int \limits_0^1 (xyz) dx dz = \int \limits_0^1 \frac{yz}{2}dz = \frac{y}{4} = \frac{1}{4} \; \rightarrow at \; y = 1$$

$$\hat{n} = (0,-1,0) \; \; \int \limits_0^1 \int \limits_0^1 (-xyz) dx dz = \int \limits_0^1 \frac{-yz}{2}dz = \frac{-y}{4} = \;0 \rightarrow at \; y = 0$$

$$\hat{n} = (0,0,1) \; \; \; \; \; \int \limits_0^1 \int \limits_0^1 (yz^2) dy dx = \frac{z^2}{2} = \; \frac{1}{2} \rightarrow at \; z = 1$$

$$\hat{n} = (0,0,-1) \; \; \int \limits_0^1 \int \limits_0^1 (-yz^2) dy dx = \frac{-z^2}{2} = \; 0 \rightarrow at \; z = 0$$

Summing gets you $$\frac{11}{4}$$ as required,