$$ \rho\dot{u}=\nabla.\sigma $$

where, $\dot{\nu} = \frac{\partial u}{\partial t} + u.\nabla u$, u is velocity vector ${u,v,w}$ and $\sigma = -PI + 2\mu\nabla^S u$

<aside> 💡 Before going forward, let us look at integration by parts.,

</aside>

Integration by parts is a mathematical technique used to evaluate integrals. Given two functions u and v, the formula for integration by parts is:

$$ \int u dv = uv - \int v du $$

This formula can be used when integrating products of functions. The idea is to choose u and dv such that the integral of v du is easier to evaluate than the original integral. Then, the formula is applied to find the value of the integral.

In the context of the variational form of the Navier-Stokes equations, integration by parts is used to evaluate the terms involving the stress tensor $\sigma$. By applying the formula, the integral involving the gradient of the weight function $w$ can be evaluated more easily.

Form 1:

To write variational form, let us multiply the equation with weight function $w$, (do not confuse this with z-component of velocity! I just like this notation)

$$ \rho \dot{\nu} - \nabla.\sigma = 0 \\ \int_\Omega\rho \dot{\nu} wd\Omega - \int_\Omega\nabla . \sigma wd\Omega = R \\ \int_\Omega\rho \dot{\nu} w d\Omega - \int_\Omega\nabla w:\sigma d\Omega + \color{red}\int_\Gamma w\sigma.n d\Gamma \color{black}= R $$

Form 2:

This is exactly same as the above form, but may help in other implementations as well,

$$ \rho \dot{u} - \nabla.\sigma = 0 \\ \rho \dot{u} - \nabla.(-PI + 2\mu\nabla^S u) = 0 \\ \rho \dot{u} + \nabla.(PI) - \nabla.( 2\mu\nabla^S u) = 0 \\ \color{black}\int_\Omega\rho \dot{u}w + \color{blue}\int_\Omega\nabla.(PI)w -\color{red}\int_\Omega\nabla.( 2\mu\nabla^S u)w \color{black}= R

$$

Apply integration by parts to the pressure and viscous term independently,

$$ \color{red}-\int_\Omega\nabla.( 2\mu\nabla^S u)w dx = \int_\Omega \nabla w.2\mu\nabla^Su .dx - \int_\Gamma w\sigma.nds \\ \color{blue}\int_\Omega\nabla.P wdx = -\int_\Omega \nabla wdx Pdx+\int_\Gamma wP.nds $$

$$ \int_\Omega\rho\dot{u}wdx \color{blue}-\int_\Omega \nabla wdx Pdx+\int_\Gamma wP.nds +\color{red}\int_\Omega \nabla w.2\mu\nabla^Su .dx -(...) \int_\Gamma w(2\mu\nabla^Su).nds = R \\ \color{black}\int_\Omega\rho\dot{u}wdx +\color{green}\int_\Omega\nabla w (\sigma)dx +\color{violet}\int_\Gamma wP.nds - \int_\Gamma w(2\mu\nabla^Su).nds \color{black}= R $$

Neumann boundary conditions are used to specify the flux of a conserved quantity across a boundary. In the context of the Navier-Stokes equations, this corresponds to specifying the normal stress at the boundary.

Dirichlet conditions are used to specify the value of a conserved quantity at a boundary. In the context of the Navier-Stokes equations, this corresponds to specifying the velocity of the fluid at the boundary.