# Numerical Treatment of a Modified MacCormack Scheme in a Nondimensional Form of the Water Quality Models in a Nonuniform Flow Stream

Authors: Nopparat Pochai
Journal: Journal of Applied Mathematics
 (2014)

---

## Abstract

Two mathematical models are used to simulate water quality in a nonuniform flow stream. The first model is the hydrodynamic model that provides the velocity field and the elevation of water. The second model is the dispersion model that provides the pollutant concentration field. Both models are formulated in one-dimensional equations. The traditional Crank-Nicolson method is also used in the hydrodynamic model. At each step, the flow velocity fields calculated from the first model are the input into the second model as the field data. A modified MacCormack method is subsequently employed in the second model. This paper proposes a simply remarkable alteration to the MacCormack method so as to make it more accurate without any significant loss of computational efficiency. The results obtained indicate that the proposed modified MacCormack scheme does improve the prediction accuracy compared to that of the traditional MacCormack method.


---

## Body

## 1. Introduction

In general, the amount of pollution levels in a stream can be measured via data collection from a real of field data site. It is somehow rather difficult and complex, and the results obtained tentatively deviate in the measurement from one point in each time/place to another when the water flow in the stream is not uniform. In water quality modelling for nonuniform flow stream, the general governing equations used are the hydrodynamic model and the dispersion model. The one-dimensional shallow water equation and advection-dispersion-reaction equation is govern the first and the second models, respectively.Numerous numerical techniques for solving such models are available. In [1], the finite element method for solving a steady water pollution control to achieve a minimum cost is presented. The numerical techniques for solving the uniform flow of stream water quality model, especially the one-dimensional advection-dispersion-reaction equation, are presented in [2–6].The nonuniform flow model requires data concerned with the velocity of the current at any point and any time in the domain. The hydrodynamics model provides the velocity field and tidal elevation of the water. In [7–10], they used the hydrodynamics model and the advection-dispersion equation to approximate the velocity of the water current in bay, uniform reservoir, and stream, respectively. Among these numerical techniques, the finite difference methods, including both explicit and implicit schemes, are mostly used for one-dimensional domain such as in longitudinal stream systems [11, 12].There are two mathematical models used to simulate water quality in a nonuniform water flow systems. The first is the hydrodynamic model that provides the velocity field and the elevation of water. The second is the dispersion model that gives the pollutant concentration field. A couple of models are formulated in one-dimensional equations. The traditional Crank-Nicolson method is used in the hydrodynamic model. At each step, the calculated flow velocity fields of the first model are input into the second model as the field data [9, 10, 13].The numerical techniques to solve the nonuniform flow of stream water quality model containing one-dimensional advection-dispersion-reaction equation have been presented in [10] using the fully implicit scheme: Crank-Nicolson method is used to solve the hydrodynamic model and backward time central space (BTCS) for dispersion model, respectively. In [13], the Crank-Nicolson method is also used to solve the hydrodynamic model, while the explicit Saulyev scheme is used to solve the dispersion model.Their research on finite difference techniques for the dispersion model has concentrated on computation accuracy and numerical stability. Many complicated numerical techniques, such as the QUICK scheme, the Lax-Wendroff scheme, and the Crandall scheme, have been studied to increase performances. These techniques have focused on advantages in terms of stability and higher order accuracy [3].The simple finite difference schemes become more attractive for model use. The simple explicit methods include the forward time-central space (FTCS) scheme, the MacCormack scheme, and the Saulyev scheme, and the implicit schemes include the backward time-central space (BTCS) scheme, and the Crank-Nicolson scheme [12]. These schemes are either first-order or second-order accurate and have the advantages in programming and computing without losing much accuracy and thus they are used for many model applications [3].A third-order upwind scheme for the advection-diffusion equation using a simple spreadsheets simulation is proposed in [14]. In [15], a new flux splitting scheme is proposed. The scheme is robust and converges as fast as the Roe Splitting. The Godunov-mixed methods for advection-dispersion equations are introduced in [16]. A time-splitting approach for advection-dispersion equations is also considered. In addition, [17] proposes a time-splitting method for multidimensional advection-diffusion equations that advection is approximated by a Godunov-type procedure, and diffusion is approximated by a low-order mixed finite element method. In [18], the flux-limiting solution techniques for simulation of reaction diffusion convection system are proposed. A composite scheme to solves the scalar transport equation in a two-dimensional space that accurately resolve sharp profiles in the flow is introduced. The total variation diminishing implicit Runge-Kutta methods for dissipative advection-diffusion problems in astrophysics is proposed in [19]. They derive dissipative space discretizations and demonstrate that together with specially adapted total-variation-diminishing (TVD) or strongly stable Runge-Kutta time discretizations with adaptive step-size control this yields reliable and efficient integrators for the underlying high-dimensional nonlinear evolution equations.In this research, we propose simple revisions to the MacCormack scheme that improve its accuracy for the problem of water quality measurement in a nonuniform water flow in a stream. In the following sections, the formulation of the traditional MacCormack scheme is reviewed. The revision of the modified MacCormack scheme is proposed.The results from the hydrodynamic model are the data of the water flow velocity for the advection-dispersion-reaction equation which provides the pollutant concentration field. The term of friction forces, due to the drag of sides of the stream, is considered. The theoretical solution of the model at the end point of the domain that guarantees the accuracy of the approximate solution is presented in [9, 10, 13].The stream has a simple one-space dimension as shown in Figure1. By averaging the equation over the depth, discarding the term due to the Coriolis force, it follows that the one-dimensional shallow water and the advection-dispersion-reaction equations are applicable. We use the Crank-Nicolson scheme, the traditional MacCormack scheme, and the Modified MacCormack scheme to approximate the velocity, the elevation, and the pollutant concentration from the first and the second models, respectively.Figure 1
The shallow water system.


