Comparison of Explicit Method of Solution for CFD Euler Problems using MATLAB® and FORTRAN 77

A Nordli, H Khawaja


This work presents a comparison of an explicit method of solution for an inviscid compressible fluid mechanics problem using Euler equations for two-dimensional internal flows. The same algorithm was implemented in both FORTRAN 77 and MATLAB®. The algorithm includes Runge‒Kutta time marching scheme with smoothing. Both solvers were initialized in the same manner. In addition, it was ensured that both solvers have the exact same values for time step, convergence criteria, boundary conditions, and the grid. The only difference between the two solvers was the precision of variables.

The problem solved was a two-dimensional dual bump with an accelerating flow through a duct. The same algorithm solving the Euler equations of fluid flow is implemented in both FORTRAN 77 and MATLAB®, and applied to identical input. While the solutions look qualitativly the same, a 20% difference in the stationary solution is observed. No claim is made of the relevance of the computations to actual fluid flow, rather the key takeaway being that two finite and deterministic computations of the same algorithm on the same input in FORTRAN 77 and MATLAB® produce different output.

Full Text:



Press, W.H. and W.T. Vetterling, Numerical Recipes in FORTRAN: The Art of Scientific Computing. 1992: Cambridge University Press.

MATLAB®. 2015, The MathWorks Inc.: Natick, Massachusetts.

Rose, L.D. and D. Padua, Techniques for the translation of MATLAB programs into Fortran 90. ACM Trans. Program. Lang. Syst., 1999. 21(2): p. 286-323. Crossref

Khawaja, H. and S. Scott, CFD-DEM Simulation of Propagation of Sound Waves in Fluid Particles Fluidised Medium. The International Journal of Multiphysics, 2011. 5(1): p. 47-60. Crossref

Khawaja, H.A., CFD-DEM and Experimental Study of Bubbling in a Fluidized Bed. The Journal of Computational Multiphase Flows, 2015. 7(4): p. 227-240. Crossref

Khawaja, H.A., Sound waves in fluidized bed using CFD–DEM simulations. Particuology, 2018. 38: p. 126-133. Crossref

Khawaja, H. and M. Moatamedi, Semi-Implicit Method for Pressure-Linked Equations (SIMPLE) – solution in MATLAB®. The International Journal of Multiphysics, 2018. 12(4): p. 313-326. Crossref

Eidesen, H., H. Khawaja, and S. Jackson, Simulation of the HDPE Pyrolysis Process. The International Journal of Multiphysics, 2018. 12(1): p. 79 - 88. Crossref

Brunner, D., H. Khawaja, M. Moatamedi, and G. Boiger, CFD modelling of pressure and shear rate in torsionally vibrating structures using ANSYS CFX and COMSOL Multiphysics. The International Journal of Multiphysics, 2018. 12(4): p. 349 - 358. Crossref

Myrvang, T, and H. Khawaja. Validation of air ventilation in tunnels, using experiments and computational fluid dynamics. The International Journal of Multiphysics, 2018. 12(3): p. 295 - 311. Crossref

Batchelor, G.K., An Introduction to Fluid Dynamics. Cambridge Mathematical Library. 2000, Cambridge: Cambridge University Press.

Warburton, R., Object-oriented Vs. Functional Programming: Bridging the Divide Between Opposing Paradigms. 2015: O'Reilly Media.

Runge, C., Ueber die numerische Auflösung von Differentialgleichungen. Mathematische Annalen, 1895. 46(2): p. 167-178. Crossref

Butcher, J.C., A stability property of implicit Runge-Kutta methods. BIT Numerical Mathematics, 1975. 15(4): p. 358-361. Crossref

Courant, R., K. Friedrichs, and H. Lewy, Über die partiellen Differenzengleichungen der mathematischen Physik. Mathematische Annalen, 1928. 100(1): p. 32-74. Crossref

Page, C.G., The Professional Programmers Guide to Fortran 77. 1988: Pitman.

The MathWorks, Inc. [cited 2019; Available from:


Copyright (c) 2019 A Nordli, H Khawaja

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.