Abstract

Three object-oriented implementations of a prototype solver of the advection equation are introduced. The presented programs are based on Blitz++ (C++), NumPy (Python) and Fortran's built-in array containers. The solvers constitute implementations of the Multidimensional Positive-Definite Advective Transport Algorithm (MPDATA). The introduced codes serve as examples for how the application of object-oriented programming (OOP) techniques and new language constructs from C++11 and Fortran 2008 allow to reproduce the mathematical notation used in the literature within the program code. A discussion on the tradeoffs of the programming language choice is presented. The main angles of comparison are code brevity and syntax clarity (and hence maintainability and auditability) as well as performance. All performance tests are carried out using free and open-source compilers. In the case of Python, a significant performance gain is observed when switching from the standard interpreter (CPython) to the PyPy implementation of Python. Entire source code of all three implementations is embedded in the text and is licensed under the terms of the GNU GPL license.

Highlights

  • Object-oriented programming (OOP) “has become recognised as the almost unique successful paradigm for creating complex software” [25, Section 1.3]

  • (ii) shorten and simplify the source code and improve its readability by reproducing within the program logic the mathematical notation used in the literature

  • The key aim of this paper is to show how OOP techniques can be used to faithfully reproduce within the code what can be referred to as blackboard abstractions [26]

Read more

Summary

Introduction

Object-oriented programming (OOP) “has become recognised as the almost unique successful paradigm for creating complex software” [25, Section 1.3]. Application of OOP techniques in development of numerical modelling software may help to:. (i) maintain modularity and separation of program logic layers (e.g. separation of numerical algorithms, parallelisation mechanisms, data input/output, error handling and the description of physical processes); and (ii) shorten and simplify the source code and improve its readability by reproducing within the program logic the mathematical notation used in the literature. The first application is attainable, yet arguably cumbersome, with procedural programming. The latter, virtually impossible to obtain with procedural programming, is the focus of this paper. The importance of reproducing the mathematical notation in the code lays primarily in the fact that code readability and brevity significantly contribute to code maintainability [37]

Objectives
Results
Conclusion
Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.