Skip to main content
Version: 0.4.0

Creeping flow

Node.js examples of creepingFlow, in examples/creepingFlow. Run the commands below from that folder (see running an example). All results are from FEAScript-core 0.4.0.

Lid-driven cavity in 2D​

Creeping (Stokes) flow in a 4 m × 2 m cavity, μ=1\mu = 1, driven by its top wall (the lid), which moves at 1 m/s. The other walls are fixed (no slip). The elements are Taylor-Hood Q2-Q1: quadratic velocity and linear pressure.

node lidDrivenCavity2DCreepingFlow/lidDrivenCavity2DCreepingFlow.js

Source: lidDrivenCavity2DCreepingFlow.js

Geometry​

4 m by 2 m cavity with a moving lid and fixed walls

Mesh​

12 by 6 Q2-Q1 quadrilaterals with the boundary numbering

Results​

Velocity vectors forming a recirculation below the lid

The lid drags the fluid along under it, and the fluid returns along the bottom of the cavity, forming one large recirculation. The flow is mirror-symmetric about x=2x = 2 m. The strongest return flow is u=−0.3245u = -0.3245 m/s, at (2 m, 0.667 m). At the corners of the lid the velocity is that of the fixed walls, zero (see pressure level). The example prints the node coordinates and the fields u, v and p.

Comparison with Elmer​

The lid-driven cavity is a standard test of flow solvers. Its unit-square version (μ=1\mu = 1, lid velocity 1, pressure fixed to 0 at the bottom-left corner) was solved with FEAScript and with Elmer, the open-source finite element software of CSC – IT Center for Science, on the same n×nn \times n meshes of Taylor-Hood Q2-Q1 elements, from 8×88 \times 8 to 64×6464 \times 64. The problem has no exact solution, so the two programs are compared with each other, on two quantities:

  • Primary vortex strength ψmin\psi_{min}: the minimum of the stream function. In Stokes flow the cavity is mirror-symmetric, so the center of the vortex lies on the vertical centerline x=0.5x = 0.5, where ψmin\psi_{min} is computed from the velocity uu
  • Velocity: the largest difference between the velocities of the two programs at the mesh nodes farther than 0.2 from the two corners of the lid
Meshψmin\psi_{min}, FEAScriptψmin\psi_{min}, ElmerDifference in ψmin\psi_{min}Difference in velocity
8 × 8−0.096471−0.0963501.2e-48.0e-2
16 × 16−0.099012−0.0990483.6e-51.2e-2
24 × 24−0.099592−0.0996101.9e-55.3e-3
32 × 32−0.099804−0.0998149.6e-61.1e-3
48 × 48−0.099975−0.0999783.2e-61.0e-4
64 × 64−0.100016−0.1000171.3e-64.9e-5

Lid-driven cavity: difference between FEAScript and Elmer in velocity and in ψ_min against element size, logarithmic axes

Both programs converge to the same flow: on the 64×6464 \times 64 mesh, ψmin=−0.10002\psi_{min} = -0.10002 at y=0.7646y = 0.7646 in both, and the velocities differ by less than 5e-5 away from the lid corners. Next to the two lid corners, where the velocity jumps from that of the lid to zero, the programs differ by up to 0.17 on every mesh, because they apply the lid velocity differently along the top edge of the corner elements: FEAScript sets the full lid velocity at every lid node except the corners, while Elmer interpolates it linearly from zero at the corner.

FEAScript-core 0.4.0 was used, with "lusolve". Elmer used its IncompressibleNSVec solver in Stokes mode, run on one core as a single MPI process. For the solve times, see Solvers. The benchmark, with the Elmer setup, is in FEAScript-benchmark.

Comparison with scikit-fem​

The same cavity was also solved with scikit-fem, an open-source finite element library for Python, on the same meshes, with Taylor-Hood Q2-Q1 elements and its default direct solver. scikit-fem sets the lid velocity the same way as FEAScript, at every lid node except the corners, so the two programs can be compared at every node, including those next to the lid corners:

MeshLargest difference in velocityLargest difference in pressure
8 × 85.1e-141.1e-11
16 × 161.3e-131.2e-11
24 × 249.2e-143.1e-11
32 × 324.0e-138.7e-11
48 × 482.4e-132.2e-10
64 × 642.6e-131.1e-10

The velocity is compared at all the nodes, and the pressure at the mesh vertices, where it is defined.

Couette flow in 2D​

A 4 m × 2 m channel, μ=1\mu = 1, whose top wall moves at 1 m/s over a fixed bottom wall, with stress-free (open) ends. The exact solution is the linear profile u=y/2u = y / 2, v=0v = 0, p=0p = 0, which the Taylor-Hood elements reproduce exactly (see the verification page).

node couetteFlow2DCreepingFlow/couetteFlow2DCreepingFlow.js

Source: couetteFlow2DCreepingFlow.js

Geometry​

Channel with a moving top wall, a fixed bottom wall and stress-free ends

Mesh​

4 by 2 Q2-Q1 quadrilaterals with the boundary numbering

Results​

Velocity profile at the left end: the computed values lie on the exact line u = y / 2

The example prints the velocity along the left end next to the exact values, and the largest deviations:

Velocity u along the left end (x = 0):
y = 0.00: u = 0.0000 (exact 0)
y = 0.50: u = 0.2500 (exact 0.25)
y = 1.00: u = 0.5000 (exact 0.5)
y = 1.50: u = 0.7500 (exact 0.75)
y = 2.00: u = 1.0000 (exact 1)
Largest deviation from u = U y / H: 3.33e-16
Largest |v|: 0.00e+0 (exact 0)
Largest |p|: 0.00e+0 (exact 0)