02_massConservation
0. Preface
The mass conservation equation, also known as the continuity equation, essentially represents mass conservation.
We refer to the book Computational fluid dynamics: the basics with applications and discuss it from different perspectives using various approaches.
This article mainly discusses:
- Derivation of the continuity equation
- Transformation between different forms
- Understanding the physical meaning of mathematical expressions
1. Control Volume Model
Assume we take a fixed control volume with volume . Using Eulerian description, we can establish conservation for the control volume system.
Mass outflow through control volume surface per unit time B = Decrease in fluid mass within control volume per unit time C
1.1. Mass Outflow
For mass outflow B, consider the area element (unit area) of this control volume system:
Mass outflow per unit time = Fluid mass flowing through this area element per unit time
The mass flow rate per unit time per unit area is the mass flux:
Mass flux = Unit time ร Fluid velocity through this area element ร Unit area ร Density
Written in mathematical form:
Tip
Whether from the perspective of mathematical integration or physics, we agree that the positive direction of is outward from the control volume:
- If velocity is outward, Flux is positive, physically indicating fluid leaving the control volume
- If velocity is inward, Flux is negative, physically indicating fluid entering the control volume
Integrating over the surface of this control volume:
1.2. Mass Decrease
For mass decrease C, consider the total mass of the control volume:
Since the control volume does not change position, there is no convective change, so we calculate the Eulerian derivative for the control volume based on Eulerian description.
Considering the total mass change of the control volume is “decrease,” while mathematical differentiation only gives the rate of change, we also need to consider the sign:
Since the volume integral of the control volume is independent of time, and the integration limits are constant:
1.3. Mass Conservation
According to the conservation relationship:
Applying the divergence theorem:
Rearranging, we obtain:
ใConservative Integral Form of Continuity Equationใ
2. Material Volume Model
Assume we take a material volume that moves with the fluid flow, with volume . Based on Lagrangian description, we can consider the change of the material volume.
The mass of the material volume is:
Caution
Although the mathematical expressions for calculating material volume mass and control volume mass are similar, they are different from a physical perspective.
Based on Lagrangian description, we calculate the Lagrangian derivative for the material volume, and we know the mass of the material volume does not change:
ใNon-conservative Integral Form of Continuity Equationใ
Note: The following approach of applying the material derivative is incorrect; we will discuss this later. Readers can think about the reason first:
3. Control Volume Element Model
Assume we take an infinitesimal control volume element model. Based on Eulerian description, we consider the conservation of the control volume element system.

