The importance of fluid flow study can be visualized in the influence of flow by sea buckthorn before a dam [1]. Particle Image Velocimetry (PIV) is a sophisticated technique in flow visualization in many engineering and environmental applications. Another application of fluid flow in nuclear engineering includes coolant leaking detection in flow pattern that is important in the design of heat exchangers. The study of free-slip boundary condition (BC) is crucial on certain occasions in order to imitate or to access its impact on the whole fluid flow pattern especially at a very low pressure [2] or when immersion or penetration of bubble or fluid particle into solid interface happens and results as surface contamination. Thus, the large viscosity ratio of the fluid near the solid boundary happens and causes the rise of tangential velocity near the solid boundary [3]. In some cases, no-slip BC is well-posed in the modeling of viscous flow without penetration condition but it is amiss when the analysis of highly inviscid flows is considered. Free-slip is important to simulate free surface applications in geophysical occurrences such as in rivers and glaciers, spilling dynamics, ship hull designs, technologies of coating and fuel spraying or injection. Free-slip is measured by a so-called slip length physical parameter [4] and it can be measured by specific equipment. In this study, free-slip BC is applied on the classical problem of lid-driven cavity flow with different aspect ratio (AR) in order to see the impacting results. This model is a two-dimensional unsteady cavity with a Newtonian fluid flowing inside it and subject to a translation of top lid at a constant velocity [5].
Swirling motion or eddy can happen in an unsteady flow at low velocity under certain geometries. Eddies in ocean caused nutrients found in deep water to rise to the flow surface while eddies in enclosures create more dynamic patterns of the fluid inside that entire enclosures. Eddy formation helps one to better understand specific behavior of fluid dynamics especially to determine the steady-state condition of the flow. According to Moffatt [6], two corner eddies at the bottom merge to form a secondary main cell at critical AR of 1.629 in no-slip BC besides a primary main cell which is formed at the beginning of the unsteady-state simulation. Validating our present work as compared to Moffat’s, we found that the primary main cell is rotating in clockwise direction while the two corner eddies at the bottom are rotating in counter-clockwise direction with infinitesimal negative stream function value even after they have formed a secondary main cell (negative stream function value means rotating in counter-clockwise direction). However, no study was carried out to see if the above study is subject to a significant free-slip BC. Venturing further, we found that a secondary main cell is formed when iteration is terminated after a steady-state condition with criterion of e ≤ 10−8 is achieved in no-slip BC.
Normally, for a Newtonian fluid analysis, there are two important dimensionless parameters which are often used, namely, Reynolds number,
The rest of the paper is organized as follows. In Section 2, the mathematical model of the problem using vorticity-stream functions is applied to both no-slip and free-slip BCs. Then, the FDM is chosen and employed to solve the vorticity-stream function using a self-developed Matlab® algorithm which will be verified for the square model (AR = 1) with no-slip BC in Section 3. The solution for both mentioned BCs will also be discussed. These steady-state results are then compared with FEM using Ansys Fluent®. No-slip BC and different steady-state criteria are later applied on the lid-driven cavity flow model with AR = 1.629 and in free-slip BC with their flow patterns compared intensively in Section 4. The main novelty of this work is the observation on the eddies formation under both no-slip and free-slip BCs with various steady state criteria and aspect ratios for both square and rectangular cavities which altogether cannot be found in the existing studies. The FDM method is directly employed to solve the unsteady partial differential equations without conversion into nonlinear ordinary differential equations and some alternate solutions using FEM in Ansys Fluent® are provided. It is also worth to mentioning that the previous works only focused on solving such cavity problems but none of them developed their own GUI to help users in solving and analyzing the unsteady cavity lid-driven problem for both no-slip and free-slip BCs. Besides, our user-interactive GUI includes notification of the maximum allowable step time based on the stability criterion which is bounded by the explicit FDM. In Section 5, results and discussion are presented. Finally, Section 6 introduces the paper by marking the main contribution of this paper.
The lid-driven model with no-slip condition is shown in Figure 1, where U is the applied velocity, u and v are the velocity vector in x and y directions, ρ and μ are fluid density and dynamic viscosity,

