skip to main content
OSTI.GOV title logo U.S. Department of Energy
Office of Scientific and Technical Information

Title: ELLIPT2D: A Flexible Finite Element Code Written Python

Technical Report ·
DOI:https://doi.org/10.2172/781479· OSTI ID:781479

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.

Research Organization:
Princeton Plasma Physics Lab. (PPPL), Princeton, NJ (United States)
Sponsoring Organization:
USDOE Office of Energy Research (ER) (US)
DOE Contract Number:
AC02-76CH03073
OSTI ID:
781479
Report Number(s):
PPPL-3552; TRN: US0102986
Resource Relation:
Other Information: PBD: 22 Mar 2001
Country of Publication:
United States
Language:
English