0% found this document useful (0 votes)
129 views14 pages

Semi-Implicit Method For Pressure-Linked Equations (SIMPLE) - Solution in MATLAB®

Uploaded by

jackim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
129 views14 pages

Semi-Implicit Method For Pressure-Linked Equations (SIMPLE) - Solution in MATLAB®

Uploaded by

jackim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Int. Jnl.

of Multiphysics Volume 12 · Number 4 · 2018 313

Semi-Implicit Method for Pressure-Linked


Equations (SIMPLE) – solution in MATLAB®
H Khawaja*, M Moatamedi
UiT - The Arctic University of Norway, Norway

ABSTRACT
This work presents a method for the solution of fundamental governing
equations of computational fluid dynamics (CFD) using the Semi-Implicit
Method for Pressure-Linked Equations (SIMPLE) in MATLAB®. The
fundamental governing equations of fluid mechanics are based on three
laws of conservation, referred to as the law of conservation of mass, the law
of conservation of momentum and the law of conservation of energy. The
continuity equation represents the law of conservation of mass, the Navier-
Stokes equations represent the law of conservation of momentum, and the
energy equation represents the law of conservation of energy. In SIMPLE,
the continuity and Navier-Stokes equations are required to be discretized
and solved in a semi-implicit way. This article presents the discretization and
method of solution applied to the flow around a 2-D square body. Code is
written in MATLAB®. The results show the pressure and velocity fields of the
converged solution.

1. INTRODUCTION
Computational fluid dynamics (CFD) is based on three basic physical principles: conservation
of mass, of momentum and of energy. The governing equations in CFD are based on these
conservation principles. The continuity equation is based on conservation of mass, as shown
in Equation (1),

𝜕𝜕𝜕𝜕 𝜕𝜕(𝜌𝜌𝜌𝜌) 𝜕𝜕(𝜌𝜌𝜌𝜌) 𝜕𝜕(𝜌𝜌𝜌𝜌)


𝜕𝜕𝜕𝜕
+ + + =0 (1)
𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕

where 𝜌𝜌 is fluid density, 𝑢𝑢 is fluid velocity in the x-direction, 𝑣𝑣 is fluid velocity in the y-
direction, 𝑤𝑤 is fluid velocity in the z-direction and 𝑡𝑡 is time.

𝜕𝜕(𝜌𝜌𝜌𝜌)
�⃗� = − 𝜕𝜕𝜕𝜕 + 𝜕𝜕𝜏𝜏𝑥𝑥𝑥𝑥 + 𝜕𝜕𝜏𝜏𝑦𝑦𝑦𝑦 + 𝜕𝜕𝜏𝜏𝑧𝑧𝑧𝑧 + 𝜌𝜌𝑓𝑓𝑥𝑥
+ ∇ ∙ �𝜌𝜌𝜌𝜌𝑈𝑈 (2)
𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕

in Equation (3) for the y-direction,

𝜕𝜕(𝜌𝜌𝜌𝜌) 𝜕𝜕𝜕𝜕 𝜕𝜕𝜏𝜏𝑥𝑥𝑥𝑥 𝜕𝜕𝜏𝜏𝑦𝑦𝑦𝑦 𝜕𝜕𝜏𝜏𝑧𝑧𝑧𝑧


�⃗� = − +
+ ∇ ∙ �𝜌𝜌𝜌𝜌𝑈𝑈 + + + 𝜌𝜌𝑓𝑓𝑦𝑦 (3)
𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕

___________________________________
*Corresponding Author: [email protected]
314 Semi-Implicit Method for Pressure-Linked Equations (SIMPLE) – solution in MATLAB®

and in Equation (4) for the z-direction,

𝜕𝜕(𝜌𝜌𝜌𝜌) 𝜕𝜕𝜕𝜕 𝜕𝜕𝜏𝜏𝑥𝑥𝑥𝑥 𝜕𝜕𝜏𝜏𝑦𝑦𝑦𝑦 𝜕𝜕𝜏𝜏𝑧𝑧𝑧𝑧


�⃗� = − +
+ ∇ ∙ �𝜌𝜌𝜌𝜌𝑈𝑈 + + + 𝜌𝜌𝑓𝑓𝑧𝑧 (4)
𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕

�⃗ the velocity vector (𝑢𝑢𝑢𝑢 + 𝑣𝑣𝑣𝑣 + 𝑤𝑤𝑤𝑤), 𝑓𝑓⃗ = 𝑓𝑓𝑥𝑥 𝑖𝑖 + 𝑓𝑓𝑦𝑦 𝑗𝑗 + 𝑓𝑓𝑧𝑧 𝑘𝑘 the
where 𝑝𝑝 represents pressure, 𝑈𝑈
body force vector and 𝜏𝜏 is the shear stress tensor as shown in Equation (5),

𝜏𝜏𝑥𝑥𝑥𝑥 𝜏𝜏𝑥𝑥𝑥𝑥 𝜏𝜏𝑥𝑥𝑥𝑥


𝜏𝜏
𝜏𝜏 = � 𝑦𝑦𝑦𝑦 𝜏𝜏𝑦𝑦𝑦𝑦 𝜏𝜏𝑦𝑦𝑦𝑦 � (5)
𝜏𝜏𝑧𝑧𝑧𝑧 𝜏𝜏𝑧𝑧𝑧𝑧 𝜏𝜏𝑧𝑧𝑧𝑧

The effect of volumetric viscosity is ignored. If the fluid is considered to be a Newtonian


