DeriveDivergenceOfVelocity

how to compute the divergence of velocity from mass conservation

The divergence of the velocity can be computed by considering the equation of mass conservation: \begin{align}\dot{\rho }=-\rho \left( \nabla ^{T}\mathbf{v} \right)\end{align} Out of this, it follows \begin{align}\begin{array}{*{35}{l}} \left( \nabla ^{T}\mathbf{v} \right)^{n+1} & =-\frac{d}{dt}\left( \log \left( \rho ^{n+1} \right) \right) \\ {} & \approx -\frac{1}{\Delta t}\left( \log \left( \rho ^{n+1} \right)-\log \left( \rho ^{n} \right) \right) \\ \end{array}\end{align} For numerical reasons it is preferable to define the intermediate density \begin{align}\rho _{dyn}^{n}\equiv \rho \left( t^{n},p_{hyd}^{n}+p_{dyn}^{n},A_{v}^{n-1} \right)\end{align} That means the density as it is given after the computation of the velocity, hydrostatic and dynamic pressure, but before the computation of all additional variables \( A_{v}^{n}\). Hence, we rewrite the formulation of the divergence of velocity by \begin{align}\left( \nabla ^{T}\mathbf{v} \right)^{n+1}\approx -\frac{1}{\Delta t}\left( \log \left( \rho _{dyn}^{n+1} \right)-\log \left( \rho _{dyn}^{n} \right) \right)\end{align} Splitting this equation into a hydrostatic and a dynamic part yields \begin{align}\begin{array}{*{35}{l}} \left( \nabla ^{T}\mathbf{v} \right)^{n+1} & \approx -\frac{1}{\Delta t}\left( \log \left( \rho _{dyn}^{n+1} \right)-\log \left( \rho _{dyn}^{n} \right) \right) \\ {} & \approx -\frac{1}{\Delta t}\left( \log \left( \rho \left( t^{n+1},p_{hyd}^{n}+p_{dyn}^{n+1},A_{v}^{n} \right) \right)+\frac{1}{\rho }\frac{\partial \rho }{\partial p}\left( p_{hyd}^{n+1}-p_{hyd}^{n} \right)-\log \left( \rho _{dyn}^{n} \right) \right) \\ {} & \approx -\frac{1}{\Delta t}\left( \log \left( \rho \left( t^{n+1},p_{hyd}^{n}+p_{dyn}^{n+1},A_{v}^{n} \right) \right)-\log \left( \rho _{dyn}^{n} \right) \right)-\frac{1}{\Delta t}\left( \frac{1}{\rho }\frac{\partial \rho }{\partial p}\left( p_{hyd}^{n+1}-p_{hyd}^{n} \right) \right) \\ {} & \approx \left( \nabla ^{T}\mathbf{v} \right)_{dyn}^{n+1}+\left( \nabla ^{T}\mathbf{v} \right)_{hyd}^{n+1} \\ \end{array}\end{align} Thus, the definitions for hydrostatic and dynamic compression rates follow as \begin{align}\left( \nabla ^{T}\mathbf{v} \right)_{hyd}^{n+1}\equiv -\frac{1}{\Delta t}\left( \frac{1}{\rho }\frac{\partial \rho }{\partial p}\left( p_{hyd}^{n+1}-p_{hyd}^{n} \right) \right)\end{align} and \begin{align}\begin{array}{*{35}{l}} \left( \nabla ^{T}\mathbf{v} \right)_{dyn}^{n+1} & \equiv -\frac{1}{\Delta t}\left( \log \left( \rho \left( t^{n+1},p_{hyd}^{n}+p_{dyn}^{n+1},A_{v}^{n} \right) \right)-\log \left( \rho _{dyn}^{n} \right) \right) \\ {} & \text{= }-\frac{1}{\Delta t}\left( \frac{1}{\rho }\frac{\partial \rho }{\partial p}\left( p_{dyn}^{n+1}-p_{dyn}^{n} \right)+\log \left( \rho \left( t^{n+1},p_{hyd}^{n}+p_{dyn}^{n},A_{v}^{n} \right) \right)-\log \left( \rho _{dyn}^{n} \right) \right) \\ {} & =-\frac{1}{\Delta t}\frac{1}{\rho }\frac{\partial \rho }{\partial p}\left( p_{dyn}^{n+1}-p_{dyn}^{n} \right)-\frac{1}{\Delta t}\left( \log \left( \rho \left( t^{n+1},p_{hyd}^{n}+p_{dyn}^{n},A_{v}^{n} \right) \right)-\log \left( \rho _{dyn}^{n} \right) \right) \\ {} & =-\frac{1}{\Delta t}\frac{1}{\rho }\frac{\partial \rho }{\partial p}\left( p_{dyn}^{n+1}-p_{dyn}^{n} \right)+\overline{\left( \nabla ^{T}\mathbf{v} \right)}_{dyn}^{n+1} \\ \end{array}\end{align} where we have \begin{align}\overline{\left( \nabla ^{T}\mathbf{v} \right)}_{dyn}^{n+1}\equiv -\frac{1}{\Delta t}\left( \log \left( \rho \left( t^{n+1},p_{hyd}^{n}+p_{dyn}^{n},A_{v}^{n} \right) \right)-\log \left( \rho _{dyn}^{n} \right) \right)\end{align} Remarks :
  • The term \( \overline{\left( \nabla ^{T}\mathbf{v} \right)}_{dyn}^{n+1}\) represents the compression/expansion of the material that is independent of the pressure, i.e. compression due to time, reaction kinetics, temperature change etc. It is stored in the variable %ind_div_bar_pDyn%
  • The term \( \rho_{dyn}^n\) is the computed density right after the DynamicPressure (see also DynamicPressureAlgorithm) is solved. It is stored in the variable %ind_r_pDyn% .