## 2. Model Formulation

### 2.1. The Hydrodynamic Model

In this section, we derive a simple hydrodynamic model for describing water current and elevation by one-dimensional shallow water equation. We make the usual assumption in the continuity and momentum balance; that is, we assume that the Coriolis, shearing stresses, and the surface wind are small [7, 9, 10, 20]; we obtain the one-dimensional shallow water equations:
(1)
∂
ζ
∂
t
+
∂
∂
x
[
(
h
+
ζ
)
u
]
=
0
,
∂
u
∂
t
+
g
∂
ζ
∂
x
=
0
,
where x is the longitudinal distance along the stream (m), t is time (s), h
(
x
) is the depth measured from the mean water level to the stream bed (m), ζ
(
x
,
t
) is the elevation from the mean water level to the temporary water surface or the tidal elevation (m/s), and u
(
x
,
t
) is the velocity components (m/s), for all x
∈
[
0
,
l
].Assume thath is a constant and ζ
≪
h. Then (1) lead to
(2)
∂
ζ
∂
t
+
h
∂
u
∂
x
≐
0
,
∂
u
∂
t
+
g
∂
ζ
∂
x
=
0
.We will consider the equation in the dimensionless problem by lettingU
=
u
/
g
h
,
X
=
x
/
l
,
Z
=
ζ
/
h, and T
=
t
g
h
/
l. Substituting them into (2) leads to
(3)
∂
Z
∂
T
+
∂
U
∂
X
=
0
,
∂
U
∂
T
+
∂
Z
∂
X
=
0
.In [9, 10, 13], they introduce a damping term into (3) to represent the frictional forces due to the drag of sides of the stream,
(4)
∂
Z
∂
T
+
∂
U
∂
X
=
0
,
∂
U
∂
T
+
∂
Z
∂
X
=
-
U
,
with the initial conditions at t
=
0 and 0
≤
X
≤
1 are Z
=
0 and U
=
0. The boundary conditions for t
>
0 are specified: Z
=
e
i
t at X
=
0 and ∂
Z
/
∂
X
=
0 at X
=
1. The system of (4) is called the damped equation. We solve the damped equation by using the finite difference method. In order to solve (4) in [
0,1
]
×
[
0
,
T
], it is convenient to use u
,
d for U and Z, respectively:
(5)
∂
u
∂
t
+
∂
d
∂
x
=
-
u
,
∂
d
∂
t
+
∂
u
∂
x
=
0
,
with the initial conditions u
=
0
,
d
=
0, at t
=
0, and the boundary conditions d
(
0
,
t
)
=
f
(
t
) and ∂
d
/
∂
x
=
0 at x
=
1.


### 2.2. Dispersion Model

In a stream water quality model, the governing equations are the dynamic one-dimensional advection-dispersion-reaction equations (ADREs). A simplified representation by averaging the equation over the depth is shown in [2–4, 6, 10] as follows:
(6)
∂
C
∂
t
+
u
∂
C
∂
x
=
D
∂
2
C
∂
x
2
-
K
C
,
where C
(
x
,
t
) is the concentration averaged in depth at the point x and at time t, D is the diffusion coefficient, K is the mass decay rate, and u
(
x
,
t
) is the velocity component for all x
∈
[
0,1
]. We will consider the model with the following conditions. The initial condition C
(
x
,
0
)
=
0 at t
=
0 for all x
>
0. The boundary conditions C
(
0
,
t
)
=
C
0 at x
=
0 and ∂
C
/
∂
x
=
0 at x
=
1 where C
0 is a constant.


## 2.1. The Hydrodynamic Model

In this section, we derive a simple hydrodynamic model for describing water current and elevation by one-dimensional shallow water equation. We make the usual assumption in the continuity and momentum balance; that is, we assume that the Coriolis, shearing stresses, and the surface wind are small [7, 9, 10, 20]; we obtain the one-dimensional shallow water equations:
(1)
∂
ζ
∂
t
+
∂
∂
x
[
(
h
+
ζ
)
u
]
=
0
,
∂
u
∂
t
+
g
∂
ζ
∂
x
=
0
,
where x is the longitudinal distance along the stream (m), t is time (s), h
(
x
) is the depth measured from the mean water level to the stream bed (m), ζ
(
x
,
t
) is the elevation from the mean water level to the temporary water surface or the tidal elevation (m/s), and u
(
x
,
t
) is the velocity components (m/s), for all x
∈
[
0
,
l
].Assume thath is a constant and ζ
≪
h. Then (1) lead to
(2)
∂
ζ
∂
t
+
h
∂
u
∂
x
≐
0
,
∂
u
∂
t
+
g
∂
ζ
∂
x
=
0
.We will consider the equation in the dimensionless problem by lettingU
=
u
/
g
h
,
X
=
x
/
l
,
Z
=
ζ
/
h, and T
=
t
g
h
/
l. Substituting them into (2) leads to
(3)
∂
Z
∂
T
+
∂
U
∂
X
=
0
,
∂
U
∂
T
+
∂
Z
∂
X
=
0
.In [9, 10, 13], they introduce a damping term into (3) to represent the frictional forces due to the drag of sides of the stream,
(4)
∂
Z
∂
T
+
∂
U
∂
X
=
0
,
∂
U
∂
T
+
∂
Z
∂
X
=
-
U
,
with the initial conditions at t
=
0 and 0
≤
X
≤
1 are Z
=
0 and U
=
0. The boundary conditions for t
>
0 are specified: Z
=
e
i
t at X
=
0 and ∂
Z
/
∂
X
=
0 at X
=
1. The system of (4) is called the damped equation. We solve the damped equation by using the finite difference method. In order to solve (4) in [
0,1
]
×
[
0
,
T
], it is convenient to use u
,
d for U and Z, respectively:
(5)
∂
u
∂
t
+
∂
d
∂
x
=
-
u
,
∂
d
∂
t
+
∂
u
∂
x
=
0
,
with the initial conditions u
=
0
,
d
=
0, at t
=
0, and the boundary conditions d
(
0
,
t
)
=
f
(
t
) and ∂
d
/
∂
x
=
0 at x
=
1.