Lid-driven in 2D analysis [2]
The vorticity-stream function scheme or vorticity transport equation [9] is broadly used rather than the velocity-pressure scheme (primitive variables) as it has a clear advantage such that the pressure variable is unnecessary to be calculated in detailed manner [12]. In two-dimensional flow, every fluid particle will rotate because of its viscosity [13] as shown in Figure 2. Viscous fluid will support shear stress and shear stress will create a torque, τ. The coupling of torque will make the fluid particle rotate in z-axis only. Vorticity transport equation can easily be obtained by calculating the curl [14] of Eq. (2) and Eq. (3). By incorporating stream function ψ, we get
The vorticity, ζ at each of the walls for no-slip BC as shown in Figure 1 can be obtained via Taylor series expansion [15].

Free-slip BC.
The vorticity, ζ at left, right and bottom walls for free-slip BC as shown in Figure 2 can be obtained via Taylor series expansion as well. For top wall, its vorticity equation is the same for both no-slip and free-slip BCs. Vorticity, ζ at each wall is given by:
In this section, few issues related to numerical modeling for solution of the two-dimensional vorticity transport equation will be analyzed. These issues are the application of the suitable numerical method, stability issue and iteration algorithm. Due to the nonlinear nature of second-order partial differential equation of the vorticity transport equation, there are few techniques accessible for the numerical solution such as finite element method, finite volume method, boundary element method and FDM [13]. The FDM is chosen among these available numerical methods. Despite being the simplest computational fluid dynamics method, it is conditionally stable [16]. In fact, this explicit FDM is sufficient enough to differentiate the shape of streamline distribution in no-slip and free-slip BCs of the unsteady square and rectangular cavity models with enhanced GUI to capture the rare formation of eddies. Figure 3 shows the explicit method with nodes that constitute the spatial and temporal approximations.

Finite difference in explicit form [16].
Eq.(7) can be transformed into a finite difference equation using forward and central finite-divided-difference formulas:
Eq. (14) is the conditional stability criterion. Substituting Eq. (4) and Eq. (5) into Eq. (6) yields:
Eq. (15) is called Poisson equation [14]. Similarly, Eq. (15) can be discretized using FDM:
1. Initial value of stream function, ψ and vorticity, ζ are set to zero at the 1st step time, t = 0. Values of stream function, ψ at top, bottom, left and right boundaries are set to zero along the iterative process from the 1st step time, t = 0 till the last step time, t = tend.
2. Solve the interior nodes of stream function, ψ using Eq. (15) by Gauss-Seidel method or any other method until all these values converge. In this paper, the convergence criterion of 10−5 is chosen [18].
3. Find the values of vorticity at those four boundaries, ζtop, ζbottom, ζleft and ζright using Eq.(12)–Eq.(15).
4. Update the interior nodes of vorticity, ζ using Eq. (13). Ensure the step time, Δt is within the limit as prescribed by Eq. (14).
5. Steps 2 through 4 are repeated until the steady-state condition of the flow is achieved or at any desired step time.
The present finite difference Matlab® code used in this research is self-developed and it is embedded into a GUI solver that is user-friendly and user-interactive. The GUI was built with multiple of buttons and columns to let the user key-in the data. It facilitates the user to study the fluid flow distribution throughout the lid-driven cavity and to obtain the readings from the two-dimensional fluid flow profile. This GUI consists of three panels, four axes, seven buttons, ten columns and one radio button. The ten columns are the user input panel i.e. dynamic viscosity (μ), density (ρ), velocity (u), length of cavity (l), height of cavity (H), slip length (ls), number of nodes (n), time increment (Δt), total time (t) and steady-state criterion (e). Once the end user has assigned a value to each of these inputs, the simulation can be executed by clicking the Plot button. Then results such as stream function distribution, u-velocity distribution, v-velocity distribution and velocity vector distribution can be well displayed in animation style.
Their associated finite difference equations are:
In this work, the model used in Ref. [10] will be studied first and served as a benchmark in this paper to verify the self-developed Matlab code and to investigate the developing numerical error if any. Two dimensional cavity flows (with no-slip BC) were carried out based on the numerical method as discussed in Section 3 in such a way that the flow is laminar and unsteady. The iterative procedure of the numerical process is performed until the flow is in a steady-state condition when criterion of e ≤ 10−9 is satisfied.
The steady state criterion is given by:
The test case problem of the two-dimensional lid-driven laminar cavity flow is as shown in Figure 4. The fluid density, ρ is set to 1 kg/m3, dynamic viscosity, μ = 0.001Pa.s, applied velocity, Uwall = 0.2m/s. Step time, Δt is set to 0.1 s and the computation is performed on 40 × 40 grids (uniform grid and Δx = Δy). The Reynolds number, Re can be reckoned as [19]:

Graphic User Interface (GUI).
Computation is performed on the side length of the square cavity with 1 m in no-slip BC. The numerical solution of u− and v− velocity distributions were obtained for cavity flow with Re = 200. A time series of contour plots that shows the growing streamlines under the top moving lid in the u− and v−velocities in Figure 5. An area of swirling motion is created under the top lid until it disappears as it reaches the bottom surface of the cavity. Then computational job is continued until the steady-state criterion of e ≤ 10−9 is satisfied where the results are shown in Figure 6 (a) and (c). The steady state results are then compared and verified by using the commercial simulation software Ansys Fluent® utilizing FEM as shown in Figure 6 (b) and (d). Additionally, the contour plots of the streamlines of u− and v−velocities obtained from Zhu [10] are compared with those results as shown in Figure 5 and Figure 6. Besides, the contour plots of the stream function distribution along the iteration in transient analysis are shown in Figure 7. Two small eddies (which rotate in opposite direction with respect to primary main cell) are formed at both of the corners at the bottom, whereas the right bottom eddy seems bigger as shown in Figure 7(e). The growing/formation of eddies has become more vivid through Figures 5, 6 and 7.

Contour plot of u− and v−velocity distributions at (a) t = 1s (b) t = 2s (c) t = 4s and (d) t = 10s (Re=200 with no-slip BC).

Comparison of contour plot of evolution (Re=200 with no-slip BC) at steady-state condition; (a) u−velocity distribution via FDM, (b) u−velocity distribution via FEM, (c) v−velocity distribution via FDM, (d) v−velocity distribution via FEM.

Contour plot of streamline distribution at (a) t = 1 s, (b) t = 2 s, (c) t = 4 s, (d) t = 10 s and, (e) t = 169.70 s (Re=200 with no-slip BC).
An interesting phenomenon is observed when the first model is subject to a free-slip BC at ls = 1 m where the shape of the primary cell is being ‘stretched’ to the corners at the bottom. It means the flow dynamics has reached the entire cavity sufficiently so that there is no room for corner eddy to form as observed in Figure 8 while contour plots of the streamlines of u− and v− velocities are as shown in Figure 9. This free-slip BC model however takes a longer period in order to achieve a better steady-state condition at e ≤ 10−9. The results in Figures 8 and 9 show the significant role of free-slip to eliminate eddies formation as compared to no-slip case in the first model.

Contour plot of streamline distribution at steady-state condition (Re=200 with free-slip BC).

Contour plot of u− and v−velocity distributions at steady-state condition (Re=200 with free-slip BC).
The AR of the first model is modified from AR=1 to AR=1.629 as suggested by Moffatt [6] in order to investigate how the two corner eddies at the bottom merge to form a secondary main cell at this critical AR (in no-slip BC). A time series of contour evolution of the streamline, u− and v−velocity distributions at different steady-state criteria (from e ≤ 10−2 to e ≤ 10−10) and the growing formation of secondary eddies are shown in Figure 10 and Figure 11, respectively. It is observed that under no-slip condition, the growing of eddies becomes more significant as compared to observation under free-slip BC. This is because the acceleration of the fluid at the wall is assumed to be zero in no-slip BC while there is a relative velocity between the wall and the fluid in free-slip BC. The value of maximum stream function, ψmax in each step time increases along the iteration, then it achieves plateau before approaching the highest point and drops again in a tiny quantity until the end of the iteration as shown in Figure 12. Based on Figure 12, the streamline distribution achieves the highest maximum value at t = 65.6 s (at about steady-state criterion of e ≤ 10−5). The location of maximum stream function, ψmax is fixed in position and does not move anywhere after this steady-state criterion. Then the value of ψmax begins to drop a little bit after t = 65.6 s. Secondary eddies are formed at t = 51.6 s and they grown in size further. Then these two secondary eddies merged at t = 152.9 s (at about steady state criterion of e ≤ 10−8) and the shape and size of the whole streamline distribution do not change at any further iteration as shown in Figure 10(g).

