Product Line

Summary Article



Diffpack, provided by inuTech GmbH (, is an object-oriented problem-solving environment for the numerical solution of partial differential equations (PDEs). Diffpack is used worldwide for research purposes in the industry as well in the academic sector.

Among industrial Diffpack customers are technology leaders such as Intel, Petrobras, Dornier, Shell, St. Gobain, Lawrence Livermore Nat. Lab., Statoil, Veritas, Commissariat a l'Energie Atomique and Institut Francais du Petrol. Leading universities such as Stanford, Cornell, Vanderbilt, Birmingham, Lancaster, EPFL and Chalmers are among academic customers using Diffpack for research and education in areas like geology, geophysics, chemistry, medicine, physics, electronics, mechanics, mathematics and informatics.

The customer activities span from simple prototypical applications to projects involving several man-years of simulator development.

Wide Application Scope

By its design, Diffpack provides a very high degree of modeling flexibility, while still maintaining the computational efficiency needed for the most demanding simulation problems in science and engineering. This is a key feature of all members of the Diffpack product line.

Unlike most products for PDEs, Diffpack is designed to allow easy modification and combination of all numerical building blocks making up an application. It has heavy focus on the flexible construction, modeling power and computational efficiency of the numerical kernel, rather than the specific nomenclature and graphical user interfaces targeting a particular engineering area.

As a result, Diffpack has no inherent restrictions on the types of PDEs that can be solved. Diffpack may very well be used to solve traditional engineering PDE problems; however, it is typical for current customers that they use Diffpack to solve special problems that can be characterized as "non-standard" and outside the mainstream engineering areas. Such problems often occur in pure research contexts or in the context of problems involving a variety of mutually dependent physical effects.


Technically speaking, Diffpack is organized as a collection of C++ libraries with classes, functions and utility programs. The numerical functionality is embedded in an environment of software engineering tools supporting the management of Diffpack development projects.

The Diffpack libraries, including the kernel and add-on toolboxes, contain a substantial collection of data structures and numerical algorithms. The functionality include vectors, matrices, general multi-index arrays, strings, enhanced I/O, menu system for input data handling, simulation result database system, systems for automatic report generation, execution statistics, GUIs, preprocessors, interfaces to third party pre- and postprocessing tools, representation of linear systems (in particular large sparse systems), a large number of state-of-the-art iterative methods for sparse linear systems, solvers for non-linear systems, finite element and finite difference meshes, scalar and vector fields over meshes, a collection of finite elements, various finite element algorithms and associated data structures, numerical integration schemes, high level finite difference support, stencils (difference molecules), probability distributions, random number generators, real and complex arithmetic, solution methods for stochastic ordinary differential equations, support for random fields, adaptive meshes, error estimation, multigrid methods, domain decomposition methods, generalized (mixed) finite element methods, parallel computing on linear algebra and domain decomposition level, and a large collection of source code examples for problems in a variety of application areas.

The list of functionality is comprehensive. However, the major advantage for the user is the freedom with which different parts of this functionality can be combined. In the design of Diffpack, great care has been taken to make all objects and functions highly interoperable. For the user this means increased ability to construct and maintain applications and numerical algorithms.

The Diffpack product line is organized as a kernel product, often referred to as the Diffpack Kernel, and a set of toolboxes providing specialized functionality. The kernel and the toolboxes are purchased as separate products.

As of April 2000, toolboxes for adaptive meshing and import of third party simulation meshes are released, while toolboxes for multigrid/multilevel linear solvers and parallel computing are under beta testing and scheduled for release within the end of 2000. The toolboxes offer access to advanced functionality for any application with minimal development efforts. Typically, only a handful of additional code lines are necessary to bring them into operation.

In particular, the Diffpack Parallel Computing Toolbox provides the full power of parallel computing to any Diffpack application. In fact, the application may be constructed entirely from a sequential perspective and later be converted to a parallel application with minimal efforts. The toolbox provides parallel computing on linear algebra level or in terms of domain decomposition techniques, and may be used on dedicated parallel hardware as well as on workstations connected in a network.

Target Users

Although usage of Diffpack requires programming in C++, only minor C++ knowledge is required to get started. However, experience with programming in general is necessary.

The Diffpack learning process is supported by a comprehensive volume published by Springer-Verlag ([1]). This book introduces Diffpack programming via the style of typical FORTRAN or C codes, and then gradually introduces the object-oriented techniques characterizing more advanced Diffpack applications. The book contains over 50 application examples, which are all part of the product as delivered to customers. These examples form also a valuable resource as application templates for the user's own development.

The user is required to have a minimum of background knowledge in the mathematics of PDEs. The target user will typically have insight into the mathematics of his problem area, and a need to have his mathematical and numerical ideas carefully reflected in his application program.

For these users, Diffpack provides the necessary level of control and flexibility at a minimum of development efforts. Typically, the user will concentrate almost entirely on the essential and critical numerics of his problem. Tasks related to general numerics and program management will automatically be handled by built-in Diffpack constructions. As a result, the application code will be compact and focused on the mathematical model to be solved. Still, even the simplest Diffpack application can easily offer a wide range of analysis and reporting mechanisms, which can support the understanding of the mathematical model and tailor the entities of the numerical algorithms for optimal application performance.

From Basic Models to Advanced Coupled Problems

The Diffpack software architecture follows closely the mathematical concepts involved in the PDE solution process. For instance, when solving a PDE by a finite element method (FEM), it is from a mathematical point of view natural to rephrase the PDE in terms of its weak formulation. Such weak formulations involve the evaluation of (possibly complicated) integrals over the computational domain. It turns out that the general FEM algorithm is essentially a loop over all elements in the grid, where for each element the local contribution to the discretized problem is computed by numerical integration. The integration method itself usually takes the form of an inner loop over a collection of integration points, where the integrand needs to be evaluated for each point picked.

Observing that the PDE enters the calculation only in terms of the point samples of the integrand, this mathematical/numerical view of the solution process is mirrored in the Diffpack software. As an application programmer, the user supplies the necessary expressions to evaluate the integrand of the particular PDE for a given integration point. The rest of the solution process is automatically handled by the Diffpack library components, all the way from element definitions via numerical integration methods and matrix assembly, to the solution of the resulting algebraic problems. In addition, the user might have to supply the necessary input data concerning boundary conditions and initial conditions. As a result, by coding 2-3 functions, together small enough to fit in one or two sheets of paper, the user will have a full-scale simulator providing run-time access to a wide selection of numerical solution methods.

Simulators implemented in agreement with Diffpack's coding standard can easily be reused in different settings. The software philosophy encourages the implementation of separate, generic solvers for the types of PDEs encountered in an application field. Such solvers can thereafter be specialized or refined by use of object-oriented principles like class inheritance. This is also the key to successful construction of compound simulators solving systems of coupled PDEs, possibly subject to complicated constitutive relations. Instead of starting an elaborate development from scratch, the user may pull existing Diffpack solvers from his software toolchest and make these objects work together. This software strategy has significant pay-off in terms of reduced and structured development efforts, combined with increased reliability and robustness as each solver involved gets used within a wide range of different problem configurations.

Using Diffpack's highly optimized concepts for representation of spatial points, simulators can also be set up to run in 1D, 2D and 3D, all from the same source code. Also, Diffpack's mechanisms for complex arithmetic ensure that complex and real problems can be solved with the same implementation techniques.

Run Time Control

One important feature of most Diffpack applications is the so-called menu system. This is a hierarchical data management system used at run time to define initial values of all entities used in a Diffpack program. Such entities may be simple numerical parameters, but may as well be more abstract quantities such as matrix formats, algebraic solvers, convergence criteria, numerical integration schemes, element types, etc. Thus, the menu system gives any application the ability to select, at run time, all program entities, from simple constants to the numerical algorithms that will be used.

The configuration is usually defined in input files (*.i files), and may in addition be redefined via graphical or command line selection dialogs. When Diffpack is used as sub-libraries in context of applications with established user communication, the configuration can be loaded directly from such an input stream (without input files or selection dialogs).

The menu system allows multiple choices to each program entity. Multiple choices will result in one run per configuration, and is often used to set up consistent numerical experiments, e.g. in a batch process. As an example, the user could define a loop over different preconditioners and iterative solvers, in order to find the optimal set-up for a certain type of linear system.

From Prototype to Production Code

The development of computationally intensive applications in Diffpack is often performed in two main steps:

  1. Development of a prototype with focus on correctness of model and numerical methods.
  2. Converting the prototype to an optimized version suitable for running in a production context.

The first step will normally use the most general tools in Diffpack for e.g. matrix assembly, numerical integration, mesh formats, etc., without explicit utilization of any specific structural properties of the particular problem at hand. The focus is thus on the overall solution process and the verification of simulator design and numerics.

In the second step, bottlenecks in the computations are localized and structural properties of the problem are used to optimize the critical functionality. The localization may efficiently be performed by standard code profiling tools, and Diffpack functions providing CPU critical operations may be replaced by the user's own specialized implementation using knowledge of the particular problem at hand.

Extending and Interfacing Diffpack

Functionality developed by the user can be seamlessly integrated with Diffpack, in the sense that user defined entities can be given the same level of interoperability as native Diffpack entities. As an example, the user may construct his own finite element types and select these at run time via the menu system and Diffpack's GUIs together with the native Diffpack elements. Technically, such integration is facilitated by special Diffpack functions registering the user-defined entities into Diffpack's entity tables.

Most user-defined functionality can be integrated with Diffpack as library components at the level of interoperability described above. The user may thus consistently extend Diffpack into a tool tailored to his particular areas of interest.

User defined library components might be programmed from scratch. Naturally, for many users it is of particular interest to extend Diffpack with well-tested legacy code, e.g. written in C or FORTRAN. Such functionality may easily be encapsulated in classes with communication interfaces following the Diffpack standard. This approach allows a seamless integration with Diffpack using the registration mechanisms explained above. With minimal efforts, the user may therefore make valuable functionality, which may have taken man-years to develop, directly available as part of Diffpack's plug'n play environment.

Flexibility and Efficiency

The plug'n play characteristics of Diffpack application development are facilitated by a software design heavily based on object-oriented programming. Such constructions can increase human ability and efficiency significantly, but may in cases of improper use lead to a general decrease of computational efficiency.

In Diffpack, object-oriented mechanisms are used only for tasks with minimal influence on computational efficiency. In particular, low-level, computationally intensive operations are always performed in a FORTRAN or C type style, while the object-oriented principles are mainly used for higher level administrative tasks. Although object-oriented, this means that most Diffpack applications will spend almost all CPU time in functions containing very basic loops over array structures, as is the case in well written numerical FORTRAN codes. This ensures high computational performance of Diffpack applications.

Comparisons ([2]) to tailored FORTRAN benchmark codes show insignificant differences in computational efficiency between Diffpack applications and finely tuned FORTRAN solvers.

GUIs, Databases, Pre- and Postprocessing

Diffpack defines an internal format (SimRes) for storage of mesh and field structures. This format is used for storage of stand-alone entities (e.g. a simple grid file) as well as complete simulation scenarios (e.g. a SimRes database containing several mutually dependent grid and field objects).

For postprocessing, Diffpack provides a suite of filters to convert SimRes data to formats used by third party visualization products, as e.g. Matlab, Gnuplot, IRIS Explorer and AVS. For preprocessing, filters are provided for mesh formats generated by Abaqus, Ansys and Nastran via the Diffpack Datafilter Toolbox. All these filters can operate either as file-to-file converters or they may be linked to an application for direct data exchange. Some of the postprocessors may also be started directly from a Diffpack application.

In addition to filters to third party preprocessors, Diffpack provides internal preprocessors supporting lattice grids, transfinite mappings and super-element techniques as well as interfaces to the public domain grid generators GeomPack and Triangle.

On Unix, any application will operate with graphical menu selections provided it is compiled with the appropriate options. On Windows, any application can be equipped with a GUI providing application control, result browsing, curve plotting and state-of-the-art visualization (Vtk).

Quality Assurance

Diffpack is available for about 10 different platforms (hardware/compiler configurations) and is maintained as one single source code across all these architectures. The broad selection of compilers ensure that only portable and safe C++ constructions are used, and makes it easy to include new platforms in the portfolio when necessary. It is therefore easy to move an application from one platform to another, normally without need for any changes in the application source code.

Correctness and stability of the Diffpack functionality is regularly verified on a suite of several hundred verification applications on all supported platforms. The verification tools are also available to the users for easy QA of their own development.

Diffpack motivates the user to apply a safe and consistent programming style, and offers a variety of tools to enhance efficiency of the development process, including automatic memory handling and powerful debugging tools.

The user's applications can easily follow the upgrade path of Diffpack, due to automatic code transformation tools upgrading his application source code from an older to a newer version of Diffpack.

Documentation Tools

Diffpack provides powerful mechanisms for documentation of numerical experiments. Full project reports containing e.g. problem description, tabulated numerical results, images, videos and, e.g., source code of the application itself, can be generated in ASCII, LaTeX or HTML formats. The reporting mechanisms interface to the menu system, and can be used to create reports of multiple runs with overview summaries and links to details for individual runs.

  1. Hans Petter Langtangen,
    Computational Partial Differential Equations, Numerical Methods and Diffpack Programming,
    Texts in Computational Science and Engineering, Vol. 1,
    Springer-Verlag, 2003.
  2. E. Arge, A. M. Bruaset, P. B. Calvin, J. F. Kanney, H. P. Langtangen and C. T. Miller.
    On the Numerical Efficiency of C++ in Scientific Computing (pages 91-118) in
    M. Dæhlen and A. Tveito (eds)
    Numerical Methods and Software Tools in Industrial Mathematics,
    Birkhauser, 1997.