## 2.2. Dispersion Model

In a stream water quality model, the governing equations are the dynamic one-dimensional advection-dispersion-reaction equations (ADREs). A simplified representation by averaging the equation over the depth is shown in [2–4, 6, 10] as follows:
(6)
∂
C
∂
t
+
u
∂
C
∂
x
=
D
∂
2
C
∂
x
2
-
K
C
,
where C
(
x
,
t
) is the concentration averaged in depth at the point x and at time t, D is the diffusion coefficient, K is the mass decay rate, and u
(
x
,
t
) is the velocity component for all x
∈
[
0,1
]. We will consider the model with the following conditions. The initial condition C
(
x
,
0
)
=
0 at t
=
0 for all x
>
0. The boundary conditions C
(
0
,
t
)
=
C
0 at x
=
0 and ∂
C
/
∂
x
=
0 at x
=
1 where C
0 is a constant.


## 3. Crank-Nicolson Method for the Hydrodynamic Model

The hydrodynamic model provides the velocity field and elevation of the water. Then the calculated results of the model will be the input into the dispersion model which provides the pollutant concentration field. We will follow the numerical techniques of [9]. To find the water velocity and water elevation from (5), we make the following change to variables v
=
e
t
u and substitute it into (5). Therefore,
(7)
∂
v
∂
t
+
e
t
∂
d
∂
x
=
0
,
∂
d
∂
t
+
e
-
t
∂
v
∂
x
=
0
.
Equations (7) can be written in the matrix form
(8)
(
v
d
)
t
+
[
0
e
t
e
-
t
0
]
(
v
d
)
x
=
(
0
0
)
.
That is
(9)
U
t
+
A
U
x
=
0
¯
,
where
(10)
A
=
[
0
e
t
e
-
t
0
]
,
U
=
(
v
d
)
,
(
v
d
)
t
=
(
∂
v
∂
t
∂
d
∂
t
)
,
with the initial condition d
=
v
=
0 at t
=
0. The left boundary condition for x
=
0
,
t
>
0 is specified: d
(
0
,
t
)
=
sin
t and ∂
v
/
∂
x
=
-
e
t
cos
⁡
t, and the right boundary condition for x
=
1
,
t
>
0 is specified: ∂
d
/
∂
x
=
0 and v
(
0
,
t
)
=
0.We now discretize (9) by dividing the interval [
0,1
] into M subintervals such that M
Δ
x
=
1 and the interval [
0
,
T
] into N subintervals such that N
Δ
t
=
T. We can then approximate d
(
x
i
,
t
n
) by d
i
n, value of the difference approximation of d
(
x
,
t
) at point x
=
i
Δ
x and t
=
n
Δ
t, where 0
≤
i
≤
M and 0
≤
n
≤
N, and similarly defined for v
i
n and U
i
n. The grid point (
x
n
,
t
n
) is defined by x
i
=
i
Δ
x for all i
=
0,1
,
2
,
…
,
M and t
n
=
n
Δ
t for all n
=
0,1
,
2
,
…
,
N in which M and N are positive integers. Using the Crank-Nicolson method [21] to (9), the following finite difference equation can be obtained:
(11)
[
I
-
1
4
λ
A
(
Δ
x
+
∇
x
)
]
U
i
n
+
1
=
[
I
+
1
4
λ
A
(
Δ
x
+
∇
x
)
]
U
i
n
,
where
(12)
U
i
n
=
(
v
i
n
d
i
n
)
,
Δ
x
U
i
n
=
U
i
+
1
n
-
U
i
n
,
∇
x
U
i
n
=
U
i
n
-
U
i
-
1
n
,
I is the unit matrix of order 2, and λ
=
Δ
t
/
Δ
x. Applying the initial and boundary conditions given in (7), it can be obtained the general form
(13)
G
n
+
1
U
¯
n
+
1
=
E
n
U
¯
n
+
F
n
,
where
(14)
G
n
+
1
=
[
1
0
0
-
λ
4
a
1
n
+
1
0
0
λ
4
a
2
n
+
1
1
-
λ
4
a
2
n
+
1
0
0
0
0
λ
4
a
1
n
+
1
1
0
0
-
λ
4
a
1
n
+
1
λ
4
a
2
n
+
1
0
0
1
-
λ
4
a
2
n
+
1
0
⋱
⋱
⋱
⋱
⋱
⋱
0
0
0
λ
4
a
1
n
+
1
1
-
λ
4
a
1
n
+
1
0
0
λ
4
a
2
n
+
1
0
0
1
]
,
E
n
=
[
1
0
0
-
λ
4
a
1
n
0
0
-
λ
4
a
2
n
1
λ
4
a
2
n
0
0
0
0
-
λ
4
a
1
n
1
0
0
λ
4
a
1
n
-
λ
4
a
2
n
0
0
1
λ
4
a
2
n
0
⋱
⋱
⋱
⋱
⋱
⋱
0
0
0
-
λ
4
a
1
n
1
λ
4
a
1
n
0
0
-
λ
4
a
2
n
0
0
1
]
,
U
¯
n
=
(
U
1
n
U
2
n
⋮
U
M
-
1
n
)
,
F
n
=
(
-
λ
4
a
1
n
+
1
sin
(
t
n
+
1
)
-
λ
4
a
1
n
sin
(
t
n
)
-
λ
4
a
2
n
+
1
Δ
x
e
-
t
n
+
1
cos
⁡
(
t
n
+
1
)
-
λ
4
a
2
n
Δ
x
e
-
t
n
cos
⁡
(
t
n
)
0
0
⋮
0
0
)
,wherea
1
n
=
e
t
n
,
a
2
n
=
e
-
t
n, and t
n
=
n
Δ
t for all n
=
0,1
,
2
,
…
,
N. The Crank-Nicolson scheme is unconditionally stable [12, 21].