fluid, then shear stress is as shown in Equation (6),

𝜕𝜕𝑢𝑢 𝜕𝜕𝑢𝑢 2 𝜕𝜕𝑢𝑢


𝜏𝜏𝑖𝑖𝑖𝑖 = 𝜇𝜇 �𝜕𝜕𝑥𝑥 𝑖𝑖 + 𝜕𝜕𝑥𝑥𝑗𝑗 − 𝛿𝛿𝑖𝑖𝑖𝑖 �3� 𝜕𝜕𝑥𝑥𝑘𝑘� (6)
𝑗𝑗 𝑖𝑖 𝑘𝑘

where 𝜇𝜇 is the dynamic viscosity, 𝛿𝛿𝑖𝑖𝑖𝑖 is the kronecker delta, and subscripts 𝑖𝑖, 𝑗𝑗 and 𝑘𝑘 refer
to linear dimensions x, y and z.
The equation based on the conservation of total energy is shown in Equation (7),

𝜕𝜕 𝑈𝑈 2 𝑈𝑈 2 𝜕𝜕 𝜕𝜕𝜕𝜕 𝜕𝜕 𝜕𝜕𝜕𝜕
�𝜌𝜌 �𝑒𝑒 + �� + ∇ ∙ �𝜌𝜌 �𝑒𝑒 + �⃗� = 𝜌𝜌𝑞𝑞̇ + �𝑘𝑘 � + �𝑘𝑘 � +
� 𝑈𝑈
𝜕𝜕𝜕𝜕 2 2 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕
𝜕𝜕 𝜕𝜕𝜕𝜕 𝜕𝜕(𝑢𝑢𝑢𝑢) 𝜕𝜕(𝑣𝑣𝑣𝑣) 𝜕𝜕(𝑤𝑤𝑤𝑤) 𝜕𝜕(𝑢𝑢𝑢𝑢𝑥𝑥𝑥𝑥 ) 𝜕𝜕(𝑢𝑢𝜏𝜏𝑦𝑦𝑦𝑦 ) 𝜕𝜕(𝑢𝑢𝜏𝜏𝑧𝑧𝑧𝑧 ) 𝜕𝜕(𝑣𝑣𝑣𝑣𝑥𝑥𝑥𝑥 )
𝜕𝜕𝜕𝜕
�𝑘𝑘 𝜕𝜕𝜕𝜕 � − 𝜕𝜕𝜕𝜕
− 𝜕𝜕𝜕𝜕
− 𝜕𝜕𝜕𝜕
+ 𝜕𝜕𝜕𝜕
+ + + +
𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕
𝜕𝜕(𝑣𝑣𝜏𝜏𝑦𝑦𝑦𝑦 ) 𝜕𝜕(𝑣𝑣𝜏𝜏𝑧𝑧𝑧𝑧 ) 𝜕𝜕(𝑤𝑤𝑤𝑤𝑥𝑥𝑥𝑥 ) 𝜕𝜕(𝑤𝑤𝜏𝜏𝑦𝑦𝑦𝑦 ) 𝜕𝜕(𝑤𝑤𝜏𝜏𝑧𝑧𝑧𝑧 )
+ + + + + 𝜌𝜌𝑓𝑓⃗ ∙ 𝑈𝑈
�⃗ (7)
𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕

where 𝑒𝑒 = 𝑐𝑐𝑣𝑣 𝑇𝑇 is internal energy, 𝑈𝑈 2 = 𝑢𝑢2 + 𝑣𝑣 2 + 𝑤𝑤 2 is the magnitude of velocity vector,


𝑞𝑞̇ is the energy source, 𝑘𝑘 is the thermal diffusion coefficient and 𝑇𝑇 is temperature.
By subtracting the product of momentum equations with their corresponding velocity from
the total energy equation, an equation for the conservation of internal energy can be written
as shown in Equation (8),

