MPDATA平流方程求解器的面向对象的C++、Python和Fortran实现
Object-oriented implementations of the MPDATA advection equation solver in C++, Python and Fortran
摘要:
介绍了三种面向对象的平流方程原型求解器的实现。所呈现的程序基于Blitz++(C++),NumPy(Python)和Fortran的内置数组容器。求解器包括多维正定平流传输算法(MPDATA)的实现。所介绍的代码说明了如何应用面向对象编程(OOP)技术允许重现的数学符号中使用的文献中的程序代码。讨论了编程语言选择的权衡。比较的主要角度是代码简洁性和语法清晰性(以及可维护性和可扩展性)以及性能。在Python的情况下,从标准解释器(CPython)切换到Python的PyPy实现时,可以观察到显着的性能提升。所有三个实现的完整源代码都嵌入在文本中,并根据GNU GPL许可证的条款进行许可。
英文摘要:
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 include an implementation of the Multidimensional Positive-Definite Advective Transport Algorithm (MPDATA). The introduced codes exemplify how the application of object-oriented programming (OOP) techniques allows 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. 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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。