## 4. A Modified MacCormack Scheme for the Advection-Dispersion-Reaction Equation

### 4.1. The Traditional MacCormack Scheme

First of all, we consider the traditional MacCormack scheme. The scheme is an explicit finite difference scheme with predictor-corrector two-step method. The first step is a modification of forward time central space (FTCS) by changing the central space evaluation at timen to a forward space evaluation. This step is a forward time forward space (FTFS) scheme. The FTFS scheme approximates the temporal and spacial derivatives and the decay in (6) with the following discretization.We can then approximateC
(
x
i
,
t
n
) by C
i
n, the value of the difference approximation of C
(
x
,
t
) at point x
=
i
Δ
x and t
=
n
Δ
t, where 0
≤
i
≤
M and 0
≤
n
≤
N. The grid point (
x
n
,
t
n
) is defined by x
i
=
i
Δ
x for all i
=
0,1
,
2
,
…
,
M and t
n
=
n
Δ
t for all n
=
0,1
,
2
,
…
,
N in which M and N are positive integers. Taking the forward time forward space technique [3, 21] into (6), we get the following discretization:
(15)
C
≅
C
i
n
,
∂
C
∂
t
≅
C
i
n
+
1
-
C
i
n
Δ
t
,
∂
C
∂
x
≅
C
i
+
1
n
-
C
i
n
Δ
x
,
∂
2
C
∂
x
2
≅
C
i
+
1
n
-
2
C
i
n
+
C
i
-
1
n
(
Δ
x
)
2
,
u
≅
U
^
i
n
.Note thatU
^
i
n are obtained by the Crank-Nicolson method with the hydrodynamic model of (5) that are presented in [9, 10, 13].Substituting (15) into (6), we get
(16)
C
i
n
+
1
-
C
i
n
Δ
t
+
U
^
i
n
(
C
i
+
1
n
-
C
i
n
Δ
x
)
=
D
(
C
i
+
1
n
-
2
C
i
n
+
C
i
-
1
n
(
Δ
x
)
2
)
-
K
C
i
n
,
for 1
≤
i
≤
M and 0
≤
n
≤
N
-
1. Substitute the difference equation into (16), and then define slope S
i
1 as
(17)
S
i
1
=
-
U
^
i
n
(
C
i
+
1
n
-
C
i
n
Δ
x
)
+
D
(
C
i
+
1
n
-
2
C
i
n
+
C
i
-
1
n
(
Δ
x
)
2
)
-
K
C
i
n
.
Let λ
=
D
Δ
t
/
(
Δ
x
)
2 and γ
i
n
+
1
=
(
Δ
t
/
Δ
x
)
U
^
i
n
+
1, and then define γ
´
i
n
=
γ
i
n
/
Δ
t
=
U
^
i
n
/
Δ
x and λ
´
=
D
/
(
Δ
x
)
2
=
λ
/
Δ
t. Equation (17) takes a simplified form:
(18)
S
i
1
=
-
γ
´
i
n
(
C
i
+
1
n
-
C
i
n
)
+
λ
´
(
C
i
+
1
n
-
2
C
i
n
+
C
i
-
1
n
)
-
K
C
i
n
,
or
(19)
S
i
1
=
(
λ
´
-
γ
´
i
n
)
C
i
+
1
n
-
(
2
λ
´
-
γ
´
i
n
+
K
)
C
i
n
+
λ
´
C
i
-
1
n
.For upper boundary, wherei
=
1, plug the known value of the left boundary C
0
n
=
C
0 to (19) in the right hand side; we obtain
(20)
S
1
1
=
(
λ
´
-
γ
´
1
n
)
C
2
n
-
(
2
λ
´
-
γ
´
1
n
+
K
)
C
1
n
+
λ
´
C
0
.For the lower boundary, wherei
=
M, substitute the approximate unknown value of the right boundary by the forward difference approximation to ∂
C
/
∂
x
=
0. Let C
M
=
C
M
-
1 and rearrange; we obtain
(21)
S
M
1
=
-
(
λ
´
+
K
)
C
M
-
1
n
+
λ
´
C
M
-
2
n
.Taking the Euler formula, we obtain the MacCormack predictor step formulation:(22)
C
i
n
+
1
=
C
i
n
+
S
i
1
Δ
t
.The second step is a modified backward time central space (BTCS) scheme by changing the central space evaluation timen with a backward space evaluation. It is essentially a backward time backward space (BTBS) scheme. The BTBS scheme approximates the temporal and spacial derivatives and the decay in (6) with the following discretization:
(23)
C
≅
1
2
(
C
i
n
+
C
i
n
+
1
)
,
∂
C
∂
t
≅
C
i
n
+
1
-
C
i
n
Δ
t
,
∂
C
∂
x
≅
C
i
n
+
1
-
C
i
-
1
n
+
1
Δ
x
,
∂
2
C
∂
x
2
≅
1
2
(
C
i
+
1
n
-
2
C
i
n
+
C
i
-
1
n
(
Δ
x
)
2
+
C
i
+
1
n
+
1
-
2
C
i
n
+
1
+
C
i
-
1
n
+
1
(
Δ
x
)
2
)
.Because the values at time leveln
+
1 have been calculated in predictor step, the second step is also explicit. It follows that the slope base on their predictor points can be calculated as follows:
(24)
S
i
2
=
λ
´
C
i
+
1
n
+
1
-
(
2
λ
´
+
γ
´
i
n
+
1
+
K
)
C
i
n
+
1
+
(
λ
´
+
γ
´
i
n
+
1
)
C
i
-
1
n
+
1
.For upper boundary, wherei
=
1, plug the known value of the left boundary C
0
n
+
1
=
C
0 to (24) in the right hand side. We obtain
(25)
S
1
2
=
λ
´
C
2
n
+
1
-
(
2
λ
´
+
γ
´
1
n
+
1
+
K
)
C
1
n
+
1
+
(
λ
´
+
γ
´
1
n
+
1
)
C
0
.For the lower boundary, wherei
=
M, substitute the approximate unknown value of the right boundary by the backward difference approximation to ∂
C
/
∂
x
=
0. Let C
M
+
1
=
C
M and rearrange; then, we obtain
(26)
S
M
2
=
λ
´
C
M
n
+
1
-
(
2
λ
´
+
γ
´
M
n
+
1
+
K
)
C
M
n
+
1
+
(
λ
´
+
γ
´
M
n
+
1
)
C
M
-
1
n
+
1
.From both of the steps, the MacCormack scheme takes the following form:(27)
C
i
n
+
1
=
C
i
n
+
Δ
t
2
(
S
i
1
+
S
i
2
)
.The MacCormack scheme is conditionally stable subject to constraints in (16). The stability requirements for the scheme are [22]
(28)
λ
=
D
Δ
t
(
Δ
x
)
2
<
1
2
,
γ
i
n
=
U
^
i
n
Δ
t
Δ
x
<
0.9
,
where λ is the diffusion number (dimensionless) and γ
i
n is the advection number or Courant number (dimensionless).


