# The divergence of a vector field ## Flux densities Considering a medium with a mass density $\rho: \mathbb{R}^4 \to \mathbb{R}$ and a velocity field $\mathbf{v}: \mathbb{R}^4 \to \mathbb{R}^3$ consisting of a orientable finite sized surface element $d\mathbf{A} \in \mathbb{R}^3$. > *Definition*: a surface must be orientable for the surface integral to exist. It must be able to move along the surface continuously without ending up on the "other side". We then have a volume $dV \in \mathbb{R}$ defined by the parallelepiped formed by $dV = \langle d\mathbf{x}, d\mathbf{A} \rangle$ with the vector $d\mathbf{x} = \mathbf{v} dt$, for a time interval $dt \in \mathbb{R}$. The mass flux $d\Phi$ per unit of time through the surface element $d\mathbf{A}$ may then be given by $$ d \Phi = \rho \langle \mathbf{v}, d\mathbf{A} \rangle. $$ The mass flux $\Phi: \mathbb{R} \to \mathbb{R}$ through a orientable finite sized surface $A \subseteq \mathbb{R}^3$ is then given by $$ \Phi(t) = \int_A \Big\langle \rho(\mathbf{x}, t) \mathbf{v}(\mathbf{x}, t), d\mathbf{A} \Big\rangle, $$ for all $t \in \mathbb{R}$. > *Definition*: let $\mathbf{\Gamma}: \mathbb{R}^4 \to \mathbb{R}^3$ be the (mass) flux density given by > > $$ > \mathbf{\Gamma}(\mathbf{x},t) := \rho(\mathbf{x},t) \mathbf{v}(\mathbf{x},t), > $$ > > for all $(\mathbf{x},t) \in \mathbb{R}^4$. The (mass) flux density is a vector-valued function of position and time that expresses the rate of transport of a quantity per unit of time of area perpendicular to its direction. The mass flux $\Phi$ through $A$ may then be given by $$ \Phi(t) = \int_A \Big\langle \mathbf{\Gamma}(\mathbf{x},t), d\mathbf{A} \Big\rangle, $$ for all $t \in \mathbb{R}$. ## Definition of the divergence > *Definition*: the divergence of a flux density $\mathbf{\Gamma}: \mathbb{R}^4 \to \mathbb{R}^3$ is given by > > $$ >\nabla \cdot \mathbf{\Gamma}(\mathbf{x}, t) = \lim_{V \to 0} \frac{1}{V} \int_A \Big\langle \mathbf{\Gamma}(\mathbf{x}, t), d\mathbf{A} \Big\rangle, > $$ > > for all $(\mathbf{x}, t) \in \mathbb{R}^4$ for a volume $V \subset \mathbb{R}^3$ with closed orientable boundary surface $A \subset V$. Note that this "dot product" between the nabla operator and the flux density $\mathbf{\Gamma}$ does not imply anything and is only there for notational sake. An alternative to this notation is using $\text{div } \mathbf{\Gamma}$ to denote the divergence. The definition of the divergence can be interpreted with the particle mass balance for a medium with a particle density $n: \mathbb{R}^4 \to \mathbb{R}$ and a velocity field $\mathbf{v}: \mathbb{R}^4 \to \mathbb{R}^3$. Furthermore we have that the particles are produced at a rate $S: \mathbb{R}^4 \to \mathbb{R}^3$. We then have the particle flux density $\mathbf{\Gamma}: \mathbb{R}^4 \to \mathbb{R}^3$ given by $$ \mathbf{\Gamma}(\mathbf{x},t) = n(\mathbf{x},t) \mathbf{v}(\mathbf{x},t), $$ for all $(\mathbf{x},t) \in \mathbb{R}^4$. For a volume $V \subseteq \mathbb{R}^3$ with a closed orientable boundary surface $A \subseteq \mathbb{R}^3$ we have that the amount of particles inside this volume for a specific time is given by $$ \int_V n(\mathbf{x}, t) dV, $$ for all $t \in \mathbb{R}$. We have that the particle flux through $A$ is given by $$ \int_A \Big\langle \mathbf{\Gamma}(\mathbf{x},t), d\mathbf{A} \Big\rangle, $$ for all $t \in \mathbb{R}$ and we have that the particle production rate in this volume $V$ is given by $$ \int_V S(\mathbf{x}, t)dV, $$ for all $t \in \mathbb{R}$. We conclude that the sum of the particle flux through $A$ and the time derivative of the particles inside the volume $V$ must be equal to the production rate inside this volume $V$. Therefore we have $$ d_t \int_V n(\mathbf{x}, t) dV + \int_A \Big\langle \mathbf{\Gamma}(\mathbf{x},t), d\mathbf{A} \Big\rangle = \int_V S(\mathbf{x}, t)dV, $$ for all $t \in \mathbb{R}$. Assuming the system is stationary the time derivative of the particles inside the volume $V$ must vanish. The divergence is then defined to be the total production for a position $\mathbf{x} \in V$. ## Divergence in curvilinear coordinates > *Theorem*: the divergence of a flux density $\mathbf{\Gamma}: \mathbb{R}^4 \to \mathbb{R}^3$ for a curvilinear coordinate system is given by > > $$ > \nabla \cdot \mathbf{\Gamma}(\mathbf{x}, t) = \frac{1}{\sqrt{g(\mathbf{x})}} \partial_i \Big(\Gamma^i(\mathbf{x},t) \sqrt{g(\mathbf{x})} \Big) > $$ > > for all $\mathbf{x} \in \mathbb{R}^3$ and $i \in \{1, 2, 3\}$. ??? note "*Proof*:" Will be added later. We may also give the divergence for ortho-curvilinear coordinate systems. > *Corollary*: the divergence of a flux density $\mathbf{\Gamma}: \mathbb{R}^3 \to \mathbb{R}^3$ for a ortho-curvilinear coordinate system is given by > > $$ > \nabla \cdot \mathbf{\Gamma}(\mathbf{x}, t) = \frac{1}{h_1h_2h_3} \partial_i \Big(\Gamma^{(i)}(\mathbf{x},t)\frac{1}{h_i} h_1 h_2 h_3 \Big) > $$ > > for all $\mathbf{x} \in \mathbb{R}^3$ and $i \in \{1, 2, 3\}$. ??? note "*Proof*:" Will be added later. Please note that the scaling factors may also depend on the position $\mathbf{x} \in \mathbb{R}^3$ depending on the coordinate system. It has been found that the volume integral over the divergence of a vector field is equal to the integral of the vector field itself over the surface that bounds the volume. It is known as the divergence theorem and is given below. > *Theorem*: for a volume $V \subset \mathbb{R}^3$ with a closed and orientable boundary surface $A \subset V$ with a continuously differentiable flux density $\mathbf{\Gamma}: \mathbb{R}^4 \to \mathbb{R}^3$ we have that > > $$ > \int_A \Big\langle \mathbf{\Gamma}(\mathbf{x}, t), d\mathbf{A} \Big\rangle = \int_V \nabla \cdot \mathbf{\Gamma}(\mathbf{x}, t) dV, > $$ > > for all $t \in \mathbb{R}$. ??? note "*Proof*:" Will be added later.