Numerical solution of wave equation using Fortran

As part of the Computational Fluid Dynamics course of my bachelor’s degree, I was tasked with the project of solving the wave equation below using 3 numerical methods as subroutines in Fortran programming language.

ut+ux=0

Fortran is a general-purpose, compiled imperative programming language that is especially suited to numeric computation and scientific computing. Originally developed by IBM in the 1950s for scientific and engineering applications, FORTRAN came to subsequently dominate scientific computing.

I have always been fond of programming as each project seems like a little child I help rise, writing in basic languages such as Fortran and C++ although cumbersome, usually have the benefit of efficiency when running, compared to higher level languages such as Python. They are also more cost efficient in comparison with commercial software be it general purpose or task specific, such as Mathlab and Fluent.

Photo by luis gomes on Pexels.com

This project, made use of elementary functions of the now highly developed language to numerically solve the aforementioned wave equation with the MacCormack, Lax–Wendroff and Euler method. The results of the project were presented in a technical report (in Persian) which is accessible through the download link below.

I wrote several updates to the code, making it more user-friendly by adding descriptions and comments and making a menu. As an added step, I used the exact solution to calculate the error using the formula below. I leave a link to the last version of the code as well. Truth be told, I did use some online resources for the implementation of euler method as a subroutine was required to solve the system of equations.

E(fA,fB)=((1/N)*Σi=1N(fA(xi)-fB(xi))2)1/2

This, in fact, was my first assignment in the traditional sense and I had little background knowledge about how best to present it. In hindsight, I could have presented the results more eloquently. Regardless, this was an amazing first experience which left me with fond memories of burning the midnight oil tinkering with the code.

Leave a comment

Design a site like this with WordPress.com
Get started