### 4.2.  The Modified MacCormack Scheme

Since the derivative approximation during discretization is not centered, numerical dispersion will be introduced. The dispersion coefficients used in the dispersion model would take the value obtained by subtracting the numerical dispersion from the real data of the stream. The amounts of the numerical dispersion introduced by backward space denoted byD
n
1 and forward time denoted by D
n
2 schemes as follow [3, 12]:
(29)
D
n
1
i
n
=
Δ
x
2
U
^
i
n
,
D
n
2
i
n
=
-
Δ
x
2
(
U
^
i
n
)
2
.There are temporal and spacial numerical dispersion in both predictor and corrector steps since the scheme uses forward time forward space difference for prediction and backward time backward space difference for correction. From (29), the numerical dispersion for forward time forward space prediction step and backward time backward space correction step are
(30)
D
n
prd
i
n
=
-
Δ
x
2
U
^
i
n
-
Δ
t
2
(
U
^
i
n
)
2
,
D
n
crc
i
n
=
Δ
x
2
U
^
i
n
+
Δ
t
2
(
U
^
i
n
)
2
.The modified MacCormack scheme uses the following corrected dispersion, rather than the real dispersion coefficients for calculation in both prediction and correction steps:(31)
D
1
i
n
=
D
real
-
D
n
prd
i
n
,
D
2
i
n
=
D
real
-
D
n
crc
i
n
,
where D
1
i
n is the dispersion coefficient used in the prediction step and D
2
i
n is the dispersion coefficient used in the correction step.The modified MacCormack scheme is conditionally stable subject to the constraint in (16). The stability requirements for the scheme:
(32)
λ
=
D
max
⁡
Δ
t
(
Δ
x
)
2
<
1
2
,
γ
i
n
=
U
^
i
n
Δ
t
Δ
x
<
0.9
,
where the maximum of numerical dispersion coefficients is D
max
⁡
=
max
⁡
{
D
1
i
n
,
D
2
i
n
:
0
≤
i
≤
M
,
0
≤
n
≤
N
}.


## 4.1. The Traditional MacCormack Scheme

