Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Solutions · 13. DEVSS-G stabilization and a coupled two-dimensional log-conformation solver

Worked solutions to the three exercises of Lecture 13. Each solution is computed here and checked with assert statements against an exact identity or an independent calculation. The first code cell sets up the notebook and runs Demonstration 1 of the lecture without showing its output, because some of the solutions use its variables.

Exercise 1

Problem. Check that the DEVSS-G terms do not change the steady solution. Run solve_2d_viscoelastic_cavity with nx=21, ny=21, wi=0.55, beta_s=0.30, re=0.02, n_steps=200 for αdevss∈{0.25,0.55,0.95}\alpha_{\mathrm{devss}} \in \{0.25, 0.55, 0.95\}, and compare the velocity fields and the position of the vortex centre.


Exercise 1: the steady solution for three values of alpha_devss
===============================================================
alpha_devss = 0.25 | vortex = (0.4680, 0.7987) | |dx_c| = 2.193e-04 | RMSE(u - u_0.55) = 3.027e-03
alpha_devss = 0.55 | vortex = (0.4678, 0.8008) | |dx_c| = 0.000e+00 | RMSE(u - u_0.55) = 0.000e+00
alpha_devss = 0.95 | vortex = (0.4681, 0.8024) | |dx_c| = 2.956e-04 | RMSE(u - u_0.55) = 3.225e-03
<Figure size 1155x429 with 2 Axes>

Figure S13.1. Steady cavity flow for three values of α\alpha. (a) Horizontal velocity on the vertical midline. (b) Trace of C\mathbf{C} in the row of cells under the lid. The results agree to within the discretization error.

Explanation. DEVSS-G adds −α(1−βs)∇2u-\alpha(1-\beta_s)\nabla^2\mathbf{u} to the implicit side of the momentum equation and the same quantity, computed from the velocity gradient L\mathbf{L}, to the explicit side. In a converged solution the two cancel except for the difference between their discretizations, which is of second order in the grid spacing. Between the three values of α\alpha the vortex centre moves by less than 3×10−43\times10^{-4} in xx and by 0.004 in yy, and the velocity fields differ by 3×10−33\times10^{-3} in the root-mean-square sense. In this respect the method differs from an added artificial viscosity, which changes the solution.


Exercise 2

Problem. Reduce the solvent viscosity ratio, βs∈{0.50,0.12,0.025}\beta_s \in \{0.50, 0.12, 0.025\}, at Wi=0.40\mathrm{Wi} = 0.40 on a grid of 18×1818 \times 18 cells, and compare the final residual of the velocity without stabilization (alpha_devss=0.0) and with DEVSS-G (alpha_devss=0.80).


Exercise 2: convergence without stabilization as beta_s decreases
=================================================================
beta_s = 0.500 | unstabilized res = 9.188e-05 | DEVSS-G (0.80) res = 9.708e-05 | detC_min = 1.0001
beta_s = 0.120 | unstabilized res = 7.690e-05 | DEVSS-G (0.80) res = 9.193e-05 | detC_min = 1.0001
beta_s = 0.025 | unstabilized res = 2.584e-01 | DEVSS-G (0.80) res = 2.465e-04 | detC_min = 1.0001
<Figure size 792x440 with 1 Axes>

Figure S13.2. Change of the velocity in the last step, without stabilization and with α=0.8\alpha = 0.8, for three solvent viscosity ratios. Without stabilization the run at βs=0.025\beta_s = 0.025 does not converge.

Explanation. For βs=0.50\beta_s = 0.50 and 0.12 both calculations reach a residual of about 10-4. At βs=0.025\beta_s = 0.025 the calculation without stabilization does not converge (its residual is 0.26), while with DEVSS-G the residual is 2.5×10−42.5\times10^{-4}, a factor of 1000 smaller. The conformation tensor stays positive definite in all cases (the smallest determinant is 1.0001). The log-conformation formulation keeps the tensor admissible; a second measure, here DEVSS-G, is needed to keep the momentum equation well conditioned when the solvent viscosity is small.


Exercise 3

Problem. Write a projection step on a staggered grid (uu on vertical faces, vv on horizontal faces, the potential ϕ\phi at cell centres) with your own Poisson solver based on the discrete cosine transform for Neumann conditions. Check that the divergence after the projection is at the level of rounding error, and compare the Poisson solver with viscoelastic_fvm_2d._dct2_poisson_neumann_2d.


Exercise 3: a cosine-transform Poisson solver and the projection step
=====================================================================
Max divergence before Chorin projection : 6.8589
Max divergence after Chorin projection  : 1.661e-13
This solver against the package, Poisson : 0.000e+00
<Figure size 1122x429 with 3 Axes>

Figure S13.3. (a) Divergence of a test velocity field on the staggered grid. (b) Streamlines of the projected field, whose discrete divergence is 1.7×10−131.7 \times 10^{-13} at most.

Explanation. On the staggered grid, the divergence of the discrete gradient (ϕi+1,j−ϕi,j)/h(\phi_{i+1,j} - \phi_{i,j})/h is exactly the five-point Laplacian with Neumann conditions, which the cosine transform inverts. One projection therefore removes the divergence to rounding error: it falls from 6.9 to 1.7×10−131.7\times10^{-13}. The Poisson solver written here and that of the package give identical results.