𝜕𝜕(𝜌𝜌𝜌𝜌)
�⃗) = 𝜌𝜌𝑞𝑞̇ + 𝜕𝜕 �𝑘𝑘 𝜕𝜕𝜕𝜕� + 𝜕𝜕 �𝑘𝑘 𝜕𝜕𝜕𝜕 � + 𝜕𝜕 �𝑘𝑘 𝜕𝜕𝜕𝜕� −
+ ∇ ∙ (𝜌𝜌𝜌𝜌𝑈𝑈
𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕
𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 2 𝜕𝜕𝜕𝜕 2 𝜕𝜕𝜕𝜕 2 𝜕𝜕𝜕𝜕 2
𝑝𝑝 �𝜕𝜕𝜕𝜕 − 𝜕𝜕𝜕𝜕 − 𝜕𝜕𝜕𝜕
� + 𝜆𝜆 �𝜕𝜕𝜕𝜕 − 𝜕𝜕𝜕𝜕 − 𝜕𝜕𝜕𝜕
� + 𝜇𝜇 �2 �𝜕𝜕𝜕𝜕 � + 2 �𝜕𝜕𝜕𝜕� + 2 � 𝜕𝜕𝜕𝜕 � +
𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 2 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 2 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 2
�𝜕𝜕𝜕𝜕 + 𝜕𝜕𝜕𝜕� + � 𝜕𝜕𝜕𝜕 + 𝜕𝜕𝜕𝜕
� + �𝜕𝜕𝜕𝜕 + 𝜕𝜕𝜕𝜕 � � (8)

2
where 𝜆𝜆 = − 𝜇𝜇 and 𝜇𝜇 is the coefficient of dynamic viscosity.
3
Int. Jnl. of Multiphysics Volume 12 · Number 4 · 2018 315

These governing equations can be applied to a physical system in a closed volume.


Equations (1) to (8) are non-linear partial differential equations and difficult to solve
analytically. The numerical method of solution involves the discretization in time and space
(closed volume) domains. The solution is achieved using iterative numerical techniques such
as the Semi-Implicit Method for Pressure-Linked Equations (SIMPLE).
A SIMPLE algorithm is a widely used numerical procedure in computational fluid
dynamics (CFD) to solve the fundamental governing equations of fluid mechanics. Prof. Brian
Spalding and Suhas Patankar developed the SIMPLE algorithm at Imperial College, London,
in the early 1970s [1]. Since then, it has been extensively used by many researchers to solve
different kinds of fluid flow and heat transfer problems [2-4]. The literature on computational
fluid dynamics discusses the SIMPLE algorithm in detail [5]. A modified variant is the
SIMPLER algorithm (SIMPLE Revised) introduced by Patankar in 1979 [6].
In order to be solved using numerical techniques, CFD problems need to be discretized in
space dimensions [2, 7-15]. For such numerical problems to be solved, they need to be
discretized in nodes and elements [16-18]. The nodes represent the position in space where
parameters are being calculated (for example, pressure, velocities), and the elements define
the equations relating to the parameters (for example, continuity and Navier-Stokes) [19]. The
geometry of the element defines the extent of calculations regarding space dimensions. These
space dimensions categorize one-dimensional (1-D), two-dimensional (2-D) or three-
dimensional (3-D) elements, as shown in Fig. 1 [20].

Figure 1. One-dimensional (1-D), two-dimensional (2-D) or three-dimensional (3-D)


elements [20].

This physical behavior of various real-time structures and physical phenomena allows
engineers and mathematicians to assume a realistic 3-D situation to be a 2-D or even a 1-D
problem. The advantage of reducing the dimensions is that it allows complex equations to be
solved much more easily and relatively faster [7].
This paper provides a step by step methodology for SIMPLE, defining the problem, giving
the assumptions, degrees of freedom, discretization, and method of solution. The methodology
also discusses the flow chart of the method written in MATLAB®. The results section of the
paper discusses the pressure and velocity fields obtained from the solution. The paper
concludes by discussing the effectiveness and limitations of the given method.
316 Semi-Implicit Method for Pressure-Linked Equations (SIMPLE) – solution in MATLAB®

2. METHODOLOGY
The methodology is divided into two sections: setting up the SIMPLE and the method of
solution in MATLAB®. Setting up the SIMPLE includes: assumptions, degrees of freedom,
discretization, and pressure and velocity corrections. The method of solution is given in the
form of a flowchart.
This work assumes the CFD problem to be incompressible. This means that the density
does not change in time and space and, henceforth, can be considered as a constant value. This
assumption is very valid in a range of problems when flow velocities are not too high. In
addition, the given CFD problem does not constitute any thermal effects. This assumption
allows us to simplify the problem to the extent that there is no need to solve the energy
equation.
The domain is defined as 2-D space, as shown in Fig. 2, presenting a 2-D problem of flow
around a square. The variables constituting continuity and Navier-Stokes are pressure, x-
velocity and y-velocity.

constant no-slip
velocity at boundary
inlet condition

Figure 2. Domain of a 2-D problem of flow around a square.

With the above-given assumptions, continuity and Navier-Stokes equations can be


simplified as shown in Equations (9) to (11),

𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕
𝜕𝜕𝜕𝜕
+ 𝜕𝜕𝜕𝜕 = 0 (9)

𝜕𝜕𝜕𝜕 𝑢𝑢𝑢𝑢𝑢𝑢 𝑢𝑢𝑢𝑢𝑢𝑢 𝜕𝜕𝜕𝜕 𝜇𝜇 𝜕𝜕2 𝑢𝑢 𝜕𝜕2 𝑢𝑢


𝜕𝜕𝜕𝜕
= − 𝜕𝜕𝜕𝜕
− 𝜕𝜕𝜕𝜕
− 𝜕𝜕𝜕𝜕 + 𝜌𝜌 �𝜕𝜕𝑥𝑥 2 + 𝜕𝜕𝑦𝑦 2 � (10)

𝜕𝜕𝜕𝜕 𝑣𝑣𝑣𝑣𝑣𝑣 𝑣𝑣𝑣𝑣𝑣𝑣 𝜕𝜕𝜕𝜕 𝜇𝜇 𝜕𝜕2 𝑣𝑣 𝜕𝜕2 𝑣𝑣


𝜕𝜕𝜕𝜕
= − 𝜕𝜕𝜕𝜕
− 𝜕𝜕𝜕𝜕
− 𝜕𝜕𝜕𝜕 + �
𝜌𝜌 𝜕𝜕𝑦𝑦 2
+ 𝜕𝜕𝑥𝑥 2 � (11)

where 𝑢𝑢 is the fluid velocity in the x-direction, 𝑣𝑣 is the fluid velocity in the y-direction, 𝑝𝑝
is the fluid pressure, 𝜌𝜌 is the fluid density, 𝜇𝜇 is the coefficient of dynamic viscosity of the
fluid, and 𝑡𝑡 is time.
Int. Jnl. of Multiphysics Volume 12 · Number 4 · 2018 317

In order to apply a numerical scheme such as SIMPLE for the solution of Equations (9) to
(11), each term needs to be discretized. Discretization is the mathematical process of
transforming continuous equations into their discrete counterparts. This process is a first step
toward making equations suitable for a numerical solution and for implementation on digital
machines. In this work, the 2-D domain has been discretized in a staggered grid, as shown in
Fig. 3.

Figure 3. 2-D domain discretized in a staggered grid.

The transient terms from Navier-Stokes equations (Equations (10) and (11)) can be
discretized using the forward difference method as shown in Equations (12) and (13),

𝜕𝜕𝜕𝜕 𝑢𝑢𝑡𝑡+1 (𝑖𝑖,𝑗𝑗)– 𝑢𝑢𝑡𝑡 (𝑖𝑖,𝑗𝑗)


𝜕𝜕𝜕𝜕
= (12)
∆𝑡𝑡

𝜕𝜕𝜕𝜕 𝑣𝑣 𝑡𝑡+1 (𝑖𝑖,𝑗𝑗)– 𝑣𝑣 𝑡𝑡 (𝑖𝑖,𝑗𝑗)


𝜕𝜕𝜕𝜕
= (13)
∆𝑡𝑡

where ∆𝑡𝑡 is the value of the timestep.


Different methods can be used for the discretization of the convective term. The decision
as to which method to select is based on the Reynolds number. This non-dimensional number
is the ratio of convection and diffusion. If this number is small enough, we can use the central
difference method; however, if the Reynolds number is higher, it is better to use the upwind
scheme. Convective terms discretized using the central difference method are shown in
Equations (14) to (17),

𝑢𝑢𝑢𝑢𝑢𝑢 𝑢𝑢𝑡𝑡 (𝑖𝑖,𝑗𝑗−1)2 –𝑢𝑢𝑡𝑡 (𝑖𝑖,𝑗𝑗+1)2


− 𝜕𝜕𝜕𝜕
= − (14)
2∆𝑥𝑥

𝑢𝑢𝑢𝑢𝑢𝑢 𝑢𝑢𝑡𝑡 (𝑖𝑖−1,𝑗𝑗)�𝑣𝑣 𝑡𝑡 (𝑖𝑖−1,𝑗𝑗)+𝑣𝑣(𝑖𝑖−1,𝑗𝑗+1)� 𝑢𝑢𝑡𝑡 (𝑖𝑖+1,𝑗𝑗)�𝑣𝑣 𝑡𝑡 (𝑖𝑖,𝑗𝑗)+𝑣𝑣 𝑡𝑡 (𝑖𝑖,𝑗𝑗+1)�


− 𝜕𝜕𝜕𝜕
=− + (15)
4∆𝑦𝑦 4∆𝑦𝑦
318 Semi-Implicit Method for Pressure-Linked Equations (SIMPLE) – solution in MATLAB®

𝑣𝑣𝑣𝑣𝑣𝑣 𝑣𝑣 𝑡𝑡 (𝑖𝑖−1,𝑗𝑗)2 –𝑣𝑣 𝑡𝑡 (𝑖𝑖+1,𝑗𝑗)2


− 𝜕𝜕𝜕𝜕
= − (16)
2∆𝑦𝑦

𝑣𝑣𝑣𝑣𝑣𝑣 𝑣𝑣 𝑡𝑡 (𝑖𝑖,𝑗𝑗−1)�𝑢𝑢𝑡𝑡 (𝑖𝑖,𝑗𝑗−1)+𝑢𝑢(𝑖𝑖+1,𝑗𝑗−1)� 𝑣𝑣 𝑡𝑡 (𝑖𝑖,𝑗𝑗+1)�𝑢𝑢𝑡𝑡 (𝑖𝑖,𝑗𝑗)+𝑢𝑢𝑡𝑡 (𝑖𝑖+1,𝑗𝑗)�


− 𝜕𝜕𝜕𝜕
=− + (17)
4∆𝑥𝑥 4∆𝑥𝑥

while convective terms discretized using the upwind scheme are shown in Equations (18)
to (21),

𝑢𝑢𝑢𝑢𝑢𝑢 𝑢𝑢𝑡𝑡 (𝑖𝑖,𝑗𝑗−1)�𝑢𝑢𝑡𝑡 (𝑖𝑖,𝑗𝑗−1)+𝑢𝑢𝑡𝑡 (𝑗𝑗,𝑖𝑖)�


− 𝜕𝜕𝜕𝜕
= −𝑚𝑚𝑚𝑚𝑚𝑚 � , 0� +
2∆𝑥𝑥

𝑢𝑢𝑡𝑡 (𝑖𝑖,𝑗𝑗+1)�𝑢𝑢𝑡𝑡 (𝑗𝑗,𝑖𝑖)+𝑢𝑢𝑡𝑡 (𝑖𝑖,𝑗𝑗+1)�


𝑚𝑚𝑚𝑚𝑚𝑚 �− , 0� (18)
2∆𝑥𝑥

𝑢𝑢𝑢𝑢𝑢𝑢 𝑢𝑢𝑡𝑡 (𝑖𝑖−1,𝑗𝑗)�𝑣𝑣 𝑡𝑡 (𝑖𝑖−1,𝑗𝑗)+𝑣𝑣 𝑡𝑡 (𝑖𝑖−1,𝑗𝑗+1)�


− 𝜕𝜕𝜕𝜕
= − 𝑚𝑚𝑚𝑚𝑚𝑚 � , 0� +
2∆𝑦𝑦

𝑢𝑢𝑡𝑡 (𝑖𝑖+1,𝑗𝑗)�𝑣𝑣 𝑡𝑡 (𝑖𝑖,𝑗𝑗)+𝑣𝑣 𝑡𝑡 (𝑖𝑖,𝑗𝑗+1)�


𝑚𝑚𝑚𝑚𝑚𝑚 �− , 0� (19)
2∆𝑦𝑦

𝑣𝑣𝑣𝑣𝑣𝑣 𝑣𝑣 𝑡𝑡 (𝑖𝑖−1,𝑗𝑗)�𝑣𝑣 𝑡𝑡 (𝑖𝑖−1,𝑗𝑗)+𝑣𝑣 𝑡𝑡 (𝑗𝑗,𝑖𝑖)�


− 𝜕𝜕𝜕𝜕
= −𝑚𝑚𝑚𝑚𝑚𝑚 � , 0� +
2∆𝑦𝑦

𝑣𝑣 𝑡𝑡 (𝑖𝑖+1,𝑗𝑗)�𝑣𝑣 𝑡𝑡 (𝑗𝑗,𝑖𝑖)+𝑣𝑣 𝑡𝑡 (𝑖𝑖+1,𝑗𝑗)�


𝑚𝑚𝑚𝑚𝑚𝑚 �− , 0� (20)
2∆𝑦𝑦

𝑣𝑣𝑣𝑣𝑣𝑣 𝑣𝑣 𝑡𝑡 (𝑖𝑖,𝑗𝑗−1)�𝑢𝑢𝑡𝑡 (𝑖𝑖,𝑗𝑗−1)+𝑢𝑢𝑡𝑡 (𝑖𝑖+1,𝑗𝑗−1)�


− 𝜕𝜕𝜕𝜕
= − 𝑚𝑚𝑚𝑚𝑚𝑚 � , 0� +
2∆𝑥𝑥

𝑣𝑣 𝑡𝑡 (𝑖𝑖,𝑗𝑗+1)�𝑢𝑢𝑡𝑡 (𝑖𝑖,𝑗𝑗)+𝑢𝑢𝑡𝑡 (𝑖𝑖+1,𝑗𝑗)�


𝑚𝑚𝑚𝑚𝑚𝑚 �− , 0� (21)
2∆𝑥𝑥

where ∆𝑥𝑥 and ∆𝑦𝑦 are the values representing the size of space in the discretized domain.
The pressure terms are discretized using the forward difference method, as shown in
Equations (22) and (23),

𝜕𝜕𝜕𝜕 𝑝𝑝𝑡𝑡 (𝑖𝑖,𝑗𝑗)−𝑝𝑝𝑡𝑡 (𝑖𝑖,𝑗𝑗+1)


− 𝜕𝜕𝜕𝜕 = − (22)
∆𝑥𝑥

𝜕𝜕𝜕𝜕 𝑝𝑝𝑡𝑡 (𝑖𝑖,𝑗𝑗)−𝑝𝑝𝑡𝑡 (𝑖𝑖+1,𝑗𝑗)


− 𝜕𝜕𝜕𝜕 = − (23)
∆𝑦𝑦
Int. Jnl. of Multiphysics Volume 12 · Number 4 · 2018 319

The diffusion terms are discretized using the central difference method, as shown in
Equations (24) to (27),

𝜕𝜕2 𝑢𝑢 𝑢𝑢𝑡𝑡 (𝑖𝑖,𝑗𝑗+1)− 2𝑢𝑢𝑡𝑡 (𝑖𝑖,𝑗𝑗)+ 𝑢𝑢𝑡𝑡 (𝑖𝑖,𝑗𝑗−1)


𝜕𝜕𝑥𝑥 2
= (24)
∆𝑥𝑥 2

𝜕𝜕2 𝑢𝑢 𝑢𝑢𝑡𝑡 (𝑖𝑖+1,𝑗𝑗)− 2𝑢𝑢𝑡𝑡 (𝑖𝑖,𝑗𝑗)+ 𝑢𝑢𝑡𝑡 (𝑖𝑖−1,𝑗𝑗)


𝜕𝜕𝑦𝑦 2
= (25)
∆𝑦𝑦 2

𝜕𝜕2 𝑣𝑣 𝑣𝑣 𝑡𝑡 (𝑖𝑖,𝑗𝑗+1)− 2𝑣𝑣 𝑡𝑡 (𝑖𝑖,𝑗𝑗)+ 𝑣𝑣 𝑡𝑡 (𝑖𝑖,𝑗𝑗−1)


𝜕𝜕𝑥𝑥 2
= (26)
∆𝑥𝑥 2

𝜕𝜕2 𝑣𝑣 𝑣𝑣 𝑡𝑡 (𝑖𝑖+1,𝑗𝑗)− 2𝑣𝑣 𝑡𝑡 (𝑖𝑖,𝑗𝑗)+ 𝑣𝑣 𝑡𝑡 (𝑖𝑖−1,𝑗𝑗)


𝜕𝜕𝑦𝑦 2
= (27)
∆𝑦𝑦 2

The discretized terms can be substituted in Navier-Stokes Equations (10) and (11),
resulting in the following forms, as shown in Equations (28) and (29),

𝑢𝑢𝑡𝑡+1 (𝑖𝑖, 𝑗𝑗) = 𝑢𝑢𝑡𝑡 (𝑖𝑖, 𝑗𝑗) +


(𝑝𝑝(𝑖𝑖,𝑗𝑗)−𝑝𝑝(𝑖𝑖,𝑗𝑗+1))
∆𝑡𝑡 �𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓(𝑢𝑢𝑡𝑡 , 𝑣𝑣 𝑡𝑡 , 𝜌𝜌 , 𝜇𝜇 , ∆𝑥𝑥, ∆𝑦𝑦) − ∆𝑥𝑥
� (28)

𝑣𝑣 𝑡𝑡+1 (𝑖𝑖, 𝑗𝑗) = 𝑣𝑣 𝑡𝑡 (𝑖𝑖, 𝑗𝑗) +


(𝑝𝑝(𝑖𝑖,𝑗𝑗)−𝑝𝑝(𝑖𝑖+1,𝑗𝑗))
∆𝑡𝑡 �𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓(𝑢𝑢𝑡𝑡 , 𝑣𝑣 𝑡𝑡 , 𝜌𝜌 , 𝜇𝜇 , ∆𝑥𝑥, ∆𝑦𝑦) − ∆𝑦𝑦
� (29)

The continuity equation (Equation (9)) is discretized using the forward difference method,
as shown in Equation (30),

(𝑢𝑢𝑡𝑡+1 (𝑖𝑖,𝑗𝑗−1)−𝑢𝑢𝑡𝑡+1 (𝑖𝑖,𝑗𝑗)) (𝑣𝑣 𝑡𝑡+1 (𝑖𝑖+1,𝑗𝑗)−𝑣𝑣 𝑡𝑡+1 (𝑖𝑖,𝑗𝑗))


∆𝑥𝑥
+ ∆𝑦𝑦
= 𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟 (30)

where 𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟 indicates the extent of convergence. Although its ideal value is zero, a small
number is acceptable for a numerical solution.
It is to be noted that Navier-Stokes equations (Equations (28) and (29)) are discretized in
time domain t. However, the continuity equation (Equation (30)) has been discretized in time
domain t+1. This is because the velocities in the new domain are calculated using Navier-
Stokes discretized equations (Equations (28) and (29)) and checked in the discretized
continuity equation (Equation (30)). The solution is iterated until the residual reduces to a
small number.
Since the solution is calculated via Navier-Stokes discretized equations (Equations (28)
and (29)), it always conforms with the law of conservation of momentum. However, it may
not conform with the law of conservation of mass as defined by the discretized continuity
equation (Equation (30)). In order to obtain convergence for both, laws of conservation of
momentum and mass, corrections need to be applied to velocities and pressure variables, as
shown in Equations (31) to (33),
320 Semi-Implicit Method for Pressure-Linked Equations (SIMPLE) – solution in MATLAB®

𝑢𝑢𝑡𝑡+1 (𝑖𝑖, 𝑗𝑗)𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 = 𝑢𝑢𝑡𝑡+1 (𝑖𝑖, 𝑗𝑗) + 𝑑𝑑𝑢𝑢𝑡𝑡+1 (𝑖𝑖, 𝑗𝑗) (31)

𝑣𝑣 𝑡𝑡+1 (𝑖𝑖, 𝑗𝑗)𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 = 𝑣𝑣 𝑡𝑡+1 (𝑖𝑖, 𝑗𝑗) + 𝑑𝑑𝑣𝑣 𝑡𝑡+1 (𝑖𝑖, 𝑗𝑗) (32)

𝑝𝑝𝑡𝑡+1 (𝑖𝑖, 𝑗𝑗)𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 = 𝑝𝑝𝑡𝑡+1 (𝑖𝑖, 𝑗𝑗) + 𝑑𝑑𝑝𝑝𝑡𝑡+1 (𝑖𝑖, 𝑗𝑗) (33)

where 𝑢𝑢𝑡𝑡+1 (𝑖𝑖, 𝑗𝑗)𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 , 𝑣𝑣 𝑡𝑡+1 (𝑖𝑖, 𝑗𝑗)𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 , and 𝑝𝑝𝑡𝑡+1 (𝑖𝑖, 𝑗𝑗)𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 are the corrected values
of velocity 𝑢𝑢, velocity 𝑣𝑣 and pressure 𝑝𝑝 that satisfy both continuity and Navier-Stokes
discretized equations (Equations (28) to (30)). 𝑑𝑑𝑢𝑢𝑡𝑡+1 (𝑖𝑖, 𝑗𝑗), 𝑑𝑑𝑣𝑣 𝑡𝑡+1 (𝑖𝑖, 𝑗𝑗), and 𝑑𝑑𝑝𝑝𝑡𝑡+1 (𝑖𝑖, 𝑗𝑗) are
the differences between the corrected values and are calculated for velocity 𝑢𝑢, velocity 𝑣𝑣
and pressure 𝑝𝑝, respectively.
Substituting the corrected values in the discretized Navier-Stokes equations (Equations
(28) and (29)) results in Equations (34) and (35),

𝑑𝑑𝑑𝑑𝑡𝑡+1 (𝑖𝑖,𝑗𝑗)– 𝑑𝑑𝑑𝑑𝑡𝑡+1 (𝑖𝑖,𝑗𝑗+1)


− 𝑑𝑑𝑑𝑑𝑡𝑡+1 (𝑖𝑖, 𝑗𝑗) = ∆𝑡𝑡 � � (34)
∆𝑥𝑥

𝑑𝑑𝑑𝑑𝑡𝑡 +1 (𝑖𝑖,𝑗𝑗)– 𝑑𝑑𝑑𝑑𝑡𝑡+1 (𝑖𝑖+1,𝑗𝑗)


− 𝑑𝑑𝑑𝑑 𝑡𝑡+1 (𝑖𝑖, 𝑗𝑗) = ∆𝑡𝑡 � � (35)
∆𝑦𝑦

Substituting Equations (34) to (35) in the discretized continuity equation (Equation (30))
results in Equation (36),

𝑑𝑑𝑑𝑑𝑡𝑡+1 (𝑖𝑖,𝑗𝑗−1)− 𝑑𝑑𝑑𝑑𝑡𝑡+1 (𝑖𝑖,𝑗𝑗)−𝑑𝑑𝑑𝑑𝑡𝑡+1 (𝑖𝑖,𝑗𝑗)𝑑𝑑𝑑𝑑𝑡𝑡+1 (𝑖𝑖,𝑗𝑗+1)


� �+
∆𝑥𝑥 2
∆𝑡𝑡 � 𝑑𝑑𝑑𝑑𝑡𝑡+1 (𝑖𝑖−1,𝑗𝑗)− 𝑑𝑑𝑑𝑑𝑡𝑡+1 (𝑖𝑖,𝑗𝑗)−𝑑𝑑𝑑𝑑𝑡𝑡+1 (𝑖𝑖,𝑗𝑗)+ 𝑑𝑑𝑑𝑑𝑡𝑡+1 (𝑖𝑖+1,𝑗𝑗) � = 𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟 (36)
� 2

∆𝑦𝑦

Equation (36) can be rearranged in Equation (37),

𝛼𝛼𝑑𝑑𝑑𝑑𝑡𝑡+1 (𝑖𝑖, 𝑗𝑗) + 𝛽𝛽𝑑𝑑𝑑𝑑𝑡𝑡+1 (𝑖𝑖 + 1, 𝑗𝑗) + 𝛽𝛽𝑑𝑑𝑑𝑑𝑡𝑡+1 (𝑖𝑖 − 1, 𝑗𝑗)


𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑙𝑙
+ 𝛽𝛽𝑑𝑑𝑑𝑑𝑡𝑡+1 (𝑖𝑖, 𝑗𝑗 + 1) + 𝛽𝛽𝑑𝑑𝑑𝑑𝑡𝑡+1 (𝑖𝑖, 𝑗𝑗 − 1) = − ∆𝑡𝑡
(37)

where 𝛼𝛼 and 𝛽𝛽 are given in Equations (38) and (39),

1 1
𝛼𝛼 = 2 �∆𝑥𝑥 2 + ∆𝑦𝑦 2 � (38)

1
𝛽𝛽 = − ∆𝑥𝑥 2 (39)

Equation (37) can be rearranged, as shown in Equation (40),


Int. Jnl. of Multiphysics Volume 12 · Number 4 · 2018 321

𝛼𝛼/𝛽𝛽 ⋯ 1 𝑑𝑑𝑑𝑑𝑡𝑡+1 (1,1) 1


𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟
𝛼𝛼𝛼𝛼 � ⋮ ⋱ ⋮ �� ⋮ � = − ∆𝑡𝑡 � ⋮ � (40)
1 ⋯ 𝛼𝛼/𝛽𝛽 𝑑𝑑𝑑𝑑𝑡𝑡+1 (𝑛𝑛, 𝑛𝑛) 1

where 𝛼𝛼 and 𝛽𝛽 can be rearranged in the form of a sparse matrix.


The above equation allows solving for residuals in an implicit manner. The obtained
pressure corrections can be substituted for velocity corrections (Equations (41) and (43)). To
stabilize the solution, the 𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟_𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓 is introduced with a value between 0 to 1.

𝑢𝑢𝑡𝑡+1 (𝑖𝑖, 𝑗𝑗)𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 = 𝑢𝑢𝑡𝑡+1 (𝑖𝑖, 𝑗𝑗) + 𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟_𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓. 𝑑𝑑𝑢𝑢 𝑡𝑡+1 (𝑖𝑖, 𝑗𝑗) (41)

𝑣𝑣 𝑡𝑡+1 (𝑖𝑖, 𝑗𝑗)𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 = 𝑣𝑣 𝑡𝑡+1 (𝑖𝑖, 𝑗𝑗) + 𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟_𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓. 𝑑𝑑𝑣𝑣 𝑡𝑡+1 (𝑖𝑖, 𝑗𝑗) (42)

𝑝𝑝𝑡𝑡+1 (𝑖𝑖, 𝑗𝑗)𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 = 𝑝𝑝𝑡𝑡+1 (𝑖𝑖, 𝑗𝑗) + 𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟_𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓. 𝑑𝑑𝑝𝑝𝑡𝑡+1 (𝑖𝑖, 𝑗𝑗) (43)

In addition, for stability and accuracy, it is vital to choose the correct timestep value. In
this work, the Courant–Friedrichs–Lewy (CFL) condition [1, 21] is used to decide the timestep
size. The CFL condition is given in Equation (44),

𝑚𝑚𝑚𝑚𝑚𝑚(𝑢𝑢, 𝑣𝑣) . ∆𝑡𝑡 ≤ 𝑚𝑚𝑚𝑚𝑚𝑚(∆𝑥𝑥, ∆𝑦𝑦) (44)

The given method of solution is solved and post-processed in MATLAB® [22]. The flow
chart of the code, which can be accessed from the Mathworks repository [23], is given in Fig.
4. The results are discussed in the next section.
322 Semi-Implicit Method for Pressure-Linked Equations (SIMPLE) – solution in MATLAB®

Figure 4. Flowchart of the code.


Int. Jnl. of Multiphysics Volume 12 · Number 4 · 2018 323

3. RESULTS AND DISCUSSION


The pressure and velocity fields are obtained in a 2-D domain, as shown in Fig. 5. The velocity
vectors show that the flow was diverted at the corners of the square. Pressure fields
demonstrate that the high pressures were developed in front of the square and low pressure
behind the square.

Figure 5. Pressure and velocity fields around a square in the 2-D domain.

In the given case, the maximum value of the residual value dropped below 10-4. The
maximum values of residuals from the continuity equation are plotted against the iteration
number, as shown in Fig. 6.
324 Semi-Implicit Method for Pressure-Linked Equations (SIMPLE) – solution in MATLAB®

Figure 6. Convergence plot: the maximum value of the residual is plotted against
the iteration number.

4. CONCLUSION
The presented study demonstrates that flow around a square in a 2-D domain can be
successfully solved using the SIMPLE algorithm. The paper offers an explanation of the
SIMPLE algorithm, detailing assumptions, degrees of freedom, discretization, as well as
pressure and velocity corrections. The method of solution is given in the form of a flowchart
and the code is implemented in MATLAB® and can be accessed from [23].

ACKNOWLEDGMENTS
The author would also like to acknowledge the support of Linda March from The Good
English Company, UK, for proofreading this work.

REFERENCES
[1] S. Patankar. Numerical Heat Transfer and Fluid Flow: Taylor & Francis; 1980.
[2] H. Khawaja. CFD-DEM Simulation of Minimum Fluidisation Velocity in Two Phase
Medium. The International Journal of Multiphysics. 2011;5(2):89-100.
[3] H. Khawaja. CFD-DEM and Experimental Study of Bubbling in a Fluidized Bed. The
Journal of Computational Multiphase Flows. 2015;7(4):227-40.
[4] H. Khawaja, T. Rashid, O. Eiksund, E. Brodal, K. Edvardsen. Multiphysics Simulation
of Infrared Signature of an Ice Cube. The International Journal of Multiphysics.
2016;10(3):291-302.
Int. Jnl. of Multiphysics Volume 12 · Number 4 · 2018 325

[5] J. Anderson. Computational Fluid Dynamics: McGraw-Hill Education; 1995.


[6] R. H. Pletcher, J. C. Tannehill, D. Anderson. Computational Fluid Mechanics and Heat
Transfer, Third Edition: CRC Press; 2016.
[7] H. Khawaja. Application of a 2-D approximation technique for solving stress analyses
problem in FEM. The International Journal of Multiphysics. 2015;9(4):317-24.
[8] H. Khawaja, S. Scott. CFD-DEM Simulation of Propagation of Sound Waves in Fluid
Particles Fluidised Medium. The International Journal of Multiphysics. 2011;5(1):47-
60.
[9] H. Khawaja, S. Scott, M. Virk, M. Moatamedi. Quantitative Analysis of Accuracy of
Voidage Computations in CFD-DEM Simulations. The Journal of Computational
Multiphase Flows. 2012;4(2):183-92.
[10] H. Khawaja, I. Raouf, K. Parvez, A. Scherer. Optimization of elstomeric micro-fluidic
valve dimensions using non-linear finite element methods. The International Journal of
Multiphysics. 2009;3(2):187-200.
[11] H. Khawaja, K. Parvez. Validation of normal and frictional contact models of spherical
bodies by FEM analysis. The International Journal of Multiphysics. 2010;4(2):175-85.
[12] H. Khawaja, M. Moatamedi. Selection of High Performance Alloy for Gas Turbine
Blade Using Multiphysics Analysis. The International Journal of Multiphysics.
2014;8(1):91-100.
[13] H. Khawaja, T. Bertelsen, R. Andreassen, M. Moatamedi. Study of CRFP Shell
Structures under Dynamic Loading in Shock Tube Setup. Journal of Structures.
2014;2014(Article ID 487809):6.
[14] H. Khawaja, R. Messahel, B. Ewan, S. Mhamed, M. Moatamedi. Experimental and
Numerical Study of Pressure in a Shock Tube. Journal of Pressure Vessel Technology.
2016;138(4):6.
[15] U. Mughal, H. Khawaja, M. Moatamedi. Finite element analysis of human femur bone.
The International Journal of Multiphysics. 2015;9(2):101-8.
[16] M. Kim. Finite Element Methods with Programming and Ansys: LULU Press; 2013.
[17] T. Stolarski, Y. Nakasone, S. Yoshimoto. Engineering Analysis with ANSYS Software:
Elsevier Science; 2011.
[18] Y. W. Kwon, H. Bang. The Finite Element Method Using MATLAB, Second Edition:
CRC Press; 2000.
[19] H. D. Young, A. L. Ford, R. A. Freedman. University Physics: Pearson Education; 2008.
[20] H. Khawaja. Applicability extent of 2-D heat equation for numerical analysis of a
multiphysics problem. AIP Conference Proceedings. 2017;1798(1):020075.
[21] R. Courant, K. Friedrichs, H. Lewy. Über die partiellen Differenzengleichungen der
mathematischen Physik. Mathematische Annalen. 1928;100(1):32-74.
[22] MATLAB®. Natick, Massachusetts: The MathWorks Inc.; 2016.
[23] H. Khawaja. Semi-Implicit Method for Pressure Linked Equations (SIMPLE) – solution
in MATLAB®. https://se.mathworks.com/matlabcentral/fileexchange/66129-simple
2018.
326

You might also like