First of all, we consider the traditional MacCormack scheme. The scheme is an explicit finite difference scheme with predictor-corrector two-step method. The first step is a modification of forward time central space (FTCS) by changing the central space evaluation at timen to a forward space evaluation. This step is a forward time forward space (FTFS) scheme. The FTFS scheme approximates the temporal and spacial derivatives and the decay in (6) with the following discretization.We can then approximateC
(
x
i
,
t
n
) by C
i
n, the value of the difference approximation of C
(
x
,
t
) at point x
=
i
Δ
x and t
=
n
Δ
t, where 0
≤
i
≤
M and 0
≤
n
≤
N. The grid point (
x
n
,
t
n
) is defined by x
i
=
i
Δ
x for all i
=
0,1
,
2
,
…
,
M and t
n
=
n
Δ
t for all n
=
0,1
,
2
,
…
,
N in which M and N are positive integers. Taking the forward time forward space technique [3, 21] into (6), we get the following discretization:
(15)
C
≅
C
i
n
,
∂
C
∂
t
≅
C
i
n
+
1
-
C
i
n
Δ
t
,
∂
C
∂
x
≅
C
i
+
1
n
-
C
i
n
Δ
x
,
∂
2
C
∂
x
2
≅
C
i
+
1
n
-
2
C
i
n
+
C
i
-
1
n
(
Δ
x
)
2
,
u
≅
U
^
i
n
.Note thatU
^
i
n are obtained by the Crank-Nicolson method with the hydrodynamic model of (5) that are presented in [9, 10, 13].Substituting (15) into (6), we get
(16)
C
i
n
+
1
-
C
i
n
Δ
t
+
U
^
i
n
(
C
i
+
1
n
-
C
i
n
Δ
x
)
=
D
(
C
i
+
1
n
-
2
C
i
n
+
C
i
-
1
n
(
Δ
x
)
2
)
-
K
C
i
n
,
for 1
≤
i
≤
M and 0
≤
n
≤
N
-
1. Substitute the difference equation into (16), and then define slope S
i
1 as
(17)
S
i
1
=
-
U
^
i
n
(
C
i
+
1
n
-
C
i
n
Δ
x
)
+
D
(
C
i
+
1
n
-
2
C
i
n
+
C
i
-
1
n
(
Δ
x
)
2
)
-
K
C
i
n
.
Let λ
=
D
Δ
t
/
(
Δ
x
)
2 and γ
i
n
+
1
=
(
Δ
t
/
Δ
x
)
U
^
i
n
+
1, and then define γ
´
i
n
=
γ
i
n
/
Δ
t
=
U
^
i
n
/
Δ
x and λ
´
=
D
/
(
Δ
x
)
2
=
λ
/
Δ
t. Equation (17) takes a simplified form:
(18)
S
i
1
=
-
γ
´
i
n
(
C
i
+
1
n
-
C
i
n
)
+
λ
´
(
C
i
+
1
n
-
2
C
i
n
+
C
i
-
1
n
)
-
K
C
i
n
,
or
(19)
S
i
1
=
(
λ
´
-
γ
´
i
n
)
C
i
+
1
n
-
(
2
λ
´
-
γ
´
i
n
+
K
)
C
i
n
+
λ
´
C
i
-
1
n
.For upper boundary, wherei
=
1, plug the known value of the left boundary C
0
n
=
C
0 to (19) in the right hand side; we obtain
(20)
S
1
1
=
(
λ
´
-
γ
´
1
n
)
C
2
n
-
(
2
λ
´
-
γ
´
1
n
+
K
)
C
1
n
+
λ
´
C
0
.For the lower boundary, wherei
=
M, substitute the approximate unknown value of the right boundary by the forward difference approximation to ∂
C
/
∂
x
=
0. Let C
M
=
C
M
-
1 and rearrange; we obtain
(21)
S
M
1
=
-
(
λ
´
+
K
)
C
M
-
1
n
+
λ
´
C
M
-
2
n
.Taking the Euler formula, we obtain the MacCormack predictor step formulation:(22)
C
i
n
+
1
=
C
i
n
+
S
i
1
Δ
t
.The second step is a modified backward time central space (BTCS) scheme by changing the central space evaluation timen with a backward space evaluation. It is essentially a backward time backward space (BTBS) scheme. The BTBS scheme approximates the temporal and spacial derivatives and the decay in (6) with the following discretization:
(23)
C
≅
1
2
(
C
i
n
+
C
i
n
+
1
)
,
∂
C
∂
t
≅
C
i
n
+
1
-
C
i
n
Δ
t
,
∂
C
∂
x
≅
C
i
n
+
1
-
C
i
-
1
n
+
1
Δ
x
,
∂
2
C
∂
x
2
≅
1
2
(
C
i
+
1
n
-
2
C
i
n
+
C
i
-
1
n
(
Δ
x
)
2
+
C
i
+
1
n
+
1
-
2
C
i
n
+
1
+
C
i
-
1
n
+
1
(
Δ
x
)
2
)
.Because the values at time leveln
+
1 have been calculated in predictor step, the second step is also explicit. It follows that the slope base on their predictor points can be calculated as follows:
(24)
S
i
2
=
λ
´
C
i
+
1
n
+
1
-
(
2
λ
´
+
γ
´
i
n
+
1
+
K
)
C
i
n
+
1
+
(
λ
´
+
γ
´
i
n
+
1
)
C
i
-
1
n
+
1
.For upper boundary, wherei
=
1, plug the known value of the left boundary C
0
n
+
1
=
C
0 to (24) in the right hand side. We obtain
(25)
S
1
2
=
λ
´
C
2
n
+
1
-
(
2
λ
´
+
γ
´
1
n
+
1
+
K
)
C
1
n
+
1
+
(
λ
´
+
γ
´
1
n
+
1
)
C
0
.For the lower boundary, wherei
=
M, substitute the approximate unknown value of the right boundary by the backward difference approximation to ∂
C
/
∂
x
=
0. Let C
M
+
1
=
C
M and rearrange; then, we obtain
(26)
S
M
2
=
λ
´
C
M
n
+
1
-
(
2
λ
´
+
γ
´
M
n
+
1
+
K
)
C
M
n
+
1
+
(
λ
´
+
γ
´
M
n
+
1
)
C
M
-
1
n
+
1
.From both of the steps, the MacCormack scheme takes the following form:(27)
C
i
n
+
1
=
C
i
n
+
Δ
t
2
(
S
i
1
+
S
i
2
)
.The MacCormack scheme is conditionally stable subject to constraints in (16). The stability requirements for the scheme are [22]
(28)
λ
=
D
Δ
t
(
Δ
x
)
2
<
1
2
,
γ
i
n
=
U
^
i
n
Δ
t
Δ
x
<
0.9
,
where λ is the diffusion number (dimensionless) and γ
i
n is the advection number or Courant number (dimensionless).


