# Numerical solution of the shallow water equations using fourth-order compact MacCormack scheme

Author

Abstract

Shallow water equations are a model to present the behavior of a single-layer fluid with constant density, that the hydrostatic approximation has been applied. These equations for the motion of a dry and inviscid atmosphere with constant density include the momentum and the continuity equations. In addition, the shallow water equations are often used as a testbed to assess the performance of new numerical algorithms.
In recent years, the trend toward increasing the accuracy of the numerical simulations of the atmospheric and oceanic motions has increased due to the inherent complexity in these motions. In recent researches, the compact schemes have been noticed because of their remarkable performance in the numerical simulation of fluid flows in other branches of fluid dynamics.
This work is devoted to the application of the fourth-order compact MacCormack scheme to numerical solution of the conservative form of the two dimensional shallow water equations. The compact MacCormack method is formulated in form of a two-point scheme. Two versions of the fourth-order compact MacCormack scheme have been introduced and called as 4/2 and 4/4. The first order spatial derivative operators have implicit forms in both schemes (4/2 and 4/4), for one-sided forward and backward operators. The MacCormack scheme uses two time-marching methods: The first is the original two-stage method and the other one is the Runge-Kutta-type (RK2, RK4 and LDDRK4-6) method.
In the present work first, we solve a simple linear (advection) equation with an analytical solution, using the second-order and the fourth-order compact MacCormack-type schemes (with the original and the Runge-Kutta time-marching methods) and compare their global errors. The results show that when the fourth-order compact MacCormack schemes with the original time-marching are used, the 4/2 formulation has better results than the 4/4 formulation, but when these schemes use the Runge-Kutta time-marching, the results of the 4/4 formulation are better than those in the 4/2 formulation. According to these results and the magnitude of the global errors, we used four MacCormack-type methods to solve the shallow water equations. The methods are the second-order scheme with the original time-marching, the 4/2 type of fourth order compact scheme with both the original and the RK4 time-marching, and the 4/4 type of fourth order compact scheme with the RK4 time-marching.
In the following, we solved the conservative form of the one-dimensional shallow water equations with those four mentioned schemes. The results were compared with a test case with known analytical solution.
At last, we solved the conservative form of the two-dimensional shallow water equations. To perform the simulations two well know test cases are used. To assess the numerical accuracy, we estimated conservative quantities such as energy, enstrophy and mass along the simulation process in all time steps. The estimated results indicate that the fourth-order compact MacCormack schemes retain the conservation of these quantities better than the second-order MacCormack scheme. In comparison with the other applied schemes in this work, while the 4/4 formulation with the RK4 time-marching shows more accurate results, the numerical stability condition of this scheme is less than the other schemes. In the second test case, we point out that the computational time of the code for each numerical solution, which utilizes the fourth-order compact schemes, is longer than the computational time of the solution using second-order scheme; but their implementation is reasonable because their numerical accuracy is higher than that of the second-order scheme.

Keywords

Main Subjects

#### References

جوان نژاد، ر.، مشکواتی، ا. ح.، قادر، س. و احمدی گیوی، ف.، 1395، حل عددی شکل پایستار معادلات تراکم‌پذیر دوبعدی و ناآب‌ایستایی جو با روش فشرده مک‌کورمک، م. ژئوفیزیک ایران، در حال چاپ.
فلاحت، س.، 1387، حل عددی شکل پایستار معادلات تراکم‌پذیر دوبعدی و غیرهیدروستاتیک جو بی‌دررو با استفاده از روش فشرده مرتبه چهارم، پایان‌نامه کارشناسی‌ارشد هواشناسی، مؤسسه ژئوفیزیک دانشگاه تهران.
قادر، س. و اصفهانیان، و.، 1385، حل عددی شکل پایستار معادلات آب کم‌عمق با استفاده از روش ابرفشرده مرتبه ششم، م. فیزیک زمین و فضا، 32(2)، 44-31.
قادر، س.، بیدختی، ع. ع. و فلاحت، س.، 1389، حل عددی مسئله تنظیم راسبی غیرخطی ناپایای دوبعدی با استفاده از روش فشرده مک‌کورمک مرتبه چهارم، م. فیزیک زمین و فضا، 36(3)، 173-151.
میرزائی شیری، ر.، 1393، حل عددی شکل پایستار معادلات آب کم‌عمق با استفاده از روش مک‌کورمک فشردۀ مرتبۀ چهارم، پایان‌نامه کارشناسی‌ارشد هواشناسی، مؤسسۀ ژئوفیزیک دانشگاه تهران.

Dritschel, D. G., Polvani, L. M. and Mohebalhojeh, A. R., 1999, Contour-advective semi-Lagrangian algorithm for the shallow water equations, Mon. Wea. Rev., 127, 1551-1565.
Esfahanian, V., Ghader, S. and Mohebalhojeh, A. R., 2005, On the use of super compact scheme for spatial differencing in numerical models of the atmosphere, Q. J. Roy. Meteorol. Soc., 131, 2109-2130.
Ghader, S., Mohebalhojeh, A. R. and Esfahanian, V., 2009, On the spectral convergence of supercompact finite-difference schemes for the f-plane shallow-water equations, Mon. Wea. Rev., 137, 2393-2406.
Ghader, S. and Nordström, J., 2015, High-order compact finite difference schemes for the vorticity–divergence representation of the spherical shallow water equations, Int. J. Numer. Meth. Fluids, 78, 709-738.
Gustafsson, B., 1971, An ADI method for solving the shallow water equations, J. Comput. Phys., 7, 239-253.
Hixon, R. and Turkel, E., 2000, Compact implicit MacCormack–type scheme with high accuracy, J. Comput. Phys., 158, 51-70.
Hoffman, J., D., 2001, Numerical methods for engineer and scientist, Marcel Dekker, Second Edition, 823pp.
Houghton, D., Kasahara, A. and Washington, W., 1966, Long-term integration of the barotropic equations by the Lax-Wendroff method, Mon. Wea. Rev., 94, 141-150.
Mohebalhojeh, A. R. and Dritschel, D. G., 2007, Assessing the numerical accuracy of complex spherical shallow water flows. Mon. Wea. Rev., 135, 3876-3894.
Navon, I. M. and Riphagen, H. A., 1979, An implicit compact fourth-order algorithm for solving the shallow water equations in conservative-law form, Mon.Wea. Rev., 107, 1107-1127.
Vallis, G. K., 2006, Atmospheric and Oceanic fluid dynamics: fundamentals and large-scale circulation, Cambridge University Press.