I am trying to get some appreciation of the concepts of flux and continuity equation in vector analysis. Let's keep ourselves to three spatial dimensions, $x, y$ and $z$
Assume the density is $u:\mathbb{R}^4\rightarrow\mathbb{R}$ where $u (x, y, z, t)$ is the density at $(x, y, z)$ and at time $t$.
Now, from some references, I got to know that flux measures the flow of the substance through a surface, as in electric current density etc. However, in some other places (particularly in a note dealing with differential equations), they model flux density as the gradient of $u(x, y, z, t)$, i.e.
$\mathbf{J}=\frac{\partial u}{\partial x}\mathbf{i}+\frac{\partial u}{\partial y}\mathbf{j}+\frac{\partial u}{\partial z}\mathbf{k}$ is the flux, which is obviously a function of time.
I cannot conceptually reconcile these two apparently different definitions of flux.
Also, is my gradient representation of flux correct, or do we need some other parameter apart from the density function to characterise the flux? In other words, is the density enough to uniquely determine flux?
The flux of a vector field $j$ through a surface $A$ is $$ \Phi = \int\limits_{A=\partial V} j \cdot dA = \int\limits_V \text{div } j \,dV $$ This is a scalar quantity, while a gradient is a vector. Are you sure you did not misread some divergence for a gradient?