## 4.2.  The Modified MacCormack Scheme

Since the derivative approximation during discretization is not centered, numerical dispersion will be introduced. The dispersion coefficients used in the dispersion model would take the value obtained by subtracting the numerical dispersion from the real data of the stream. The amounts of the numerical dispersion introduced by backward space denoted byD
n
1 and forward time denoted by D
n
2 schemes as follow [3, 12]:
(29)
D
n
1
i
n
=
Δ
x
2
U
^
i
n
,
D
n
2
i
n
=
-
Δ
x
2
(
U
^
i
n
)
2
.There are temporal and spacial numerical dispersion in both predictor and corrector steps since the scheme uses forward time forward space difference for prediction and backward time backward space difference for correction. From (29), the numerical dispersion for forward time forward space prediction step and backward time backward space correction step are
(30)
D
n
prd
i
n
=
-
Δ
x
2
U
^
i
n
-
Δ
t
2
(
U
^
i
n
)
2
,
D
n
crc
i
n
=
Δ
x
2
U
^
i
n
+
Δ
t
2
(
U
^
i
n
)
2
.The modified MacCormack scheme uses the following corrected dispersion, rather than the real dispersion coefficients for calculation in both prediction and correction steps:(31)
D
1
i
n
=
D
real
-
D
n
prd
i
n
,
D
2
i
n
=
D
real
-
D
n
crc
i
n
,
where D
1
i
n is the dispersion coefficient used in the prediction step and D
2
i
n is the dispersion coefficient used in the correction step.The modified MacCormack scheme is conditionally stable subject to the constraint in (16). The stability requirements for the scheme:
(32)
λ
=
D
max
⁡
Δ
t
(
Δ
x
)
2
<
1
2
,
γ
i
n
=
U
^
i
n
Δ
t
Δ
x
<
0.9
,
where the maximum of numerical dispersion coefficients is D
max
⁡
=
max
⁡
{
D
1
i
n
,
D
2
i
n
:
0
≤
i
≤
M
,
0
≤
n
≤
N
}.


## 5. The Accuracy of the Hydrodynamic Approximation

It is not hard to find the analytical solutiond
(
x
,
t
) in (5) with f
(
t
)
=
sin
t. By changing of variables, d
(
x
,
t
)
=
e
i
t
𝒟
(
x
) and u
(
x
,
t
)
=
e
i
t
𝒰
(
x
) for some 𝒟
(
x
)
,
𝒰
(
x
)
∈
C
0
2
[
0,1
] by substituting it in (5). Using a separable variables technique, we can obtain d
(
1
,
t
) a solution [10]:
(33)
d
(
1
,
t
)
=
sin
t
cos
⁡
β
cosh
⁡
α
-
cos
⁡
t
sin
β
sinh
⁡
α
cos
⁡
2
β
cosh
⁡
2
α
+
sin
2
β
sinh
⁡
2
α
,
where α
=
2
1
/
4
cos
⁡
(
3
π
/
8
) and β
=
2
1
/
4
sin
(
3
π
/
8
). However, it is not easy to find the analytical solution u
(
x
,
t
) of (5). We use the solution d
(
1
,
t
) obtained in (33) to verify our approximate solution obtained by the Crank-Nicolson method equation (13). Actually when the Crank-Nicolson method is used, we get the approximate solution both d
(
x
,
t
) and u
(
x
,
t
). We assume that when we get a good approximation for d
(
x
,
t
), this implies that the method gives a good approximation for u
(
x
,
t
). The verification of the approximate solution d
¯
(
1
,
t
) is shown in Figure 2.Figure 2
Comparison of analytical solution for height of water elevation with results obtained by numerical technique at the end point of the domain.Figure2 shows the comparison between the analytical solutions d
(
1
,
t
) and the approximate solutions d
¯
(
1
,
t
) only at the end of the domain.Unfortunately, the analytical solutions of the hydrodynamic model could not be found over the entire domain [10]. This implied that the analytical solutions of the dispersion model could not be computed at any points in the domain as well.


## 6. Application to the Stream Water Quality Assessment Problem

