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, , 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
Mesh
Results
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 m. The strongest return flow is 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 (, 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 meshes of Taylor-Hood Q2-Q1 elements, from to . The problem has no exact solution, so the two programs are compared with each other, on two quantities:
- Primary vortex strength : 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 , where is computed from the velocity
- 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 | , FEAScript | , Elmer | Difference in | Difference in velocity |
|---|---|---|---|---|
| 8 × 8 | −0.096471 | −0.096350 | 1.2e-4 | 8.0e-2 |
| 16 × 16 | −0.099012 | −0.099048 | 3.6e-5 | 1.2e-2 |
| 24 × 24 | −0.099592 | −0.099610 | 1.9e-5 | 5.3e-3 |
| 32 × 32 | −0.099804 | −0.099814 | 9.6e-6 | 1.1e-3 |
| 48 × 48 | −0.099975 | −0.099978 | 3.2e-6 | 1.0e-4 |
| 64 × 64 | −0.100016 | −0.100017 | 1.3e-6 | 4.9e-5 |
Both programs converge to the same flow: on the mesh, at 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:
| Mesh | Largest difference in velocity | Largest difference in pressure |
|---|---|---|
| 8 × 8 | 5.1e-14 | 1.1e-11 |
| 16 × 16 | 1.3e-13 | 1.2e-11 |
| 24 × 24 | 9.2e-14 | 3.1e-11 |
| 32 × 32 | 4.0e-13 | 8.7e-11 |
| 48 × 48 | 2.4e-13 | 2.2e-10 |
| 64 × 64 | 2.6e-13 | 1.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, , 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 , , , which the Taylor-Hood elements reproduce exactly (see the verification page).
node couetteFlow2DCreepingFlow/couetteFlow2DCreepingFlow.js
Source:
couetteFlow2DCreepingFlow.js
Geometry
Mesh
Results
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)