How to make a nice spaghetti in Paraview

In groundwater hydrology streamlines is a very common and effective way to illustrate the groundwater flow field.

Unfortunately because the x-y extend of the groundwater domains is very large, by many orders of magnitude, compared to the z extend this makes the visualization a bit tricky.

The following figure shows the streamlines colored by the velocity along the streamline. The first figure shows the actual size and the next shows the streamlines scaled by a factor of 10.

velocity1

velocity1_scaled

 

Those streamlines are thin polylines. To give them volume we can apply the tube filter.

The tube filter however is disabled for lines. We have to convert them first into surfaces.

However before that we will apply  a transformation filter by setting the z scale the desired value.

Next we will apply the Extract surface filter to the transformed streamlines.

And finally the Tube filter with the appropriate radius. Usually the default is too large.

The following figure shows the same streamlines as tubes. In this figure the view angle makes the rendering quite poor but if you zoom in they look nice tubes

velocity_tube

 

To summarize, the sequence of filters over a set of lines to convert them into tubes is the following:

  1. Transform filter by the desired scale factor
  2. Extract surface filter
  3. Tube filter

Compile Trilinos

A guide to compile Trlinos for beginners

Trilinos  is a great collection of numerical algorithms for large scale simulations.
It allows people who have very little programming experience in C/C++ to use advanced numerical techniques and powerful solvers.

Being myself an inexperienced C/C++ programmer and unfamiliar with the linux environment I found extremely difficult to get started. In this article I’d like to describe how to install and compile programs using the Trilinos library.
Using the following steps I have been able to install Trilinos under Ubuntu 12.04 32-bit, Ubuntu 12.10, 13.10 64-bit and two cluster systems that run some kind of linux distribution.

First download the .gz file from their website (you need to enter your email address but its ok you don’t get spam from them!) and then unzip it in your hard drive. (You need of course to replace the name with the name of the file you have downloaded).

This will create a folder ../trilinos-11.4.1-Source

Go into that folder

Before launching the installation of Trilinos make sure you have cmake 2.8 or greater installed by typing

If cmake is not installed in your system or the version is outdated you can get it from here. The installation of cmake should be straightforward (If not, cmake has actually failed its purpose).

Trilinos contains a large number of packages. It is very unlikely that you need all of them, so I highly recommend not to try building all of them at once, but choose only the packages you need. One package I use very often is the Amesos, which provides a nice interface to solve linear systems AX=B using direct methods. Here I’ll describe how to install Amesos and all the packages that Amesos depends on.

For each combination of packages you want to build do the following steps:

Make sure the current directory is the ../trilinos-11.4.1-Source. Under ../trilinos-11.4.1-Source create a new directory. We will install Amesos with mpi support, therefore we will name this directory AMESOS_MPI.

Create an empty file and name it for example “do-configure”.

In the new file add the following lines

After the line cmake \ we will give all the options needed to build trilinos.

The first option will tell cmake where we want to install the package we are compiling: We are going to install this under the folder we just created

Next we will tell whether we want a Debug or Release version. I always start with debug version

Next we will give the mpi, C++, c and fortran compilers paths. These are usually installed under /usr/bin/ or /usr/local/bin/. If you cannot find them a useful command is  the  locate mpiCC  for example.

One of the reasons that Trilinos is difficult to unfamiliar users to compile is that the number of available options is overwhelming. Here you can find detailed explanations for every of the following options. In short the first line if set to on improves debugging messages, the second line removes warning message to appear as errors (I’m not quite sure about it) and the last line tells whether we want to print output during compile or not. I always choose to have alot of output.

The next set of options are related to the packages. First we instruct cmake not to build all packages  and the next two lines instruct cmake to build the Amesos package and all optional packages that depend on Amesos. We also enable the tests and the examples.

From the following set of options not all are necessary.  The first enables the mpi support and that’s mandatory. The remaining options seem to be optional as I have been able to compile trilinos without using them. I believe the options are self explanatory. Note that the option MPI_EXEC_MAX_NUMPROCS is the number of processors we want to use during compilation.

While it is possible to let cmake to find the blas and lapack library we can also define the paths in case these are installed somewhere that cmake can’t guess e.g.

All the above options are sufficient to build the Amesos package with mpi support. However doing so we will be able to use only the default solver. Although the default solver is quite good Amesos provides interface for few other solvers.

If that’s your first attempt to install trilinos it might be better not to try the following options.

The following options are used when you want to install any third party library (TPL).  Here we will assume that we have already build the SuperLU and UMFPACK. Note that the following options have the format TPL_xxxxxxx where xxxxxxx is the name of the TPL. Unfortunately this is case sensitive. Yet what is more unfortunate is that there is no way to guess which letters should be upper and lower case. Therefore you need always to check this list and follow precisely the spelling.

First we set on the flag that tells cmake that we want to use the UMFPACK solver. Next we provide the paths for the include and library directories. Using semicolons we can set more that one path. The 4th line is the name of the library without the lib prefix and the suffix which typically is .so, so.3 etc.

For any other TPL we provide the same options. For example to use SuperLU we set the following:

Finally we add the 2 last lines in this script:

The last line tells the script to go one level up, therefore you need to make sure that the AMESOS_MPI directory is under the trilinos directory.

Next make the do_configure file executable by setting the right permissions, and run the script

If there are no errors you can build the library by typing

After the build has finished you can run some tests if the built was successful.

The last step is to install the the package by typing

Now the package is ready to solve all your problems.