On this infinitesimal control volume element, physical quantities like velocity are continuous functions and can be Taylor expanded.
Taking the direction as an example, the mass flux on the left face of the control volume element is:
According to Taylor expansion of continuous physical quantities, on the right side we have:
Based on the infinitesimal assumption of this control volume element, omitting second-order and higher terms, rearranged as:
The difference in mass flux between the left and right faces of the element in the direction is:
Similarly, the net mass flux in the and directions is:
The total mass flux of this control volume element is:
The mass of the control volume element is:
The time rate of increase of this element’s mass (Eulerian derivative of control volume) is:
The total mass flux of the control volume element always equals the decrease in its mass, so:
Rearranging:
ใConservative Differential Form of Continuity Equationใ
4. Material Volume Element Model
Assume we take an infinitesimal material volume element model. Based on Lagrangian description, we consider the change of this system.
For this infinitesimal material volume element, its mass is:
Based on Lagrangian description, we calculate the Lagrangian derivative for the material volume, and we know the mass of the material volume does not change:
After rearranging:
Rearranged as:
Based on previous discussion of velocity divergence:
ใNon-conservative Differential Form of Continuity Equationใ
5. Conversion Relationships
The Reynolds transport theorem is as follows:
The mass equation only considers mass transport, so:
Rearranged as:
We can see that this includes the ใConservative Integral Form of Continuity Equationใ.
Since the material volume and control volume are arbitrarily chosen, the integrand of the above equation is also zero everywhere. The integrated part is exactly the ใConservative Differential Form of Continuity Equationใ and ใNon-conservative Differential Form of Continuity Equationใ.
For the material volume model:
Note that the volume of the material volume may change over time. Only when we assume the volume also does not change with time, i.e., (see discussion on velocity divergence):
Note
We have:
For material volume:
When volume is constant, we can see that density is also constant, meaning incompressible fluid.
But note: here we are discussing material volume. Even if a container maintains constant volume, the heated gas inside still has physical properties of compression and expansion; it is not an incompressible fluid.
At this point, expanding:
It can be seen that the rearranged result is consistent with the Reynolds transport theorem.
From a mathematical perspective, the integrand in integral form can have discontinuities, while differential form equations require differentiability, hence continuity. The divergence theorem requires mathematical continuity. When flow contains discontinuities, such as shock waves, the choice of continuity equation form becomes very important.
Overall, based on material derivative and divergence expansion, there is always a conversion relationship between non-conservative and conservative forms:
That is, the previously mentioned ใReynolds Transport Conversionใ:
This conversion relationship further:
Expanding the first term on the right side of Reynolds transport conversion:
Rearranging:
Expanding the second term on the right side of Reynolds transport conversion (those who don’t understand should review divergence calculation):
Rearranging:
We have the material derivative:
Rearranging:
Continuing to rearrange:
The middle term on the right side is the conservative differential form of the mass equation, equal to zero.
So we have:
ใMaterial Derivative Conversionใ
Substituting into Reynolds transport conversion:
Rearranging:
If the flow is incompressible (), then:
We tentatively call this ใReynolds Transport Second Conversionใ.
Regarding the integral and differential forms, conservative and non-conservative forms of the mass equation, it is believed that readers now fully understand their relationships and conversions.
Tip
Various forms of conversion may seem messy at first glance. Precisely to help readersๆ่ฑ this messy feeling is the purpose of conversion discussion. Readers are encouraged to personally derive various expressions by hand.
6. Supplementary Discussion
- OpenFOAM uses the finite volume method, i.e., uses the conservative integral form continuity equation:
- For incompressible flow, density is constant (does not change with time and space in Lagrangian description):
Note: “density constant” here does not mean density is constant everywhere in the flow, but that density is constant along specific streamlines (if confused, recall previous discussion: the total differential with respect to time is somewhat Lagrangian, i.e., ).
For:
We can obtain:
The divergence of velocity is the volume change per unit time per unit volume. For incompressible fluid, velocity divergence is zero, which also indicates its volume does not change, i.e., incompressible. This is consistent with previous discussion.
- Steady flow:
For steady flow:
Considering the conservative integral form continuity equation:
We can obtain:
Expanding:
If the fluid is incompressible, further obtaining:
Meaning the fluid velocity vector is perpendicular to the density gradient direction. That is, when fluid moves along streamlines (velocity direction), density does not change.
In other words, for steady incompressible fluid, density is constant along streamlines.
7. Summary
The author stillๅฐๅฆ recommends readers personally derive formulas by hand. It is believed that after hand-deriving formulas, readers can appreciate the joy of their mathematical and physical self-consistency, coming and goingๅๆปก.
This article completes discussion of:
- Derivation of mass conservation equation
- Transformation between different forms
- Understanding the physical meaning of mathematical expressions
References
[1] The Finite Volume Method in Computational Fluid Dynamics, https://link.springer.com/book/10.1007/978-3-319-16874-6
[2] Computational fluid dynamics : the basics with applications, https://searchworks.stanford.edu/view/2989631
[3] Mathematics, Numerics, Derivations and OpenFOAMยฎ, https://holzmann-cfd.com/community/publications/mathematics-numerics-derivations-and-openfoam-free
[4] Notes on Computational Fluid Dynamics: General Principles, https://doc.cfd.direct/notes/cfd-general-principles/
Support us
Tip
Hopefully, the sharing here can be helpful to you.
If you find this content helpful, your comments or donations would be greatly appreciated. Your support helps ensure the ongoing updates, corrections, refinements, and improvements to this and future series, ultimately benefiting new readers as well.
The information and message provided during donation will be displayed as an acknowledgment of your support.
Copyright @ 2026 Aerosand
- Course (text, images, etc.): CC BY-NC-SA 4.0
- Code derived from OpenFOAM: GPL v3
- Other code: MIT License
