Pressure/Continuity
This page describes a “process”. Refer to Physical Processes for general information about processes and their implementation.
The pressure solver enforces the continuity equation by subtracting the gradient of a pressure-like variable $ϕ$ from the momentum equation, i.e.
\[\frac{∂u_i}{∂t} = … - \frac{∂ϕ}{∂x_i} \quad \text{such that} \quad \frac{∂u_i}{∂x_i} = 0\]
with the additional constraint that $\int\int ϕ(x₁, x₂, x₃(0)) \, \mathrm{d}x₁ \mathrm{d}x₂ = 0$ to pin the magnitude of $ϕ$ to an arbitrary value. The process is implemented as a Projection.
BoundaryLayerDynamics.Processes.Pressure
— TypePressure(batch_size = 64)
Transport of momentum by a pressure-like variable that enforces a divergence-free velocity field.
Arguments
batch_size::Int
: The number of wavenumber pairs that are included in each batch of the tri-diagonal solver. The batching serves to stagger the computation such that different MPI ranks can work on different batches at the same time.
Discretization
After discretization, the computation becomes
\[\begin{aligned} f_i(\hat{u}₁^{κ₁κ₂ζ_C}) &= - ∂₁(κ₁) \, \hat{ϕ}^{κ₁κ₂ζ_C} \\ f_i(\hat{u}₂^{κ₁κ₂ζ_C}) &= - ∂₂(κ₂) \, \hat{ϕ}^{κ₁κ₂ζ_C} \\ f_i(\hat{u}₃^{κ₁κ₂ζ_I}) &= - ∂₃(ζ_I) \left(\hat{ϕ}^{κ₁κ₂ζ_I^+} - \hat{ϕ}^{κ₁κ₂ζ_I^−}\right) \end{aligned}\]
such that
\[∂₁(κ₁) \, \hat{u}₁^{κ₁κ₂ζ_C} + ∂₂(κ₂) \, \hat{u}₂^{κ₁κ₂ζ_C} + ∂₃(ζ_C) \left( \hat{u}₃^{κ₁κ₂ζ_C^+} - \hat{u}₃^{κ₁κ₂ζ_C^−} \right) = 0\]
with the constraint that $\hat{ϕ}⁰⁰⁰=0$. These equations make up the linear operators $F_i$ and $C_i$ of the Projection while $\bm{c}_i$ can have non-zero entries from the boundary conditions of $\bm{\hat{u}}₃$
Since both the gradient and the divergence are linear processes, there is no coupling between different wavenumber pairs $(κ₁,κ₂)$ in the $(C_i F_i)$ operator and each pair forms an independent symmetric tridiagonal system of size $N₃×N₃$. These are solved with the Thomas algorithm (see Quarteroni, Sacco & Saleri, 2007). As each solution requires communication between all processes, the wavenumber pairs are handled in batches of configurable size, where larger batches reduce the overhead but decrease the parallelism.
Contributions to Budget Equations
Contribution to the instantaneous momentum equation:
\[\frac{\partial}{\partial t} u_i = … - \frac{\partial \phi}{\partial x_i}\]
Contribution to the mean momentum equation:
\[\frac{\partial}{\partial t} \overline{u_i} = … - \frac{\partial \overline{\phi}}{\partial x_i}\]
Contribution to the turbulent momentum equation:
\[\frac{\partial}{\partial t} u_i^\prime = … - \frac{\partial \phi^\prime}{\partial x_i}\]
Contribution to the mean kinetic energy equation:
\[\frac{\partial}{\partial t} \frac{\overline{u_i}^2}{2} = … - \frac{\partial \overline{u_i} \overline{\phi}}{\partial x_i}\]
Contribution to the turbulent kinetic energy equation:
\[\frac{\partial}{\partial t} \frac{\overline{u_i^\prime u_i^\prime}}{2} = … - \frac{\partial \overline{u_i^\prime \phi^\prime}}{\partial x_i}\]
Discrete Conservation Properties
The pressure term (including contributions from the rotational advection term) preserves the total kinetic energy to machine precision both without and with grid stretching (in the absence of time-integration errors).
Analytically, we can show that the pressure term conserves energy using integration by parts (with vanishing $u₃$ at the boundary) to show that
\[\frac{∂}{∂t} \int_V \frac{u_i^2}{2} \mathrm{d}V = … − \int_V u_i \frac{∂ϕ}{∂x_i} \mathrm{d}V = … + \int_V ϕ \frac{∂u_i}{∂x_i} \mathrm{d}V \;,\]
which is zero due to the continuity equation.
For the discretized equations we have
\[\sum_{ζ_C} u₁(ζ_C) \left.\frac{∂ϕ}{∂x₁}\right|_{ζ_C} \left.\frac{∂x₃}{∂ζ}\right|_{ζ_C} + \sum_{ζ_C} u₂(ζ_C) \left.\frac{∂ϕ}{∂x₂}\right|_{ζ_C} \left.\frac{∂x₃}{∂ζ}\right|_{ζ_C} + \sum_{ζ_I} u₃(ζ_I) \left.\frac{∂ϕ}{∂x₃}\right|_{ζ_I} \left.\frac{∂x₃}{∂ζ}\right|_{ζ_I} = 0 \;.\]
For the horizontal derivatives, the integration by parts holds exactly since no approximations are made when computing derivatives or evaluating the horizontal mean. For the vertical derivatives, we can sum over $ζ_C$ instead of $ζ_I$ to get
\[\sum_{ζ_I} u₃(ζ_I) \left(\frac{ϕ(ζ_I⁺) - ϕ(ζ_I⁻)}{Δζ} \left.\frac{∂ζ}{∂x₃}\right|_{ζ_I} \right) \left.\frac{∂x₃}{∂ζ}\right|_{ζ_I} = - \sum_{ζ_C} ϕ(ζ_C) \left( \frac{u₃(ζ_C⁺) - u₃(ζ_C⁻)}{Δζ} \left.\frac{∂ζ}{∂x₃}\right|_{ζ_C} \right) \left.\frac{∂x₃}{∂ζ}\right|_{ζ_C}\]
for any wavenumber (the grid-stretching terms cancel on both sides). The contributions therefore add up to
\[- \sum_{ζ_C} ϕ(ζ_C) \left( \left.\frac{∂u₁}{∂x₁}\right|_{ζ_C} + \left.\frac{∂u₂}{∂x₂}\right|_{ζ_C} + \frac{u₃(ζ_C⁺) - u₃(ζ_C⁻)}{Δζ} \left.\frac{∂ζ}{∂x₃}\right|_{ζ_C} \right) \left.\frac{∂x₃}{∂ζ}\right|_{ζ_C} = 0\]
as the part in the parentheses is zero due to the discrete continuity equation.