Contour plot of streamline distribution at (a) t = 5.50 s, (b) t = 24.90 s, (c) t = 51.60 s, (d) t = 65.60 s, (e) t = 67.30 s, (f) t = 152.90 s and (g) t = 336.60 s (Re=325.8 with no-slip BC).

Contour plots of u−and v−velocity distributions at (a) t = 5.50 s, (b) t = 24.90 s, (c) t = 51.60 s, (d) t = 65.60 s, (e) t = 67.30 s, (f) t = 152.90 s and (g) t = 336.60 s (Re=325.8 with no-slip BC).

Maximum value of stream function along the iteration (a) Standard view (b) Zoomed view around coordinate (t(ψmax), ψmax).
According to suggestion by Moshikin and Poochinapan [9], the steady flow is achieved when the criterion, e ≤ 10−8 is achieved. However, Abd-El-Hafiz, Ismail and Matit [18] proposed another criterion in which the iteration is repeated until the velocity profile (velocity and stream function are interrelated through Eq. (4) and Eq.(5)) converges when the criterion of e ≤ 10−5 is reached. A secondary main cell is not able to form if iteration stops as the steady-state criterion e ≤ 10−5 is achieved. In addition to this, by performing an iteration beyond the steady-state criterion e ≤ 10−8, it does not contribute to any useful result due to iteration and round off errors [19]. It is observed that the value of streamline distribution drops after achieving the steady-state criterion at e ≤ 10−10. If more iterations are needed in order to achieve the smaller steady-state criterion, then the resultant steady-state period will be longer. Hence it will cause a longer execution time.
Based on Table 1, the highest value of maximum stream function, ψmax for the steady state criterion e ≤ 10−5 can be found occurring at t(ψmax) = 65.6 s by using the code as shown below:
Nomenclatures.
| Symbol | Meanings | Symbol | Meanings |
|---|---|---|---|
| ρ | density [kg/m3] | ψ | stream function [m2/s] |
| U | applied velocity [m/s] | ψmax | maximum stream function [m2/s] |
| L | length of cavity [m] | Uwall | applied velocity at top wall [m/s] |
| μ | dynamic viscosity [Pa.s] | n | non-negative integer, number of nodes |
| Re | Reynolds number | i | column |
| A | aspect ratio | j | row |
| H | height of cavity [m] | Δx | step size [m] |
| u | velocity in x–direction [m/s] | Δy | step size [m] |
| v | velocity in y–direction [m/s] | us | slip velocity [m/s] |
| g | gravity acceleration [m/s2] | ls | slip length [m] |
| u | applied velocity [m/s] | gx | gravity acceleration in x–direction [m/s2] |
| θ | angle [deg] | gy | gravity acceleration in y–direction [m/s2] |
| t | time [s] | Δt | step time [s] |
| ∇ | Gradient operator | h | step size [m] |
| ζtop | vorticity at the top [m/s2] | s fj,i,n | stream function at previous time [m2/s] |
| ζleft | vorticity at the top [m/s2] | s fj,i,n+1 | stream function at previous time [m2/s] |
| V | velocity vector [m/s] | ζright | vorticity at the right [m/s2] |
| ζ | vorticity [m/s2] | ζbottom | vorticity at the bottom [m/s2] |
| e | steady-state criterion | ||
The third model is analyzed again until the steady-state criterion, e ≤ 10−8 is achieved but in free-slip BC by gradually increasing the slip length, ls value. It seems that when slip length, ls passes through the threshold value of 0.07m, the secondary main cell of eddy is not able to be formed as shown in Figure 13(a). Threshold free-slip means the value of slip length that is just good to eliminate the formation of secondary main cell of eddy while significant free-slip means an amplified slip length to thoroughly change the shape of streamline. The associated contour plots of the streamline, u− and v− velocity distributions are shown in Figure 14. By further increasing the slip length, ls value to an extremely high free-slip BC at ls = 1 m, the shape of the primary cell is being ‘stretched’ to the corners of the bottom cavity wall as shown in Figure 13(b) (similar with Figure 8). Thus, there is no room for eddy formation under this free-slip condition. Meanwhile, its associated contour plots of the streamline, u− and v− velocity distributions are shown in Figure 15 (similar with Figure 9). Further reference on slip length measurement is given by Maali and Bhushan [21].

