Splitting schemes#
Author: Jørgen S. Dokken
As described in [MVS15] Oasisx uses a fractional step method for solving the Navier-Stokes equations. This means that we are solving the set of equations:
Find \(\mathbf{u}\in \mathbf{V}_h, p \in \mathbf{Q}\) such that over \(\Omega\subset \mathbb{R}^d\)
where \(\mathbf{u} = (u_1(\mathbf{x}, t), \dots, u_d(\mathbf{x}, t))\) is the velocity vector, \(\nu\) the kinematic viscosity, \(p(\mathbf{x}, t)\) the fluid pressure and \(\mathbf{f}(\mathbf{x}, t)\) are the volumetric forces. The fluid density is incorporated with the pressure \(p\). We use the a pseudo-traction boundary condition on \(\partial\Omega_N\), where \(h=0\) corresponds to the natural boundary condition. We use \(\frac{\partial{\cdot}}{\partial \mathbf{n}}= \mathbf{n}^T(\nabla\cdot)\).
We assume that \(\partial\Omega=\partial\Omega_N\cup \partial \Omega_D\), \(\partial \Omega_N \cap \partial \Omega_D = \emptyset\). If \(\partial \Omega_N = \emptyset\) we have the additional constraints
For the initial condition, we have that \(\mathbf{u}(x, 0)=\mathbf{u}_0\), where \(\nabla \cdot \mathbf{u}_0=0\) and \(\mathbf{u}_0\cdot \mathbf{n} = \mathbf{g}(x,0)\cdot \mathbf{n}\).
Stokes equation#
The following section will follow a similar derivation as done by Timmermans [TMVanDVosse96]. We start by considering a simpler problem, namely solving
We use a Crank-Nicolson discretization in time, and thus want to solve
However, we do not want to solve this coupled set of equations, and instead solve for \(\mathbf{u}^n\) and \(p^{n-\frac{1}{2}}\) in a segregated fashion. We start by selecting a \(p^\star\) such that \(p^\star = p^{n-\frac{1}{2}} + \mathcal{O}(\Delta t)\). A common choice is to use \(p^\star= p^{n-\frac{3}{2}}\).
We next solve the following problem
We subtract the equation for \(\mathbf{u^*}\) from the equation for \(\mathbf{u}^n\) to obtain
By taking the divergence of this equation we obtain
We use the fact that \(\nabla \cdot \mathbf{u}^n = 0\) and the identitiy \(\nabla \cdot \Delta \mathbf{T} = \nabla \cdot \nabla (\nabla \cdot \mathbf{T})- \nabla \cdot (\nabla \times(\nabla \times \mathbf{T}) ) = \Delta (\nabla \cdot \mathbf{T})\) as \(\nabla \cdot (\nabla \times L) = 0 \quad \forall L\) we can simplify our equation
which means that we can conclude with
Setting \(\phi = p^{n-\frac{1}{2}} - p^* + \frac{\nu}{2}\nabla \cdot \mathbf{u}^\star\). We can solve this Poisson-type problem for \(\phi\). We can then project the pressure \(p^{n-\frac{1}{2}}=p^*+\phi-\frac{\nu}{2}\nabla \cdot \mathbf{u}^*\).
To get an expression for \(\mathbf{u}^n\) we use that \(\mathbf{u}^n = \mathbf{u}^\star + D\) and that
From the pressure correction equation we have that \(\nabla \cdot \mathbf{u}^\star = \Delta t \Delta \phi= \Delta t \nabla \cdot \nabla \phi\). Thus by setting \(D=-\Delta t \nabla \phi\) we have that \(\mathbf{u}^{n}\) is divergence free.
Concluding we solve the following equations
Tentative velocity#
Pressure correction#
Velocity correction#
Essential boundary conditions#
We note that we have not specified boundary conditions for the pressure correction.
Assume that \(\partial \Omega_N=\emptyset\), we then use that \(u^*=\mathbf{g}^n\) on the whole boundary, and the flux condition of \(\mathbf{g}\) over \(\partial\Omega\). We integrate the pressure correction equation over \(\Omega\) (using the divergence theorem)
Thus we use that \(\frac{\partial \phi}{\partial n}=0\) on \(\partial \Omega\).
It has been discussed in many papers that one could use \(\phi=0\) on \(\partial\Omega_D\), see for instance chapter 10 of [GMS06]. In [GMS05] it is shown that by using the rotational form of the equations (i.e. including the divergence term in \(\phi\)) yield reasonable error estimates.
However, if \(\partial \Omega_N\neq\emptyset\), then we need to consider the open boundary conditions for the pressure correction schemes, see the next section or [GS04]
Also note that we have lost control of the tangential part of the corrected velocity, as we do not have that \(\mathbf{u}^n\cdot \mathbf{t} = \mathbf{u}^\star \cdot \mathbf{t} - \Delta t \nabla \phi \cdot \mathbf{t}\neq\mathbf{g}^n\) as \(\nabla \phi \cdot \mathbf{t}\neq 0\).
Implementational aspects#
We start by considering the tentative velocity step.
We use integration by parts and multiplication with a test function \(v\) to obtain
As \(u_k^I\) is the unknown, we use \(u_k^I=\sum_{i=0}^Mc_{k,i} \phi_i(\mathbf{x})\), where \(c_{k,i}\) is the unknown coefficients, \(\phi_i\) is the global basis functions of \(u_k^I\). We have that \(u_k^{n-1}, u_k^{n-2}\) can be written as \(u_k^{n-l}=\sum_{i=0}^M c_{k_i}i^{n-l} \phi_i\), where \(c_i^{n-l}\) are the known coefficients from previous time steps. We write \(p^* = \sum_{q=0}^Qr_q\psi_q(\mathbf{x})\). Summarizing, we have
where
In Oasis [MVS15], one uses the fact that \(M\), \(K\) and \(C\) is needed for the LHS of the variational problem, to avoid assembling them as vectors on the right hand side, and simply use matrix vector products and scaling to create the RHS vector from these pre-assembled matrices.
We also note that \(M\) and \(K\) are time independent, and thus only \(C\) has to be assembled at every time step.
A difference between Oasis and the current implementation is that we implement the pressure condition as the natural boundary condition, and any supplied pressure \(h\) will be part of the right hand side of the tentative velocity equation.
In Oasis, the choice of not including this term ment that one would have to re-assemble \(\int_\Omega \nabla_k p^*v~\mathrm{d}x\) in every inner iteration. In the current implementation, we have that \(\int_\Omega p^*\nabla_k v~\mathrm{d}x + \int_{\partial\Omega_N}h^{n-\frac{1}{2}}v~\mathrm{d}s\) has to be reassembled. As the boundary integral \(\partial\Omega_N\) usually is small compared to the volume of the computational domain, this is a minimal increase in assembly time.
Matrix-vector product#
An algorithm for computing the matrix vector product follows
M = assemble_mass_matrix()
K = assemble_stiffness_matrix()
for i in range(num_time_steps):
# Compute convecting velocity for C
for j in range(components):
bar_u[j][:] = 0
bar_u[j]+= 1.5 * u_1[j]
bar_u[j]+= -0.5 * u_2[j]
# Compute 0.5C
A = assemble_C_matrix()
A.scale(0.5)
# Add mass matrix
A.axpy(1/dt, M)
#Add stiffness matrix
A.axpy(-0.5*nu, K)
# Compute matrix vector product and add to RHS
for j in range(components):
b[j] = body_forces
b_tmp[j] = A * u_1[j]
b[j]+= b_tmp[j]
# Reset A for LHS
A.scale(-1)
A.xpy(2/dt, M)
#
where \(u_i\), \(i=1,2\) is the solution at time-step \(n-i\).
Action method#
As the matrix \(A\) is sparse and potentially large (millions of degrees of freedom), we consider assembling b
directly.
M = assemble_mass_matrix()
K = assemble_stiffness_matrix()
for i in range(num_time_steps):
# Compute convecting veloctiy for C
for j in range(components):
bar_u[j][:] = 0
bar_u[j]+= 1.5 * u_1[j]
bar_u[j]+= -0.5 * u_2[j]
# Assemble RHS
for j in range(components):
b[j] = assemble_vector(body_forces[j] + mass_terms[j] \
+ stiffness_terms[j] + convective_terms[j])
# Compute -0.5C
A = assemble_C_matrix()
A.scale(-0.5)
# Add mass matrix
A.axpy(-1/dt, M)
#Add stiffness matrix
A.axpy(0.5*nu, K)
In the next section, we will consider the performance differences for these two strategies
References
J Guermond and Jie Shen. On the error estimates for the rotational pressure-correction projection methods. Mathematics of Computation, 73(248):1719–1737, 2004. doi:10.1090/S0025-5718-03-01621-1.
J. L. Guermond, P. Minev, and J. Shen. Error analysis of pressure-correction schemes for the time-dependent stokes equations with open boundary conditions. SIAM Journal on Numerical Analysis, 43(1):239–258, 2005. doi:10.1137/040604418.
J.L. Guermond, P. Minev, and Jie Shen. An overview of projection methods for incompressible flows. Computer Methods in Applied Mechanics and Engineering, 195(44):6011–6045, 2006. doi:10.1016/j.cma.2005.10.010.
Mikael Mortensen and Kristian Valen-Sendstad. Oasis: A high-level/high-performance open source Navier-Stokes solver. Computer Physics Communications, 188:177–188, 2015. doi:10.1016/j.cpc.2014.10.026.
A. Poux, S. Glockner, and M. Azaïez. Improvements on open and traction boundary conditions for Navier-Stokes time-splitting methods. Journal of Computational Physics, 230(10):4011–4027, 2011. doi:10.1016/j.jcp.2011.02.024.
J.C. Simo and F. Armero. Unconditional stability and long-term behavior of transient algorithms for the incompressible Navier-Stokes and Euler equations. Computer Methods in Applied Mechanics and Engineering, 111(1):111–154, 1994. doi:10.1016/0045-7825(94)90042-6.
LJP Timmermans, PD Minev, and FN Van De Vosse. An approximate projection scheme for incompressible flow using spectral elements. International Journal for Numerical Methods in Fluids, 22(7):673–688, 1996. doi:10.1002/(SICI)1097-0363(19960415)22:7<673::AID-FLD373>3.0.CO;2-O.