# Does mass balance hold in convective diffusion

I'm trying to understand how convection-diffusion equations are solved in pipe flow modules available in CFD solvers.

$$\frac{\partial C}{\partial t} + \nabla \cdot (\mathbf{v} C) = \nabla \cdot (D \nabla C).$$ Flux is given by $$N = - D\nabla C + \mathbf{v}C$$

in pipe flow module in COMSOL.

If the pipe section with varying diameter is considered, shouldn't the solute transport equation contain the cross-sectional area?

Moreover, it's not clear to me how mass is conserved while solving convection-diffusion of solutes. Because, for the transport of dilute solute species, the velocity in the solute transport equation is obtained by solving the convective flow balance.

Could someone explain?

• The equation you state holds true for the concentration of a solute at every point in a liquid. The diameter of the pipe doesn't enter that consideration: You just have a domain occupied by a flowing fluid, and that domain is where we consider the concentration. If, on the other hand, you want to derive a model in which you only consider the average velocity along a pipe, and the average concentration (averaged over the cross section, but variable along the axis of the pipe), then you need a different set of equations. – Wolfgang Bangerth Dec 5 '19 at 20:12
• @WolfgangBangerth Thanks a lot. That's exactly what I am trying to do, " consider the average velocity along a pipe, and the average concentration (averaged over the cross-section, but variable along the axis of the pipe)". I've been trying to use the following equation, $$\frac{\partial}{\partial t} (AC) + \frac{\partial}{\partial x} (v C A) = \frac{\partial}{\partial x} \left(A D \frac{\partial C}{\partial x} \right).$$ . v, the average velocity is obtained by solving the continuity equation at the junctions where a pipe diverges or converges. – Natasha Dec 6 '19 at 3:45
• At the junction where the pipe branches , the diameter of the pipes will change . And for instance, if I want to find the change in concentration of the species i at the junction I'm not sure what area has to be used in the discretization scheme. The pipe section before it diverges will have a different are and after branching will have smaller cross-sectional area. – Natasha Dec 6 '19 at 3:47
• @WolfgangBangerth Sorry for the silly question in the above comment. I understand there is no differential equation at the junction node. You had already mentioned this in a previous post. – Natasha Dec 9 '19 at 2:08

Mass is conserved always. That's the known fact. To show this holds true in convection-diffusion equation, I need to introduce material derivative to you. The material derivative of a scalar quantity as $$C(\mathbf{r},t)$$ is defined as:

$$\frac{D C(\mathbf{r},t)}{D t} = \frac{\partial C}{\partial t} + \mathbf{v} \cdot \nabla C$$

Where $$\mathbf{v}$$ is the fluid velocity field. The material derivative simply means that change of $$C$$ with respect to time could be interpreted from two separate sources. First expression $$\frac{\partial C}{\partial t}$$ says if $$C$$ changes with time explicitly certainly you would get change of $$C$$ with respect to time. Pretty obvious right? But on the other hand the term $$\mathbf{v} \cdot \nabla C$$ says you don't need always to have an explicit change of $$C$$ with respect to time to get an overal change of $$C$$ when time goes in forward direction. As long as you have a gradient for $$C$$ variable ($$\nabla C \neq 0$$) the advection of $$C$$ quantity because of fluid medium velocity would also change $$C$$ variable with respect to time.

Overall mass change with respect to time must be zero or in another word total mass is conserved. That's the known physical fact. In math language:

$$\frac{d}{dt} \int_{\Omega} C(\mathbf{r},t) d^{3}\mathbf{r} = 0$$

In the above equation $$\Omega$$ is your 3D domain, which could be anything such as pipe, sphere, cube, unstructured shape or whatever, which doesn't matter here really. I could rewrite above equation as:

$$\frac{d}{dt} \int_{\Omega} C(\mathbf{r},t) d^{3}\mathbf{r} = \int_{\Omega} \frac{D C(\mathbf{r},t)}{D t} d^{3}\mathbf{r}$$

In the conservative form, you have this convection-diffusion equation:

$$\frac{\partial C}{\partial t} + \nabla \cdot (-D \nabla C + \mathbf{v}C) = 0$$

Or:

$$\frac{\partial C}{\partial t} + \mathbf{v} \cdot \nabla C + C (\nabla \cdot \mathbf{v}) + \nabla \cdot (-D \nabla C) = 0$$

For incompressible flow, it's really easy. Cause you have: $$\nabla \cdot \mathbf{v} = 0$$, but for more complex compressible flow system, I put the effort of using continuity equation ($$\frac{\partial \rho}{\partial t} + \nabla \cdot (\rho \mathbf{v}) = 0$$) as your homework. So finally, you get this:

$$\frac{\partial C}{\partial t} + \mathbf{v} \cdot \nabla C + \nabla \cdot (-D \nabla C) = 0$$

Or:

$$\frac{D C(\mathbf{r},t)}{D t} = -\nabla \cdot (-D \nabla C)$$

Finally:

$$\frac{d}{dt} \int_{\Omega} C(\mathbf{r},t) d^{3} \mathbf{r} = -\int_{\Omega} \nabla \cdot (-D \nabla C) d^{3} \mathbf{r}$$

By using Divergence integral theorem:

$$\frac{d}{dt} \int_{\Omega} C(\mathbf{r},t) d^{3} \mathbf{r} = -\int_{\partial \Omega} -D \nabla C \cdot d \mathcal{A}$$

Now, we need furthermore explanation of diffusion mechanism. You saw convection definition, when I tried to explain material derivative to you, now you see $$-D\nabla C$$ as an another mechanism of change of $$C$$ with respect to time by diffusion of fluids' atoms. Of course, because again the conservation of mass is a known physical fact, the last integral ($$\int_{\partial \Omega} -D \nabla C \cdot \mathcal{A}$$) must be zero due to the fact the overall flux that goes inside and will go outside of $$\Omega$$ domain from its boundaries $$\partial \Omega$$ must be zero because of mass conservation.

So:

$$\frac{d}{dt} \int_{\Omega} C(\mathbf{r},t) d^{3} \mathbf{r} = 0$$

The above expression is always true no matter if your diffusion is Fickian or not or even if you have some other mechanism of mass transport, such as electrostatic or whatever.

You could think of this more general equation of $$\frac{\partial C}{\partial t} + \nabla \cdot \mathbf{J} = 0$$, where $$\mathbf{J}$$ is mass flux that contains all the mass transport mechanism as this way: any change of $$C$$ mass concentration is compensated by mass flux as long as there is no sink or source of mass.

Also note that the explanation or derivations that I introduced here is not a mathematical proof cause we are talking about physics not mathematics. I did not need to prove for you that $$\frac{d}{dt} \int_{\Omega} C(\mathbf{r},t) d^{3}\mathbf{r} = 0$$ in any mathematical sense cause conservation of mass is a physical known fact, at least in its classical form. All the derivation and equations are provided to give a little bit more explanation about mechanisms.

• Thanks a ton for the detailed explanation. I think I'm confused about this point, in the species transport equation we talk about the sum of convective and diffusive flux while solving for concentrations $\frac{\partial C}{\partial t} + \nabla \cdot \mathbf{J} = 0$. Whereas, in the continuity equation we only look at convective fluxes while solving for velocities. And the velocities that are obtained by solving the continuity equation is used in species-transport equation. – Natasha Dec 6 '19 at 4:03