modified finite difference scheme for geophysical flows
TRANSCRIPT
8/18/2019 Modified Finite Difference Scheme for Geophysical Flows
http://slidepdf.com/reader/full/modified-finite-difference-scheme-for-geophysical-flows 1/9
Available online at www.sciencedirect.com
ScienceDirect
Mathematics and Computers in Simulation 124 (2016) 60–68
www.elsevier.com/locate/matcom
Original articles
Modified finite difference schemes for geophysical flows
Don A. Jones
Arizona State University, School of Mathematical & Statistical Sciences, Tempe, AZ, 85287-1804, USA
Received 22 March 2013; received in revised form 7 August 2015; accepted 15 January 2016
Available online 3 February 2016
Abstract
In previous works we developed a method to improve both the accuracy and computational efficiency of a given finite difference
scheme used to simulate a geophysical flow. The resulting modified scheme is at least as accurate as the original, has the same time
step, and often uses the same spatial stencil. However, in certain parameter regimes it is higher order. In this paper we apply the
method to more realistic settings. Specifically, we apply the method to the Navier–Stokes equations and to a sea breeze model.
c⃝ 2016 International Association for Mathematics and Computers in Simulation (IMACS). Published by Elsevier B.V. All rights
reserved.
Keywords: Geophysical flows; Higher order finite difference schemes; PDEs
1. Introduction
Many have argued the use of higher-order finite difference schemes in geophysical flows is a more efficient
way to increase the accuracy/dynamical properties than an increase in the spatial grid resolution [ 3,5,7,10,9,15,16].
Henshaw and coauthors, in [5] and related papers, have shown the advantage of higher-order transport methods for
the Navier–Stokes equations for flows over simple topography, identifying fourth-order accuracy as particularly
advantageous. Iskandarani et al., [7], have come to similar conclusions for more oceanographically-relevant
topographic configurations using a spectral element approach. Of course traditional higher-order schemes require
wider spatial stencils which can complicate the approximations near a physical boundary, complicate the
implementation of an implicit scheme, and in some cases increase the minimum size time step required for stability
of an explicit scheme. These obstacles have led to the construction of compact difference and well-balanced schemes;
In the current context see [1,6,11,13] and the references therein. Compact difference schemes are quite general and
apply in many applications. They also require the inversion of tridiagonal matrices. Well-balanced schemes are highly
specific to a given problem and specific balance.
The higher-order finite difference schemes proposed here are in some sense a blend of well-balanced and compact
schemes. Technically we do not introduce new schemes—only a way of modifying a given scheme to make it higher
order in certain parameter regimes. The procedure is particularly effective for geophysical flows where a balance not
involving the time derivative occurs. The higher-order scheme is constructed by modifying the truncation error of the
original finite difference scheme. Specifically, the form of the governing equations at steady state is used to replace
higher-order derivatives in the truncation error with low-order derivatives.
E-mail address: [email protected].
http://dx.doi.org/10.1016/j.matcom.2016.01.006
0378-4754/ c⃝ 2016 International Association for Mathematics and Computers in Simulation (IMACS). Published by Elsevier B.V. All rightsreserved.
8/18/2019 Modified Finite Difference Scheme for Geophysical Flows
http://slidepdf.com/reader/full/modified-finite-difference-scheme-for-geophysical-flows 2/9
D.A. Jones / Mathematics and Computers in Simulation 124 (2016) 60–68 61
The procedure for modifying the truncation error has successfully been applied to many finite difference schemes
including approximations to the shallow-water equations and transport equations, [8,10,9,15]. In each case the extra
cost, in appropriate parameter spaces, required to modify the truncation error is more than compensated by the increase
in accuracy. The process leaves stability properties as well as conserved quantities of the original scheme unchanged;
In many cases the modified scheme resides on the same spatial stencil, or else it allows flexibility in choosing the
terms that reside on larger stencils; Moreover, in some cases the modified scheme is sign preserving for all parameter
values, even when the original scheme is not. Finally, while we have no proof the modified scheme is never less
accurate than the scheme from which it is derived, our experience indicates that the modifications do no harm to the
starting scheme.
The implementation of the method is highly specific to the problem and finite difference scheme to which it is
applied. In this paper we advance the method closer to realistic settings by applying the idea to the two-dimensional
Navier–Stokes equations and to a sea breeze model. Accommodating the non local properties of the Navier–Stokes
equations presents some challenges not encountered in our previous work. Moreover, the generality in which the
method is applied should make it possible to extend it to intermediate models (geostrophic approximations), and the
three-dimensional Navier–Stokes and related equations.
2. Burgers’ equation
To modify a given finite difference scheme approximating a PDE, we first compute the truncation error—the
error made by replacing continuous derivatives with discrete differences. As a result of using Taylor’s theorem, the
truncation error contains derivatives of higher order than present in the original PDE. To make a given scheme more
accurate, some of these terms must be eliminated. Since in many geophysical flows, the time derivative is not the
dominant term (the fluid is geostrophically balanced, hydrostatically balanced.. . ), we use the PDE at steady state to
replace higher-order derivatives with lower-order derivatives. The result yields a higher-order scheme on the same
mesh as the original finite difference scheme.
To illustrate the basic concept of the procedure consider Burgers equation
∂u
∂t − λu x x + uu x = f , 0 < x < L , t > 0,
u(0, t ) = 0 = u( L , t ), t > 0.
The constant λ is positive. We assume a uniform spatial grid of width x , and to shorten the exposition, we employ
the notation
δ x x ui =1
x 2(ui +1 − 2ui + ui−1), δ x ui =
1
2 x(ui +1 − ui−1).
Suppose we are given the second-order scheme, differenced in conservative flux form
dui
dt − λδ x x ui +
u2i+1 − u2
i −1
4 x= f i , 1 ≤ i ≤ N − 1,
where N is given. The numbers u i approximate the nodal values of the solution to Burgers equation at x i = i L/ N =
i x . Moreover, we leave the time derivative continuous since the specific time integrator used is not important—we
are only modifying the spatial truncation error. Temporal errors are assumed to be small.
We want to make the scheme higher order without making the scheme less accurate, affecting the time step for
stability, or widening the stencil. To be more consistent with parameters in a geophysical setting, we suppose the
viscous term is small compared to the other terms and consequently ignore it in the truncation analysis. Thus the
starting scheme leads to
0 = ut − λu x x + uu x − f
= ut − λδ x x ui +1
4δ x u2
i − f +
uu x −
1
4δ x u2
i
= ut − λδ x x ui +
1
4 δ x u2
i − f −uu x x x
6 +
u x u x x
2
x2
+O( x4
). (1)
8/18/2019 Modified Finite Difference Scheme for Geophysical Flows
http://slidepdf.com/reader/full/modified-finite-difference-scheme-for-geophysical-flows 3/9
62 D.A. Jones / Mathematics and Computers in Simulation 124 (2016) 60–68
A more accurate scheme could be constructed by approximating the second-order truncation error uu x x x /6 +
u x u x x /2. Its approximation however would require a wider stencil and a more complicated treatment near the
boundary.
Ignoring the viscous term, the steady state Burgers equation is uu x = f . This implies
uu x x x
6+
u x u x x
2=
f x x
6. (2)
Eq. (2) may be used in (1) to make a fourth-order scheme—when the time derivative and viscous term are small
compared to the remaining terms. The new scheme, derived from using (2) in (1), is
dai
dt − λδ x x ai +
a2i+1 − a2
i −1
4 x= f i +
f x x
6 x 2. (3)
In this case a trivial increase in computational cost is incurred to make the scheme higher order.
To emphasize the modified-truncation procedure applies to any finite difference scheme, we modified the modified
scheme. Indeed, the scheme
dai
dt
− λδ x x ai +a2
i+1 − a2i −1
4 x
= f i +
N −1
n=1
∂ 2n x f i
(2n + 1)!
x 2n
is order x 2 N near steady state.
We note that the inclusion of the diffusion term in the modified-truncation process leads to a scheme which is sign
preserving for all parameter values, even when the original scheme is not. Here we give a brief summary of the results
in [8,9]. If we start with the scheme approximating Burgers equation
dui
dt − λδ x x ui +
u2i+1 − u2
i−1 + ui (ui+1 − ui −1)
6 x= f i , (4)
the modified-truncation scheme is
dai
dt
− δ+ x (λe
i δ−
x ai ) +a2
i +1 − a2i −1 + ai (ai +1 − ai −1)
6 x
= f i +δ x x f i
12 x 2 −
x
48λ
(ai +1 + ai )( f i +1 + f i ) − (ai + ai −1)( f i + f i−1)
,
where
λei := λ
1 +
x 2
12λ2
ai + ai −1
2
2
,
δ+ x ai =
1
x(ai+1 − ai ), δ−
x ai =1
x(ai − ai−1).
For small λ the effective viscosity is increased depending on the size of the local solution. As shown in [9] this scheme
is sign preserving for all values of λ, x . Further non oscillatory properties of the modified scheme are studied in [9]
as well.
To test the fourth-order scheme, (3), we choose the exact solution to be
ue( x, t ) = η sin(π x) + ϵ sin(π x)( x cos(ωt ) + (1 − x) sin(ωt )).
This solution determines the forcing. Large ϵ or ω implies the solution is highly time dependent. We discretize the
time variable using an improved Euler scheme. In Fig. 1 we plot the error ratio
error(t n ) =
maxi
|uni − ue( xi , t n)|
maxi
|ani − ue( xi , t n )|
versus time. As expected the modified scheme is significantly more accurate for solutions which are not highly time
dependent and never less accurate than the starting scheme when the solution is highly time dependent.
8/18/2019 Modified Finite Difference Scheme for Geophysical Flows
http://slidepdf.com/reader/full/modified-finite-difference-scheme-for-geophysical-flows 4/9
D.A. Jones / Mathematics and Computers in Simulation 124 (2016) 60–68 63
Fig. 1. Error ratio versus time with ω = π , λ = 0.0001, x = 1/60. Left: η = 0.99, ϵ = 0.01. Right: (highly time dependent) η = 0.01, ϵ = 0.99.
Notice the error ratio never goes below one.
3. Two-dimensional Navier–Stokes equations
Next we consider the two-dimensional incompressible Navier–Stokes equations on a rectangle Ω . The equations
are
∂u
∂t + (u2) x + (vu) y = ν∇ 2u − p x + f u ,
∂v
∂t + (uv) x + (v2) y = ν∇ 2v − p y + f v ,
u x + v y = 0,
where u, v, p are unknowns. We assume homogeneous Dirichlet boundary conditions on u and v.
To keep the procedure as general as possible and to have a procedure which can be implemented for three-
dimensional problems, we eschew vorticity formulations of the equations and treat the pressure directly. We modify
the truncation error of a scheme formulated by Harlow and Welch, [4]. The finite difference scheme, written on a
Arakawa C-grid, is applied to the momentum equations. The pressure is solved by applying the discrete divergenceto the momentum equations and solving the resulting discrete Poisson equation. The specifics of the second-order
standard scheme follow.
Let Ω = L × H x = L/ N x , y = H / N y , and t = T / N for natural numbers N x , N y , and N . The nodal values
un+1i, j approximate u at time t n+1 = (n + 1)t and at the node (i x, ( j − 1
2) y), 1 ≤ i ≤ N x − 1, 1 ≤ j ≤ N y . And
vn+1i, j approximates v at time t n+1 and at the node ((i − 1
2) x, j y), 1 ≤ i ≤ N x , 1 ≤ j ≤ N y − 1. Set
δ x u2 =(ui, j + ui+1, j )2 − (ui, j + ui−1, j )2
4 x,
δ y (uv) =(ui, j + ui, j +1)(vi, j + vi +1, j ) − (ui, j −1 + ui, j )(vi, j−1 + vi+1, j −1)
4 y.
Using similar expressions for δ x (uv) and δ y (v2), the pressure is computed from the discretization of the momentum
equations,
un+1i, j − ui, j
t = −δ x u2 − δ y (uv) + ν(δ 2
x + δ2 y )ui, j + f ui, j −
pi +1, j − pi, j
x
:= rhui, j − pi+1, j − pi, j
x, (1)
vn+1i, j − vi, j
t = −δ x (uv) − δ y (v2) + ν(δ 2
x + δ2 y )vi, j + f vi, j −
pi, j+1 − pi, j
y
:= rhvi, j −
pi, j +1 − pi, j
y . (2)
8/18/2019 Modified Finite Difference Scheme for Geophysical Flows
http://slidepdf.com/reader/full/modified-finite-difference-scheme-for-geophysical-flows 5/9
8/18/2019 Modified Finite Difference Scheme for Geophysical Flows
http://slidepdf.com/reader/full/modified-finite-difference-scheme-for-geophysical-flows 6/9
D.A. Jones / Mathematics and Computers in Simulation 124 (2016) 60–68 65
Fig. 2. Truncation error versus number of cells. The slopes imply the standard scheme is 2nd order and the modified scheme is 4th order.
Fig. 3. Left: L 1 error versus time with ν = 0.00025, x = y = 1/50, ω = π , η = 0.5, and ϵ = 0.5. Right: Even with inappropriate parametersν = 0.005, ω = π , η = 0.01, ϵ = 0.99, and x = y = 1/80, the error ratio never goes below one.
To test the properties of the scheme, we choose the exact solution
u( x, y, t ) = −ηπ x sin2(π x) sin(2π y) − ϵπ cos(ωt ) sin2(π x) sin(2π y),
v( x, y, t ) = η sin2(π y)(sin2(π x) + xπ sin(2π x)) + ϵπ cos(ωt ) sin2(π y) sin(2π x),
p( x, y, t ) = cos(π x y).
This solution determines the forcing in the NSE. Large ϵ or ω implies the solution is highly time dependent. In Fig. 2
the solution, with ϵ = 0 and η = 1, is run to steady state and the L 1 error is computed. The slopes show the modified
scheme is fourth order. It is also uniformly fourth order throughout the domain. In the right side of Fig. 3 we choose
parameters so that the solution is highly time dependent. Notice the error ratio never goes below one—the modified
scheme is never less accurate than the starting scheme.
4. A sea breeze model
In this section we apply the modified truncation approach to a finite difference scheme approximating a sea breeze
model. The numerical aspects are challenging in part due to strong horizontal velocities near the ground and the
skewness to the computational grid of vortices associated with the sea breeze circulation. The model used here is
similar to the ones found in [2,12]. Moreover, the model can be used to study air quality near a coast [14].
The model is derived from the three-dimensional Boussinesq approximation under the assumption of a long,
straight beach. That is, we assume the solution is independent of the y variable (see Fig. 4). The governing
8/18/2019 Modified Finite Difference Scheme for Geophysical Flows
http://slidepdf.com/reader/full/modified-finite-difference-scheme-for-geophysical-flows 7/9
66 D.A. Jones / Mathematics and Computers in Simulation 124 (2016) 60–68
Fig. 4. Seabreeze problem domain.
equations are
ut + uu x + wu z − f v = − p x + ν(u x x + u zz ),
vt + uv x + wv z + f u = ν(v x x + v zz ),
wt + uw x + ww z = − p z + ν(w x x + w zz ) + gβθ ,
θ t + uθ x + wθ z = λ(θ x x + θ zz ),
u x + w z = 0,
where u is the velocity in the horizontal direction, v is the velocity along the cost, w is the vertical velocity, and θ is the temperature. The constant ν is the kinematic viscosity, f the Coriolis force. The boundary conditions are as
follows. At the bottom boundary (ground)
u = 0, v = 0, w = 0, θ ( x, y, 0, t ) = ζ ( x)10sin(π ωt ) + | sin(π ωt )|
2,
where ω = 1/43200 s, t is in seconds and
ζ ( x) =
0 −25 km ≤ x ≤ −5 km
x + 5 km
10 km−5 km ≤ x ≤ 5 km
1 5 km ≤ x ≤ 25 km.
Note that θ ( x, y, 0, 0) = θ ( x, y, 0, 12 hr) = 0, and θ is maximum at t = 6 hr. If we think of t = 0 as 6 am, θ is
maximum at 12 noon. The sun sets at 6 pm, and at that time, θ = 0 at z = 0, the reference temperature of the water,
until 6 am the next morning.
On the top boundary
u = 0, v = 0, w = 0, θ y = 0.
On the left and right boundary
u = 0, v x = 0, w = 0, θ x = 0.
We take f = 0.0000834 s−1, gβ = 0.0005 ms−2, ν = 25.0 m2 s−1, and λ = 418.0 m2 s−1.
A scale analysis suggests the balance should be between the pressure gradient and the nonlinear terms in the
horizontal momentum equation, and between the pressure gradient and gβθ in the vertical momentum equation. The
balance in the other two equations is not so clear. Fig. 5 shows the L 1 norm versus time of each term in the equations.
We see that the time derivative is significant in the equations for the v velocity and the temperature. The examples
above suggest that the modified scheme is still effective even when the size of the time derivative is the same size
as other terms in the equation. The large time derivative in the equation for v will not matter since it is only weakly
coupled to the equation for the horizontal velocity u; the Coriolis term is not significant over the small horizontal
length of the physical domain, and so f v is small in the horizontal momentum equation.
The standard scheme is taken to be the scheme in the previous section for the NSE for the u and w equations. The
v and θ equations are initially discretized with a standard second-order finite difference scheme. They are stored at a
pressure node (center of a cell) since we impose Neumann boundary conditions on some parts of the boundary. The
schemes for v and θ are modified in a similar way, and we omit the details. However, we note that we coded a more
traditional fourth-order scheme for these two fields and saw virtually no difference in the accuracy or the dynamics
8/18/2019 Modified Finite Difference Scheme for Geophysical Flows
http://slidepdf.com/reader/full/modified-finite-difference-scheme-for-geophysical-flows 8/9
D.A. Jones / Mathematics and Computers in Simulation 124 (2016) 60–68 67
Fig. 5. L1 norm versus time of the terms in sea breeze model showing the significance of the time derivative.
Fig. 6. Average wind speed for 0 ≤ z ≤ 320 m at the shore for various resolutions.
of the overall scheme. The modified scheme was tested using an exact solution (with external forcing to make the
solution work as in the previous sections) and the scheme was found to be fourth order.
To demonstrate our claims of increased accuracy for the general case, we plot in Fig. 6 the wind speed at x = 0
averaged over 0 ≤ z ≤ 320 m (the flux of air near the ground at the shore) for different resolutions versus time. The
320 m was chosen simply because it is divisible by the different resolutions and because it is relatively close to the
ground. As Fig. 6 shows the wind speed at the shore peaks at 2 pm at about 3.1 m/s (7 mph) at low resolution and
1.8 m/s (4 mph) at higher resolution. Lower resolutions not only over estimate the average wind speed near the shore,
but also predict its arrival too early. Notice the modified scheme is run at an even lower resolution than the lowest
resolution standard scheme. However, it agrees closely with the standard scheme on a mesh more than three times
refined.
8/18/2019 Modified Finite Difference Scheme for Geophysical Flows
http://slidepdf.com/reader/full/modified-finite-difference-scheme-for-geophysical-flows 9/9
68 D.A. Jones / Mathematics and Computers in Simulation 124 (2016) 60–68
Fig. 7. Average wind speed on right half of the domain: 0 ≤ x ≤ 25 km, 0 ≤ z ≤ 4000 m for various resolutions.
Finally, Fig. 7 plots the average vertical velocity versus time. The average is over the right side of the domain:
0 ≤ x ≤ 25 km, 0 ≤ z ≤ 4000 m. We again see convergence, as the spatial mesh is refined, of the standard schemes
to the low resolution modified scheme. While the average wind speeds are low here, the maximum wind speed is
around 17.9 m/s (40 mph).
Like the Navier–Stokes equations, the modified scheme adds little cost to the original scheme (about 25% in this
case). This is due in part to the cost of the Poisson solver. Since it is not modified (nor does it need to be!) and
represents a significant cost of the overall code, the original and modified scheme have comparable costs. In addition,
the modified scheme uses the time step of the most unresolved standard scheme ( t = 5 min with x = 500 m,
z = 80 m). While the time step for the standard schemes is cut in half for each doubling of the resolution. This
works out to be over a 20 fold savings in CPU cost.
Acknowledgments
The author wishes to express a sincere gratitude to Matthew Hecht, Len Margolin, and Andrew Poje for many
useful discussions.
References
[1] E. Blayo, Compact finite difference scheme for ocean model, J. Comput. Phys. 164 (2000) 241–257.
[2] C. Chen, R. Bernatz, K. Carlson, W. Lin, Finite Analytic Method in Flows and Heat Transfer, Taylor and Francis, 2000.
[3] D.E. Dietrich, A. Mehra, R.L. Haney, M.J. Bowman, Y.H. Tseng, Dissipation effects in North Atlantic ocean modeling, Geophys. Res. Lett.
31 (2004).[4] F. Harlow, J. Welch, Numerical calculation of time-dependent viscous incompressible flow of fluid with free surface, Phys. Fluids 8 (1965)
2182–2189.[5] W.D. Henshaw, L.G.R. Heinz-Otto Kreiss, Fourth-order-accurate difference approximation for the incompressible Navier–Stokes equations,
Comput. & Fluids 23 (1994) 575–593.[6] R. Hirsh, Higher order accurate difference solutions of fluid mechanics problems by a compact differencing technique, J. Comput. Phys. 19
(1975) 90–109.[7] M. Iskandarani, D.B. Haidvogel, J.P. Boyd, A staggered spectral element model with application to the oceanic shallow water equations,
Internat. J. Numer. Methods Fluids 20 (1995) 393–414.[8] D.A. Jones, Modified-truncation finite difference schemes, J. Comput. Phys. 209 (2005) 322–339.
[9] D.A. Jones, L. Margolin, A.C. Poje, Accuracy and nonoscillatory properties of enslaved difference schemes, J. Comput. Phys. 181 (2002)
705–728.[10] D.A. Jones, A.C. Poje, L. Margolin, Resolution effects and enslaved finite difference schemes for a double gyre, shallow water model,
J. Theor. Comput. Fluid Mech. 9 (1997) 269–280.[11] S. Lele, Compact finite difference scheme with spectral like resolution, J. Comput. Phys. 103 (1992) 16–43.
[12] J. Neumann, Y. Mahrer, A theoretical study of the land and sea breeze circulation, J. Atmos. Sci. 28 (1971) 532–542.
[13] S. Noelle, N. Pankratz, G. Puppo, J. Natvig, Well-balanced finite volume schemes of arbitrary order of accuracy for shallow water flows,
J. Comput. Phys. 213 (2006) 474–499.[14] J. Papageorgiou, A 3-d sea breeze model of the PBL including pollutant dispersion, Bound.-Lay. Meteorol. 45 (1988) 9–29.
[15] A. Poje, D. Jones, L. Margolin, Enslaved finite difference approximations for quasi geostrophic shallow flows, Physica D (1996) 559–573.
[16] B.G. Sanderson, Order and resolution for computational ocean dynamics, J. Phys. Oceanogr. 28 (1998) 1271–1286.