Contour plot of streamline distribution at steady-state condition Re=325.8 with a) threshold free-slip BC and b) significant free-slip BC.

Contour plot of u− and v−velocity distributions at steady-state condition (Re=325.8 with threshold free-slip BC).

Contour plot of u− and v−velocity distributions at steady-state condition (Re=325.8 with significant free-slip BC).
This study is a unique attempt to consider both no-slip and free-slip effects in both square and rectangular cavity models under different aspect ratios and steady-state criteria which were not considered before in the existing literature. All the FDM codes are self-developed in Matlab® environment and they are embedded into a self-designed GUI that is user-interactive for beginners in this field by the authors. The first model is executed in order to verify the presently self-developed Matlab® FDM code with Ansys Fluent® which employs a finite element method. Although this scheme seems simple, it is conditionally stable and sufficient to differentiate the flow pattern in both no-slip and free-slip BCs quantitatively by observing the streamline distribution. The changed shape of streamline distribution in free-slip effect is important for subsequent heat transfer analysis as it will amend temperature distribution of the lid-driven model as well. Thus, it further influences the convection heat transfer process of lid-driven model when subject to ambient air or radiation heat transfer. Also, we are able to show the formation of secondary main cell when lid-driven is subject to critical AR as mentioned by Moffatt [6] in the third model. It is noticed that no significant change to the results and contour plots of streamline and velocity distributions are found by executing the iteration smaller than the steady-state criterion of e ≤ 10−8. Hence, it would only bring about numerical error, longer computational effort and hence it results in pointless. The merging of secondary main cell can be refrained when the slip length (free-slip BC) achieves the threshold value. Stretching effect with free-slip BC in the fourth model regulates the fluid dynamics to reach the entire cavity sufficiently with no room for eddy formation by increasing the slip length to an intense value. With help of the presently self-developed GUI, the rare observations on eddies formation in the square and rectangular lid-driven cavity models under influence of both no-slip and free-slip effects which are never considered in a single existing literature can be captured sufficiently and pointed out clearly to promote uniquely extended findings on the subject of interest.
The parameters given by Table 2 are used to explain κ1 =Steady state criteria e, κ2 =Period t to achieve designated e, κ3 = ψmax(m2/s) at designed e. κ3 =Location of ψmax(m) at designated e, respectively.
Value and location of ψmax at different steady-state criteria (AR= 1.629).
| No | κ1 | κ2 | κ3 | κ4 | Remark |
|---|---|---|---|---|---|
| 1. | e ≤ 10−2 | 5.5 s | 0.0089 | x=0.775, y=1.466 | Primary main cell is formed |
| 2. | e ≤ 10−3 | 24.9 s | 0.0186 | x=0.675, y=1.262 | Primary main cell is growing |
| 3. | e ≤ 10−4 | 51.6 s | 0.0209 | x=0.625, y=1.140 | Secondary eddies are formed |
| 4. | e ≤ 10−5 | 65.6 s | 0.0210 | x=0.600, y=1.100 | Secondary eddies are growing |
| 5. | e ≤ 10−6 | 67.2 s | 0.0210 | x=0.600, y=1.100 | – |
| 6. | e ≤ 10−7 | 67.3 s | 0.0210 | x=0.600, y=1.100 | – |
| 7. | e ≤ 10−8 | 152.9 s | 0.0207 | x=0.600, y=1.100 | Secondary main cell is formed and fixed in size |
| 8. | e ≤ 10−10 | 336.6 s | 0.0207 | x=0.600, y=1.100 | – |
The authors hereby declare that there is no conflict of interests regarding the publication of this paper.
There is no funding regarding the publication of this paper.
H.F.W.-Methodology, Validation, Formal Analysis, Writing-Original Draft. M.S.-Resources, Writing-Original Draft. N.F.M.N.-Conceptualization, Supervision, Writing-Review Editing. All authors read and approved the final submitted version of this manuscript.
The authors deeply appreciate the reviewers for their helpful and constructive suggestions, which can help further improve this paper.
All data that support the findings of this study are included within the article.
The authors declare that they have not used Artificial Intelligence (AI) tools in the creation of this article.