6 Extending and contributing to ASPECT

ASPECT is designed to be an extensible code. In particular, it uses both a plugin architecture and a set of signals through which it is trivial to replace or extend certain components of the program. Examples of things that are simple to extend are:

This list may also have grown since this section was written. We will discuss the way this is achieved in Sections 6.1 and 6.3. Changing the core functionality, i.e., the basic equations (1)–(3), and how they are solved is arguably more involved. We will discuss this in Section 6.6.

Note: The purpose of coming up with ways to make extensibility simple is that if you want to extend ASPECT for your own purposes, you can do this in a separate set of files that describe your situation, rather than by modifying the ASPECT source files themselves. This is important, because (i) it makes it possible for you to update ASPECT itself to a newer version without losing the functionality you added (because you did not make any changes to the ASPECT files themselves), (ii) because it makes it possible to keep unrelated changes separate in your own set of files, in a place where they are simple to find, and (iii) because it makes it much easier for you to share your modifications and additions with others.

Since ASPECT is written in C++ using the deal.II library, you will have to be proficient in C++. You will also likely have to familiarize yourself with this library for which there is an extensive amount of documentation:

As a general note, by default ASPECT utilizes a deal.II feature called debug mode, see also the introduction to this topic in Section 4.3. If you develop code, you will definitely want this feature to be on, as it will capture the vast majority of bugs you will invariably introduce in your code.

When you write new functionality and run the code for the first time, you will almost invariably first have to deal with a number of these assertions that point out problems in your code. While this may be annoying at first, remember that these are actual bugs in your code that have to be fixed anyway and that are much easier to find if the program aborts than if you have to go by their more indirect results such as wrong answers. The Frequently Asked Questions at https://github.com/dealii/dealii/wiki/Frequently-_Asked-_Questions contain a section on how to debug deal.II programs.

The downside of debug mode, as mentioned before, is that it makes the program much slower. Consequently, once you are confident that your program actually does what it is intended to do – but no earlier! –, you may want to switch to optimized mode that links ASPECT with a version of the deal.II libraries that uses compiler optimizations and that does not contain the assert statements discussed above. This switch can be facilitated by editing the top of the ASPECT Makefile and recompiling the program.

In addition to these general comments, ASPECT is itself extensively documented. You can find documentation on all classes, functions and namespaces starting from the doc/doxygen/index.html page.

 6.1 The idea of plugins and the SimulatorAccess and Introspection classes
 6.2 How to write a plugin
 6.3 Materials, geometries, gravitation and other plugin types
  6.3.1 Material models
  6.3.2 Heating models
  6.3.3 Geometry models
  6.3.4 Gravity models
  6.3.5 Initial conditions
  6.3.6 Prescribed velocity boundary conditions
  6.3.7 Temperature boundary conditions
  6.3.8 Postprocessors: Evaluating the solution after each time step
  6.3.9 Visualization postprocessors
  6.3.10 Mesh refinement criteria
  6.3.11 Criteria for terminating a simulation
 6.4 Compatibility of plugins with newer ASPECT versions
 6.5 Extending ASPECT through the signals mechanism
 6.6 Extending the basic solver
 6.7 Testing ASPECT
  6.7.1 Running tests
  6.7.2 Writing tests
 6.8 Contributing to ASPECT’s development