12-759 Computational Optimization of Systems Governed by Partial Differential Equations

Carnegie Mellon University - Fall 2003
Professor Omar Ghattas

12-759 | setup | compilation | examples | documentation | plotting | tutorial

Using Sundance

You will be using a high level, object oriented finite element API, called Sundance, for your programming assignments. Sundance is being developed by Kevin Long at Sandia National Laboratories. It is not an application tool like Matlab, Mtahematica, or Ansys but rather a hierarchy of C++ classes that will help you to rapidly prototype your simulations. You don't need to be a C++ expert to successfully write code in Sundance. Through examples provided in class and from a comprehensive repository you will easily get familiar with the structure of a code written using Sundance and with its C++ classes. In no time you will be programming, compiling, and running your code.

 

Compiling, linking, and running your code

Sundance has been built for the Linux platform. Thus you will need to access a Linux machine in order to use it. If you have access to Andrew, login via telnet or ssh to linux.andrew.cmu.edu. That will grant you access to a Linux machine in the Andrew pool.

Sundance comes with a pre-costumized makefile that sets everything you need to compile and link your code. Due to its simplicity and easy of use we strongly suggest that you use it. We have edited it so it comprises our own installation needs. If you need to use third party libraries or include header files not set in this makefile, please edit it carefully so it suits your needs.

Start by copying the proper Makefile to your working directory:

  • Andrew users: available at /afs/cs.cmu.edu/project/taos-15/src/Makefile. Here is a link to it.
  • CS users: available at /afs/cs.cmu.edu/project/taos-16/src/Makefile. Here is a link to it.

To compile and link your source code named, for example, heat1D.cpp located in your working directory, type in a shell

> make heat1D.e

Note the suffix ".e" which is the standard suffix you will use from now on when compiling and linking your source code. If compilation and linking go fine, you should get an executable file heat1D.e. To run it, just type

> ./heat1D.e

It should produce an output similar to the one shown below:

(...)
<p=0> test: heat1D.cpp Tue Jan 28 00:59:28 EST 2003 PASSED:
<p=0> error=4.22115e-16, tol=1e-10
 
<p=0> executable compiled from source heat1D.cpp on Jan 28 2003 00:42:35
<p=0> sundance total                          : 0.02
<p=0> mesh generation                         : 0
<p=0> term list LHS check                     : 0
<p=0> DOF map assembly                        : 0
<p=0> cell set identification                 : 0
<p=0> disc func creation                      : 0
<p=0> BLAS calls                              : 0
<p=0> term list insert                        : 0
(...)

NOTE: If you have a local version of MPI installed in your computer, you may have conflicting problems between your local MPI libraries and the ones installed in taos-15/taos-16.

Code examples

Sundance comes with a comprehensive set of code examples that you can browse directly from your shell or web browser. The majority of the examples are located under the main Sundance directory, /afs/cs.cmu.edu/project/taos-15/src/Sundance, at examples/Tests. You can copy any code to your working directory and make an executable out of it so you can explore Sundance feaures.

Follow this link to browse the collection of example codes provided with Sundance.

Documentation

This web page is located at http://www.cs.cmu.edu/~12-759/sundance.html

Documentation about Sundance is available for printing and online. The User's Guide is only available in PDF format (distributed in class; you should have a printed copy by now). The Reference Manual is available online only and it contains the declaration of all classes in Sundance. It is an extremely valuable resource for your programming experience in Sundance.

Sundance uses Trilinos which is a collection of packages of parallel solver algorithms and libraries within an object-oriented software framework for the solution of large-scale, complex multi-physics engineering and scientific applications. You can find documentation and a user's guide to Trilinos classes and examples on the web at http://software.sandia.gov/trilinos. In special, follow the Packages link and from there to TSF and Epetra packages at the left banner. These are the Trilinos packages most used by Sundance. Note that the examples in the Sundance repository are very comprehensive and you would not need to explore much Trilinos to answer your programming questions.

Plotting

Sundance has a file interface to Matlab so you can plot the solutions of your problem as fields using Matlab plotting engine. To perform 1D, 2D, and 3D plotting, use respectively the files plot1D.m, plot2D.m, and plot3D.m located at /afs/cs.cmu.edu/project/taos-15/src/Sundance/examples. They contain functions to plot the results in files created by the Sundance MatlabWriter interface. All you have to do to build a plot is to load the plot?D.m file and then call the function defined in this file with the data file name. Check the source codes in examples/Tests for many Matlab interface examples.

Send comments and questions about this page to Alexandre Cunha