ELLIPT2D: A Flexible Finite Element Code Written Python | |
Pletzer, A. ; Mollis, J.C. | |
Princeton University. Plasma Physics Laboratory. | |
关键词: Partial Differential Equations; Programming Languages; 75 Condensed Matter Physics, Superconductivity And Superfluidity; 70 Plasma Physics And Fusion Technology; Laplace Equation; | |
DOI : 10.2172/781479 RP-ID : PPPL-3552 RP-ID : AC02-76CH03073 RP-ID : 781479 |
|
美国|英语 | |
来源: UNT Digital Library | |
【 摘 要 】
The use of the Python scripting language for scientific applications and in particular to solve partial differential equations is explored. It is shown that Python's rich data structure and object-oriented features can be exploited to write programs that are not only significantly more concise than their counter parts written in Fortran, C or C++, but are also numerically efficient. To illustrate this, a two-dimensional finite element code (ELLIPT2D) has been written. ELLIPT2D provides a flexible and easy-to-use framework for solving a large class of second-order elliptic problems. The program allows for structured or unstructured meshes. All functions defining the elliptic operator are user supplied and so are the boundary conditions, which can be of Dirichlet, Neumann or Robbins type. ELLIPT2D makes extensive use of dictionaries (hash tables) as a way to represent sparse matrices.Other key features of the Python language that have been widely used include: operator over loading, error handling, array slicing, and the Tkinter module for building graphical use interfaces. As an example of the utility of ELLIPT2D, a nonlinear solution of the Grad-Shafranov equation is computed using a Newton iterative scheme. A second application focuses on a solution of the toroidal Laplace equation coupled to a magnetohydrodynamic stability code, a problem arising in the context of magnetic fusion research.
【 预 览 】
Files | Size | Format | View |
---|---|---|---|
781479.pdf | 268KB | download |