PHAML Software: implementation

convergence plots for various p
Convergence of the error as a function of degrees of freedom for a singular problem solved with h-adaptive refinement for fixed p=1 through 10, and hp-adaptive refinement.

PHAML is written in Fortran 90 and makes extensive use of advanced Fortran 90 features, such as modules, optional arguments and dynamic memory, to provide a clean object-oriented design with a simple user interface.

PHAML uses the concept of data encapsulation from object-oriented program design. Using Fortran 90 modules with public and private attributes, the user can only manipulate top level data types using only the functions provided by PHAML. This not only removes the burden of knowing the details of the data structures from the user, but it provides for the evolution of those data structures without any changes to the user code, improving upward compatibility of revisions of PHAML.

Simplicity of the user interface is also improved by using the optional argument and dynamic memory features of Fortran 90. The argument list for the primary subroutine is rather long, but nearly all the arguments are optional. The user only provides the arguments for which a specific value is desired; all other arguments assume a reasonable default value.

The use of dynamic memory (allocatable arrays) removes the burden of allocating workspace of the correct size, a problem that is often associated with FORTRAN 77 libraries.

The user interface to PHAML consists of two parts. First, the user writes several external subroutines to define the problem: the PDE, the boundary conditions, initial conditions for parabolic and nonlinear problems, the true solution if it is known (so that errors can be computed), and sometimes subroutines that define the boundary parametrically. If the domain is a simple polygon, the boundary routines are not necessary -- it can be defined in triangle data files.

Second, the user writes a main program for the master process. This program uses (in the Fortran 90 sense) module phaml, and calls the public PHAML subroutines to perform the desired operations. phaml_create and phaml_destroy must always be called with the phaml data structure for initialization and clean up. phaml_solve_pde is the primary routine to cycle through the adaptive refinement and multigrid solution iterations. Other routines include phaml_query to get information about the grid and solution, phaml_evaluate to evaluate the solution, and routines to save the grid and solution to file and read in a saved solution.


Mitchell, W.F., PHAML User's Guide , NISTIR 7374 , 2006. (original, pdf, 3.2M ) (latest revision, pdf)

Mitchell, W.F., The Design of a Parallel Adaptive Multi-Level Code in Fortran 90, Proceedings of the 2002 International Conference on Computational Science, 2002. ( gzipped postscript, 50k)

Back to PHAML home page

Last change to this page: April 3, 2007
Date this page created: April 2, 2007
Contact: William Mitchell
Home Page