# Control Volume Analysis¶

## Learning outcomes¶

• Understand the system representation of matter from a Lagrangian perspective
• Learn about the conservation laws for mass, momentum and energy
• Understand the concept of a control volume and how the conservation laws apply
• Get comfortable with the idea of a surface normal vector.
• Remind ourselves about the dot product with some Python

# System Representation of Matter¶

A system is a collection of matter that may move, flow and interact with its surroundings. You can imagine a fluid flow moving through a conduit as shown below and we somehow manage to tag a large number of Lagrangian particles in a cuboid of space and then we track those tagged particles as they move through the duct. These tagged Lagrangian particles are a system and they may move, flow and interact with their surroundings. As the duct's cross sectional area expands the shape of the system stretches in the spanwise direction and contracts in the streamwise direction since there are only so many particles in our system.

At various moments in time we can mark the volume and boundary occupied by the system as show in red. Note that the flow shown below is a simplified inviscid frictionless flow.

Lets look at that again in 2D. As the duct expands the fluid expands to fill the spanwise width and so the streamwise length of the system shrinks. It appears that the volume of the system is kept constant.

# Conservation Laws¶

This observation about the volume of our system illustrated above suggests that the volume is conserved. Lets think about that a little more. We defined our system as a collection of matter in the form of particles. We cannot add or remove matter from that system — there is only so much stuff and we've tagged all of it in our system. More precisely we can state that the time rate of change of the mass of the system does not change. This is called the Conservation of Mass. How it relates to volume will become apparent.

## Conservation of Mass¶

The total mass of a system $M_{sys}$ can be defined as the sum of the mass of all the particles that make up the system:

\begin{equation*} M_{sys} = \sum_\text{mass sys}{\delta m} = \sum_\text{volume sys}{\rho \delta \rlap{V}-} \end{equation*}

Which is equivalent to the sum of the density times the volume of each particle. As the mass of each particle approaches zero, which is reasonable when dealing with small particles:

\begin{equation*} \lim_{\delta m \rightarrow 0} \Rightarrow M_{sys} = \underbrace{\int{\delta m}}_\text{mass sys} = \underbrace{\int{\rho \delta \rlap{V}-}}_\text{volume sys} \end{equation*}

So since by definition our system is a finite number of particles the mass of the system remains constant but also if the density also remains constant the volume is also conserved. The conservation of mass can be written:

\begin{equation*} \frac{d M_{sys}}{dt} = 0 \end{equation*}

We can also define conservation laws for momentum and energy.

## Conservation of Momentum¶

Momentum $\vec{P}$ is simply the mass times the velocity of a body. Momentum is important because it allows us to understand how a mass of fluid responds to changes in velocity due to the forces acting on it. Each of the particles in our system have a constant infinitesimal mass and some measurable velocity as the system evolves. As above for conservation of mass, the momentum $P = M\vec{V}$ can be written:

\begin{equation*} \vec{P}_{sys} = M_{sys} \vec{V} = \underbrace{\int{\vec{V}\delta m}}_\text{mass sys} = \underbrace{\int{\vec{V} \rho \delta \rlap{V}-}}_\text{volume sys} \end{equation*}

Newton's second law for a linear system states that the time rate of change of the linear momentum of the system equals the sum of the external forces acting on the system.

\begin{equation*} \frac{d \vec{P}_{sys}}{dt} = \sum{\vec{F}} \end{equation*}

## Conservation of Energy¶

Like mass and momentum, our particles in our system have energy, $E$. They may have potential energy or kinetic energy depending on their trajectory. They may have internal energy due to addition or removal of heat.

\begin{equation*} E_{sys} = \underbrace{\int{e \delta m}}_\text{mass sys} = \underbrace{\int{e \rho \delta \rlap{V}-}}_\text{volume sys} \end{equation*}

The time rate of change of energy of the system equals the rate at which heat is added to the system across the system boundary plus the rate at which work is done on the system by body or surface forces.

\begin{equation*} \frac{d E_{sys}}{dt} = \dot{Q} - \dot{W} \end{equation*}

where $\dot{Q}$ is the rate of heat addition and $\dot{W}$ the rate at which work is done on the system. You may recognise this as the First Law of Thermodynamics.

The following table summarises the three conserved quantities that we have considered.

Property Total amount ($N$) Definition Amount per unit mass ($n$)
Mass $M$ density $\times$ volume 1
Linear momentum $\vec{P}$ mass $\times$ linear velocity $\vec{V}$
Energy $E$ mass $\times$ specific energy $e = u + \frac{V^2}{2} + gz$

Note the total amount of any conserved property in a system is denoted $N$ and the amount per unit mass is given the symbol $n$.

# The Control Volume¶

Not only is it extremely tedious to track every Lagrangian particle in a system it is practically impossible, tracking a system boundary precisely is also extremely difficult. We need a means to analysis fluid flow that doesn't place such an onerous requirement on us. Fortunately such a method exists and it is the control volume. Consider again the duct from the start of the notebook. The control volume is a fixed region of the flow geometry and instead of tracking fluid particles we record the rate of change of our conserved quantities across its boundary — the control surface. The blue shaded region shows a Control Volume (CV) placed at the expansion region of our duct. The dashed lines indicated the Control Surface (CS) of the control volume.

It is apparent that at the boundaries of the control volume fluid must enter, exit or, in the case of the boundaries in contact with the walls of the duct, not cross at all. This is a relatively simple control volume with one face where the flow enters and one where the flow exits. When dealing with complex engineering flows, such as flow through the complex geometry of a section of turbine blade passage in a jet engine or the flow in a cardiovascular geometry the shape of the control volume can be extremely complex. We need to know where each face of the control volume is positioned and which direction it is pointing in. In geometry, computer graphics and engineering we define a surface normal which is a vector that is normal to the surface. Typically we represent complex surfaces as a collection of smaller faces. For a manifold of faces that form the closed shell of a volume those normal must point outwards by convention. The figure below shows the face normals of the control volume we've just introduced as viewed in Blender 2.80, the 3D software package used to generate all the graphics for this module. The cyan lines represent the unit normal vectors for each face of the control volume. By convention normal vectors point outward on a manifold geometry.

## Surface normal vectors¶

Some students struggle with the somewhat abstract idea of surface normal vectors, especially in the context of control volumes, but they are not all that complex. They are simply vectors that indicate which side of a face is the outside. We can easily imagine coordinates in $\mathbb{R}^3$ that define the vertices of a flat face, the normal is required to tell us what direction the resulting polygon faces.

A 3D geometry such as a control volume, a CAD model you want to 3D print or a video game character is made up of 2D polygonal faces connected together in a manifold or mesh. Normal vectors are required to always point outwards so we can tell which way the flow is moving, which way the 3D printer should infill, or which way the light should bounce off our game character. Here's a fun video showing how surface normals look in motion.

An an interactive model of the same geometry. One face normal is inverted, can you find it? Note, this interactive 3D model does not currently work in Google Colaboratory, take a look at the HTML version.

In :
#! pip3 install PyGEL3D
import os

from PyGEL3D import gel
from PyGEL3D import js

js.set_export_mode()