Application of object-oriented programming (OOP) techniques in the development of numerical modeling software may help to (i) maintain modularity and separation of program logic layers, and (ii) shorten and simplify the source code and improve its readability by reproducing within the program logic the mathematical abstractions and notation used in the literature. The first application is attainable, yet arguably cumbersome, with procedural programming. The latter of the two applications, virtually impossible to obtain with procedural programming, is the focus of this paper. Application of OOP techniques to match the mathematical notation in the code has the potential to significantly improve code auditability and maintainability.
The presented Python implementation of MPDATA is based on NumPy. Its performance is compared with C++/Blitz++ and FORTRAN implementations. A notable performance gain when switching from the standard CPython to PyPy (which is gradually gaining compatibility with NumPy) will be exemplified, and the reasons for it will be briefly explained.