Suppose that the measurement of pollutant concentrationC in a nonuniform flow stream is considered. A stream is aligned with longitudinal distance, 1.0 (km) total length and 1.0 (m) depth. There is a plant which discharges waste water into the stream and the pollutant concentration at the discharge point is C
(
0
,
t
)
=
C
0
=
1 (mg/L) at x
=
0 for all t
>
0 and C
(
x
,
0
)
=
0 (mg/L) at t
=
0. The elevation of water at the discharge point can be described as a function d
(
0
,
t
)
=
f
(
t
)
=
sin
t (m) for all t
>
0, and the elevation does not change at x
=
1.0 (km) The physical parameters of the stream system are diffusion coefficient D
=
0.0125 (m2/s) and a first-order reaction rate 1
0
-
5s−1. In the analysis conducted in this study, meshing the stream into 40 elements with Δ
x
=
0.025, and the time increment is 0.4 (s) with Δ
t
=
0.00125, characterizing a one-dimensional flow. Using the Crank-Nicolson method of [9, 10, 13], it can be obtained the water velocity u
(
x
,
t
) in Table 1 and Figure 3. Next, the approximate water velocity can be plugged into the traditional MacCormack scheme in (27). We also plug the approximate water velocity into the modified MacCormack scheme (27) with numerical dispersion coefficients (31). The approximation of pollutant concentrations C of both schemes is shown in Tables 2 and 3 and Figures 4 and 5. The comparison of traditional MacCormack and modified MacCormack is shown in Figure 6.Table 1
The velocity of water flowu
(
x
,
t
).
t
x
=
0
x
=
0.1
x
=
0.2
x
=
0.3
x
=
0.4
x
=
0.5
x
=
0.6
x
=
0.7
x
=
0.8
x
=
0.9
x
=
1.0
10
1.3125
1.2187
1.1125
0.9960
0.8704
0.7372
0.5977
0.4530
0.3041
0.1525
0.0000
20
−1.0899
−1.0355
−0.9644
−0.8782
−0.7784
−0.6670
−0.5456
−0.4162
−0.2808
−0.1414
0.0000
30
0.5200
0.5224
0.5088
0.4801
0.4380
0.3839
0.3196
0.2471
0.1683
0.0852
0.0000
40
0.2172
0.1586
0.1105
0.0723
0.0433
0.0226
0.0091
0.0014
−0.0015
−0.0015
0.0000Table 2
The pollutant concentrationC
(
x
,
t
) of traditional MacCormack scheme, Δ
x = 0.025 and Δ
t = 0.00125.
t
x
=
0
x
=
0.1
x
=
0.2
x
=
0.3
x
=
0.4
x
=
0.5
x
=
0.6
x
=
0.7
x
=
0.8
x
=
0.9
x
=
1.0
10
1.000000
0.174513
0.029152
0.004634
0.000697
0.000099
0.000013
0.000002
0.000000
0.000000
0.000000
20
1.000000
0.054532
0.003068
0.000180
0.000011
0.000001
0.000000
0.000000
0.000000
0.000000
0.000000
30
1.000000
0.125937
0.015943
0.002012
0.000251
0.000031
0.000004
0.000000
0.000000
0.000000
0.000000
40
1.000000
0.105911
0.010827
0.001074
0.000104
0.000010
0.000001
0.000000
0.000000
0.000000
0.000000Table 3
The pollutant concentrationC
(
x
,
t
) of modified MacCormack scheme, Δ
x = 0.025 and Δ
t = 0.00125.
t
x
=
0
x
=
0.1
x
=
0.2
x
=
0.3
x
=
0.4
x
=
0.5
x
=
0.6
x
=
0.7
x
=
0.8
x
=
0.9
x
=
1.0
10
1.000000
0.146939
0.021001
0.002907
0.000388
0.000050
0.000006
0.000001
0.000000
0.000000
0.000000
20
1.000000
0.059627
0.003656
0.000233
0.000015
0.000001
0.000000
0.000000
0.000000
0.000000
0.000000
30
1.000000
0.117948
0.013959
0.001648
0.000193
0.000022
0.000003
0.000000
0.000000
0.000000
0.000000
40
1.000000
0.103863
0.010501
0.001038
0.000101
0.000010
0.000001
0.000000
0.000000
0.000000
0.000000Figure 3
The water velocityu
(
x
,
t
) m/s.Figure 4
The pollutant concentrationC
(
x
,
t
) (mg/L) using traditional MacCormack scheme.Figure 5
The pollutant concentrationC
(
x
,
t
) (mg/L) using modified MacCormack scheme.The comparison of concentration at 4 different time instants of Modified MacCormack and Traditional MacCormack methods.
(a)
(b)
(c)
(d)


## 7. Discussion and Conclusions

The approximation of the pollutant concentrations of the traditional and modified MacCormack schemes is shown in Tables2 and 3. The real-world problems require a small amount of time interval in obtaining accurate solutions. Unfortunately, the analytical solutions of the hydrodynamic model could not be found over the entire domain. This also implies that the analytical solutions of dispersion model could not work out at any point on the entire domain as well [13].In [13], it is revealed that the diffusion coefficients of the pollutant matter can reduce the concentration of the nonuniform stream. If sewage effluent with a low diffusion coefficient has discharged into a nonuniform flow stream, then the water quality will be lower than a discharging of high diffusion coefficients of other pollutant matters.We propose a modified MacCormack scheme by adding a simple revision to the traditional MacCormack scheme. The numerical dispersion has been introduced because the derivative approximation during discretization is not centered. The traditional MacCormack scheme shows excessive dispersion effects for large time and space step lengths, significantly decreasing the efficiency of the traditional MacCormack scheme [3]. To eliminate the numerical dispersion effect, the modified MacCormack scheme for the nonuniform flow is proposed. Though revision shows a good agreement in accuracy with the original one, the modified MacCormack scheme becomes less efficient than the traditional MacCormack scheme.In this paper, the hydrodynamic model and the convection-diffusion-reaction equation can be combined to approximate the pollutant concentration in a stream when the current reflecting water in the stream is not uniform. The technique developed in this paper, the response of the stream to the two different external inputs: the elevation of water and the pollutant concentration at the discharge point, can be obtained. Both of the traditional and the modified MacCormack schemes can be used in the dispersion model since the scheme is very simple to implement. By both of the traditional and the modified MacCormack finite difference formulations, we obtain that the proposed technique is applicable and economical to be used in the real-world problem due to its simplicity to program and the straight forwardness of the implementation. It is also possible to find tentative better locations and better periods of time of the different discharge points to a stream.



---

*Source: 274263-2014-02-23.xml*