Lifev Manual

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 22

DownloadLifev-manual
Open PDF In BrowserView PDF
LifeV User Manual
Revision: 1.9, , UTC Printed: February 20, 2015

G. Fourestey, S. Deparis

This manual is for LifeV (version 3.8.3, January 2015), a library for scientific computing
using finite elements, specially aimed at fluid-structure interaction and blood flow simulation.
Copyright (C) 2001- 2015 EPFL, INRIA, Politecnico di Milano.
1

Contents
1 Generalities
1.1 Scope of the document . . . . . . . . . . . . .
1.2 Language and nomenclature convention . . .
1.3 Software Management . . . . . . . . . . . . .
1.4 Compiling LifeV . . . . . . . . . . . . . . . .
1.4.1 Trilinos compilation . . . . . . . . . .
1.4.2 Compilation from git . . . . . . . . . .
1.4.3 Compilation from Official Distribution
1.4.4 Compiling Testsuites . . . . . . . . . .
2 Learning by examples
2.1 Reading data . . . . . . . . . . . .
2.2 The Poisson problem . . . . . . . .
2.2.1 Variational formulation and
2.2.2 LifeV simulation . . . . . .

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

. . . . . . . .
. . . . . . . .
finite element
. . . . . . . .

2

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

4
4
4
4
5
7
8
9
10

. . . . . . . .
. . . . . . . .
discretization
. . . . . . . .

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

11
11
12
12
13

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

List of Tables

3

Chapter 1

Generalities
1.1

Scope of the document

This is an informal document dedicated to amateur or inexperienced users of the software
library LIFE V (life 5).
The major objectives of this document are:
1. to compile the software library,
2. to provide examples of its use.
For a more detailed overview of LifeV ’s main features (management of boundary conditions,
time and space discretization, algebraic solvers and preconditioners, etc), see the doxygen
webpage: https://cmcsforge.epfl.ch/doxygen/lifev/.

1.2

Language and nomenclature convention

typesetting font style is used to indicate parts of computer code, configure shell scripts,
command-prompt instructions and webpages.

1.3

Software Management

The software source, its documentation and all related documents (this one included) are kept
in a repository under revision control using git1 . Its goal is to provide tools to manage software
development in a concurrent environment. See http://git-scm.com/documentation for a
tutorial.
As mentioned above, a website à la Sourceforge2 http://cmcsforge.epfl.ch has been
set up to host the source code and help the software management. It requires that you open
an account3 there and ask to join the project LifeV using the link at the bottom of the
developers’ list. Once you would become a member, you will gain access to all the facilities:
tracker, task manager, git repository, forums, document manager and a few other tools which
are very useful if not absolutely essential to such a project.
Finally, if you expect a frequent use of the git repository we recommend to costumize the
ssh and ssh-agent in order to gain acces without the need to type your password everytime
you issue a command. Please refer to http://mah.everybody.org/docs/ssh in order to
configure your ssh agent.
1 git

is the fast version control system.

2 http://www.sourceforge.net
3 https://cmcsforge.epfl.ch/account/register.php

4

1.4. COMPILING LIFEV

CHAPTER 1. GENERALITIES

We advice every user to apply to the list lifev-users on http://groups.google.com where
one can get in touch with other users and developers.

1.4

Compiling LifeV

There are a few compilation tools and libraries we need to build and install before compiling
LifeV , here is a short presentation. Note that, in addition to the following description, the
complete installation steps are available on the following webpages:
1. http://www.lifev.org/documentation/installation-tutorial ,
2. https://cmcsforge.epfl.ch/projects/lifev/wiki/LifeV_on_MacOSX .
In computer science, a library is a set of subroutines or classes used to develop software.
Usually they are downloaded as a so called “tarball” file compressed using the tar command.
There are different ways to compress libraries but the most common is to use the command
tar -cvf and further compress “zip” it with gzip. If your tarball has the suffix .tar.gz
equivalent to .tgz, you can decompress “unzip” it with gunzip followed by the name of the
.tar.gz file and extract its contents using tar -xvf followed by the name of the .tar file. If
you find the libraries compressed with other formats please refer to the unix manuals man or
the numerous on-line documents for further information.
Software libraries need to be extracted, compiled and installed. In unix-like systems,
the libraries .a and .so files are installed usually in the directory /usr/lib, while header
files .h are installed in the /usr/include directory. Compilers search for libraries there by
default, but in principle they can be installed anywhere you want as long as you pass the
path to the library using the compiler flag -L immediately followed by the library path (e.g.
-L/path/to/lib) and similarly for the header files using the compiler flag -I followed by
the include path. Libraries compiled from source are usually installed in /usr/local/lib,
/usr/local/include.
Libraries are usually created with the prefix lib followed by the name of the library and
linked with the compiler flag -l followed by its name (e.g. -lblas).
Compilation Environment
LifeV depends on a number of tools at compilation time that are part of the autotools from
the GNU project4 available in most Linux OS:
• g++-4.0 or newer (currently 4.9.2).
• mpi, with preference to openmpi.
• CMake 2.8.11 or newer (currently 3.1.0).
In Mac OS X you get gcc in Xcode and cmake can be installed using MacPorts with the
command sudo port install cmake. You can check the version of a command typing the
command followed by --help, for example type cmake --help.
LifeV depends on several optimized libraries, you can check if you have them installed using
the locate command (after updating the search database with sudo updatedb) followed by
the name of the library, for example locate liblapack.a, or go to the /usr/lib directory
and search on the list with ls. It is important to notice that some libraries are linked to others
and they should be compatible, therefore you should build them in the order of dependency
and with compatible flags and compilers.
These are the optimized libraries you need to have installed:
4 http://www.gnu.org

5

1.4. COMPILING LIFEV

CHAPTER 1. GENERALITIES

• A version of MPI. The message passing interface for C and Fortran compilers. For example http://www.open-mpi.org/. Once installed you can check the necessary flags for
its use by typing mpicc --show.
On a Debian system the command sudo apt-get install libopenmpi* should do the
trick.
In Mac OS X using MacPorts install a fortran compiler typing sudo port install gcc46
and openmpi with sudo port install openmpi. Note however that MPI should be natively installed if you installed XCode.
• BOOST. Libraries which extend the functionality of C++. Check if they exist on your
computer, they are many libraries with the prefix libboost.
If you need to install them, try sudo apt-get install libboost* on Debian systems
or something similar for other Linux distros.
In Mac OS X using MacPorts type sudo port install boost.
If you need to compile from source, download the libraries at http://www.boost.org.
Make sure you include the line “using mpi;” in the configuration text file project-config.jam.
You can specify the path to install using the flag --prefix=/path/ when running ./bjam
install. But most of the time cross compilation of this library won’t work completely.
• HDF5 If you don’t have the library hdf5 installed in your system, you could use the sudo
apt-get install libhdf5-openmpi-dev command on Debian systems or something
similar for your particular distro. There are detailed instructions on-line on how to
build it for other systems and with other options, see http://micro.stanford.edu/
wiki/Install_HDF5#Build_and_Installation_from_Sources.
In Mac OS X using MacPorts type sudo port install hdf5 or build it from the sources
to link it to the correct openmpi compilers.
• BLAS. On Debian systems run sudo apt-get install libblas-dev.
In Mac OS X the system comes with blas and lapack as part of the Accelerate framework -framework Accelerate, and if using MacPorts type sudo port install atlas
to install the atlas library (blas and lapack).
To compile from source, get the libraries e.g. at https://www.tacc.utexas.edu/research-development/
tacc-software/gotoblas2. To build just type make. To make use of the library remember to have the pthreads library and flag -lpthread while linking to the blas library
libgoto2_xxxxx_xx.xx.a, whose exact name depends on the characteristics of your
hardware.
• LAPACK. Fortran 90 Linear Algebra Routines for systems of simultaneous linear algebra
equations, linear least-squares problems and matrix eigenvalue problems. You must pay
attention to build the lapack using an optimized blas like the GotoBLAS (see above).
Download it at http://www.netlib.org/lapack/. You need a fortran compiler (for
example gfortran). Copy make.inc.example to make.inc and edit the path to the
blas library followed by the flag -lpthread and type make.
For a non-optimized version on a Debian system run sudo apt-get install liblapack-dev.
• PARMETIS. You can download ParMetis from http://glaros.dtc.umn.edu/gkhome/
metis/parmetis/download. Set CC=mpicc in Makefile.in. and type make. In Mac
OS X you need the include path flags -I/usr/include and -I/usr/include/malloc.
• UMFPACK (now part of SuiteSparse). Set of routines for solving unsymmetric sparse
linear systems.
On a Debian system, install it with the command sudo apt-get install libsuitesparse-dev.
To compile SuiteSparse from source, download it from http://faculty.cse.tamu.edu/
davis/suitesparse.html and follow the instructions in the README.txt file (in particular, you’ll want to edit the SuiteSparse_config/SuiteSparse_config.mk file according

6

1.4. COMPILING LIFEV

CHAPTER 1. GENERALITIES

to your configuration).
For Mac OS X you must uncomment the special options given for this system, so you can
use the blas and lapack from atlas or from the Accelerate framework -framework Accelerate.
• TRILINOS. See the next section.

1.4.1

Trilinos compilation

LifeV depends on Trilinos, a set of object oriented C++ interfaces for packages like blas,
lapack, parmetis, umfpack and many more. A copy of the source code is available for download
at http://trilinos.org/download/.
After downloading, decompressing and extracting the tarball, you’ll need to make a build
directory anywhere you want to avoid build in the sources directory. (in the following script,
we assume that the directories trilinos and trilinos-build are at the same level) Trilinos
(latest version 11.12.1 at the time of writing) now requires the CMake build system 2.8.11 or
newer. Go to the build directory and write a do-configure shell script like the following
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

#! / b i n / bash
E X T R A _ A R G S=$ @
cmake \
−D C M A K E _ B U I L D _ T Y P E : S T R I N G=R E L E A S E \
−D T r i l i n o s _ E N A B L E _ A m e s o s : B O O L=O N \
−D T r i l i n o s _ E N A B L E _ A n a s a z i : B O O L=O N \
−D T r i l i n o s _ E N A B L E _ A z t e c O O : B O O L=O N \
−D T r i l i n o s _ E N A B L E _ B e l o s : B O O L=O N \
−D T r i l i n o s _ E N A B L E _ E p e t r a : B O O L=O N \
−D T r i l i n o s _ E N A B L E _ E p e t r a E x t : B O O L=O N \
−D T r i l i n o s _ E N A B L E _ G a l e r i : B O O L=O F F \
−D T r i l i n o s _ E N A B L E _ I f p a c k : B O O L=O N \
−D T r i l i n o s _ E N A B L E _ I s o r r o p i a : B O O L=O F F \
−D T r i l i n o s _ E N A B L E _ K o k k o s : B O O L=O N \
−D T r i l i n o s _ E N A B L E _ M L : B O O L=O N \
−D T r i l i n o s _ E N A B L E _ T E S T S : B O O L=O F F \
−D T r i l i n o s _ E N A B L E _ T e u c h o s : B O O L=O N \
−D T r i l i n o s _ E N A B L E _ T h r e a d P o o l : B O O L=O N \
−D T r i l i n o s _ E N A B L E _ T p e t r a : B O O L=O N \
−D T r i l i n o s _ E N A B L E _ T r i u t i l s : B O O L=O N \
−D T r i l i n o s _ E N A B L E _ Z o l t a n : B O O L=O N \
\
−D T r i l i n o s _ E X T R A _ L I N K _ F L A G S : S T R I N G=”−l p t h r e a d ” \
−D T P L _ E N A B L E _ P t h r e a d : B O O L=O N \
\
−D T P L _ E N A B L E _ B L A S : B O O L=O N \
−D B L A S _ I N C L U D E _ D I R S : P A T H=/b l a s / i n c l u d e / d i r / \
−D B L A S _ L I B R A R Y _ D I R S : P A T H=/b l a s / l i b / d i r / \
−D B L A S _ L I B R A R Y _ N A M E S : S T R I N G=” b l a s ” \
\
−D T P L _ E N A B L E _ L A P A C K : B O O L=O N \
−D L A P A C K _ I N C L U D E _ D I R S : P A T H=/ l a p a c k / i n c l u d e / d i r / \
−D L A P A C K _ L I B R A R Y _ D I R S : P A T H=/ l a p a c k / l i b / d i r / \
−D L A P A C K _ L I B R A R Y _ N A M E S : S T R I N G=” l a p a c k ” \
\
−D T P L _ E N A B L E _ H D F 5 : B O O L=O N \
−D H D F 5 _ I N C L U D E _ D I R S : P A T H / h d f 5 / i n c l u d e / d i r / \
−D H D F 5 _ L I B R A R Y _ D I R S : P A T H=/h d f 5 / l i b / d i r / \
\
−D T P L _ E N A B L E _ U M F P A C K : B O O L=O N \
−D U M F P A C K _ I N C L U D E _ D I R S : P A T H=/ u m f p a c k / i n c l u d e / d i r / \
−D U M F P A C K _ L I B R A R Y _ D I R S : P A T H=/ u m f p a c k / l i b / d i r / \
−D U M F P A C K _ L I B R A R Y _ N A M E S : S T R I N G=” umfpack ; amd” \
\
−D T P L _ E N A B L E _ M P I : B O O L=O N \
−D M P I _ B A S E _ D I R : P A T H=/u s r / l i b / o p e n m p i / \
−D M P I _ B I N _ D I R : P A T H=/u s r / b i n \
\
−D T P L _ E N A B L E _ P a r M E T I S : B O O L=O N \
−D P a r M E T I S _ L I B R A R Y _ D I R S : P A T H=/ p a r m e t i s / l i b / d i r / \
\
−D C M A K E _ I N S T A L L _ P R E F I X : P A T H =./ \

7

1.4. COMPILING LIFEV

CHAPTER 1. GENERALITIES

$EXTRA_ARGS \
. . / trilinos /

55
56

Simply modify the paths of libraries according to your particular configuration and run
the shell script (chmod +x do-configure && ./do-configure). For example, instead of
lapack_library_name you should type the name of your lapack library without the lib
prefix and the .a suffix. The prefix and suffix are automatically added by CMake.
If SuiteSparse was compiled from source the UMFPACK_LIBRARY_NAMES variable has to be modified so that it reads "umfpack;suitesparseconfig;cholmod;colamd;amd"
As an alternative to the above script, you can run
1

ccmake

. . / lifev

to get a graphical configuration menu (however ccmake needs libncurses to be installed),
with many more options.
After the configuration is done, just type
1

make

that will compile the static files and further
1

make install

that will create and install the library files in two subdirectories lib and include, where it
will respectively pack the objects files into library files (.a and .la files) and copy the include
files ( .h or .hpp files ).
The Trilinos library is now installed in the build directory you created.

1.4.2

Compilation from git

You need first to have an account on http://cmcsforge.epfl.ch and be part of the LifeV
project, see 1.3.
First, you need to checkout LifeV . git has been configured to use ssh and your ssh keys to
access the repository via ssh without entering your password. When your ssh agent is properly
configured, send your public key to the local administrator, such that it can be included in
the gitolite configuration. Then you will be able to access the repositories without password.
It is now time to download and compile the code. Just type
1

git clone g i t @ c m c s f o r g e . epfl . ch : lifev . git lifev

and go to the newly created directory
1

cd lifev

Second, you must make a build directory apart from the lifev sources directory, for example
in your home you can have a lib directory with a lifev subdirectory and further an optimized
version subdirectory opt or the debugging mode subdirectory debug, or something similar
according to your own taste.
Third, you have to execute the following do-configure shell script (again, modified to
suite your configuration) in the opt directory. It will automatically check the availability of
the needed components for LifeV compilation :
1
2

#! / b i n / bash

8

1.4. COMPILING LIFEV

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48

CHAPTER 1. GENERALITIES

E X T R A _ A R G S=$ @
T R I L I N O S _ B U I L D _ D I R =/ t r i l i n o s / b u i l d / d i r /
cmake \
−D C M A K E _ B U I L D _ T Y P E : S T R I N G=R E L E A S E \
\
−D T P L _ E N A B L E _ M P I : B O O L=O N \
\
−D P a r M E T I S _ I N C L U D E _ D I R S : P A T H=/ p a r m e t i s / i n c l u d e / d i r / \
−D P a r M E T I S _ L I B R A R Y _ D I R S : P A T H=/ p a r m e t i s / l i b / d i r / \
\
−D T P L _ E N A B L E _ B L A S : B O O L=O N \
−D B L A S _ I N C L U D E _ D I R S : P A T H=/b l a s / i n c l u d e / d i r / \
−D B L A S _ L I B R A R Y _ D I R S : P A T H=/b l a s / l i b / d i r / \
−D B L A S _ L I B R A R Y _ N A M E S : S T R I N G=” b l a s ” \
\
−D T P L _ E N A B L E _ L A P A C K : B O O L=O N \
−D L A P A C K _ I N C L U D E _ D I R S : P A T H=/ l a p a c k / i n c l u d e / d i r / \
−D L A P A C K _ L I B R A R Y _ D I R S : P A T H=/ l a p a c k / l i b / d i r / \
−D L A P A C K _ L I B R A R Y _ N A M E S : S T R I N G=” l a p a c k ” \
\
−D T P L _ E N A B L E _ H D F 5 : B O O L=O N \
−D H D F 5 _ I N C L U D E _ D I R S : P A T H=/h d f 5 / i n c l u d e / d i r / \
−D H D F 5 _ L I B R A R Y _ D I R S : P A T H=/h d f 5 / l i b / d i r / \
\
−D T P L _ E N A B L E _ B o o s t : B O O L=O N \
−D B o o s t _ I N C L U D E _ D I R S : P A T H=/ b o o s t / i n c l u d e / d i r / \
\
−D T P L _ E N A B L E _ T r i l i n o s : S T R I N G=O N \
−D T r i l i n o s _ D I R : P A T H=$ T R I L I N O S _ B U I L D _ D I R / l i b / c m a k e / T r i l i n o s \
−D T r i l i n o s _ I N C L U D E _ D I R S : P A T H=$ T R I L I N O S _ B U I L D _ D I R / i n c l u d e / \
−D T r i l i n o s _ L I B R A R Y _ D I R S : P A T H=$ T R I L I N O S _ B U I L D _ D I R / l i b / \
\
−D L i f e V _ V E R B O S E _ C O N F I G U R E : B O O L=O F F \
−D C M A K E _ V E R B O S E _ M A K E F I L E : B O O L=O F F \
\
−D L i f e V _ E N A B L E _ S T R O N G _ C X X _ C O M P I L E _ W A R N I N G S : B O O L=O F F \
\
−D L i f e V _ E N A B L E _ A L L _ P A C K A G E S : B O O L=O N \
−D L i f e V _ E N A B L E _ T E S T S : B O O L=O N \
−D L i f e V _ E N A B L E _ E X A M P L E S : B O O L=O N \
\
−D C M A K E _ I N S T A L L _ P R E F I X : P A T H =./ \
$EXTRA_ARGS \
. . / lifev

Do the same in the debug directory, replacing the first line by
1
2
3
4
5
6
7

\ n o i n d e n t F i n a l l y , y o u j u s t h a v e t o u s e \ i x v { m a k e } t o c o m p i l e \ l i f e v l i b r a r i e s and ←documentation .
Enter
\ begin { lstlisting }
m a k e −j n
make install

where n is the number of parallel jobs.
Be careful because do-configure will fail if you have already compiled LifeV in the source
directory. Therefore is not a good idea to build inside the sources.

1.4.3

Compilation from Official Distribution

The LifeV project provides releases, they are named using the following convention
lifev-x.y.z.tar.gz
Here is what you have to do:
1. download LifeV release lifev-x.y.z.tar.gz
2. unpack it
9

1.4. COMPILING LIFEV

1

CHAPTER 1. GENERALITIES

t a r −x z f l i f e v −x . y . z . t a r . g z

3. configure it following the instructions of the previous section,
4. compile and install it
1
2

m a k e −j n
make install

1.4.4

Compiling Testsuites

LifeV comes with testsuites covering a lot of features. They are located in different directories,
mainly depending on the physical or technical aspects they are concerned with. For example,
you can find a number of tests in the core directory (lifev/lifev/core/testsuite) but
darcy, fsi, navier_stokes, structure are other directories where you can find tests.
All these tests are automatically compiled once you have installed LifeV . To run them just
type
1

make test

10

Chapter 2

Learning by examples
2.1

Reading data

In order to read input data, LifeV is integrated with the open-source library GetPot (http:
//getpot.sourceforge.net/). GetPot allows to easily handle the data regarding the different
phases of the simulation, typically providing the mesh name, the discretization order, the
physical parameters, the solver information and the time step (if any).
GetPot needs the name of the input file that can be linked through the flags ”-f” or ”–file”
while launching the program, e.g.
1

$ . / m y P r o g r a m . e x e −f m y D a t a

The GetPot object allows to read the data from the file, and is constructed thanks to the
name of the input file. If no name is provided, then LifeV uses the default input name ”data”.
1
2
3

GetPot c o m m a n d _ l i n e ( argc , argv ) ;
c o n s t s t d : : s t r i n g d a t a F i l e N a m e = c o m m a n d _ l i n e . f o l l o w ( ” d a t a ” , 2 , ”−f ” , ”−− f i l e ” ) ;
GetPot dataFile ( dataFileName ) ;

The input file must have a tree-structure, an example is as follows
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

# −∗− g e t p o t −∗− ( GetPot mode a c t i v a t i o n f o r emacs )
#−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
#
Data f i l e f o r t h e L a p l a c i a n example
#−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
[ finite_element ]
degree

= P1

[ mesh ]
nx
ny
nz
overlap
verbose

=
=
=
=
=

[ prec ]
prectype
displayList

= Ifpack # Ifpack or ML
= false

[ . / ifpack ]
overlap
[ . / fact ]
i l u t _ l e v e l −of−f i l l
drop_tolerance
relax_value

40
40
40
0
false

= 2

= 1
= 1 . e−5
= 100

11

2.2. THE POISSON PROBLEM

28
29
30
31
32
33
34
35
36
37
38
39

CHAPTER 2. LEARNING BY EXAMPLES

[ . . / amesos ]
solvertype

= A m e s o s _ K L U #A m e s o s _ K L U o r A m e s o s _ U m f p a c k

[ . . / partitioner ]
overlap

= 0

[ . . / schwarz ]
reordering_type
filter_singletons

= n o n e #m e t i s , rcm , n o n e
= true

[../]
[../]

and the data can be read as in folders. For instance, if we have the previous data file and we
want to print the mesh sizes in the three directions, we only need to type
1
2
3
4
5

s t d : : c o u t <<
<<
<<
<<
<<

”Number o f e l e m e n t s i n e a c h d i r e c t i o n ”
”x : ” d a t a F i l e ( ”mesh/ nx ” , 15 )
”y : ” d a t a F i l e ( ”mesh/ ny ” , 15 )
” z : ” d a t a F i l e ( ”mesh/ nz ” , 15 )
std : : endl ;

where the values ”15” are set in LifeV as default sizes. More generally, in every LifeV-based
program, we need to access in the same manner the data through the GetPot object, providing
also a safe default value in case some variables are not specifically set.
You can browse the default data file in every testsuite directory to see examples. Generally,
some entries are compulsory (e.g. the mesh name for unstructured meshes), on the other hand
others are filled with a default value if not specified in the input file.

2.2

The Poisson problem

In this section, we go through a first example dealing with the Poisson equation. At first we
introduce the mathematical setting and well-posedness of the problem, presenting its finite
dimensional formulation and the error estimates. Then we explain how to solve the Poisson
problem using LifeV, going through the different stages that characterize the simulation. More
in particular, we will cover the following topics:
• the preamble: including the headers and configuring MPI
• the construction of a structured mesh and the definition of the finite elements space
• the assembly of the stiffness matrix, the right-hand-side and the setting of boundary
conditions
• the preconditioner and the solution of the linear system
• the exporting of data and the post-processing

2.2.1

Variational formulation and finite element discretization

Let Ω ⊂ Rd , d = 2, 3 be a regular open bounded domain and let ∂Ω be its boundary such that
∂Ω = ΓD ∪ ΓN , Γ̊D ∩ Γ̊N = ∅, our problem reads


x ∈ Ω,
−∆u = f
u = g(σ)
σ ∈ ΓD ,


∂n u = h(σ) σ ∈ ΓN ,

12

2.2. THE POISSON PROBLEM

CHAPTER 2. LEARNING BY EXAMPLES

where f = f (x) denotes the source term and g(σ), h(σ) denote the Dirichlet and Neumann
boundary conditions, respectively. Starting from the differential equation, we can derive the
weak formulation of the problem. We introduce the spaces
n
o
V = Hd1 (Ω) = v ∈ H 1 (Ω) : v|ΓD = 0
(2.1)
and
n
o
Vg = v ∈ H 1 (Ω) : v|ΓD = g(σ) .

(2.2)

Finally, our problem reads: find u ∈ Vg , such that
a(u, v) = F v

∀v ∈ V,

(2.3)

where
Z

Z
∇u · ∇vdx

a(u, v) =

and

Fv =

Ω

Z
f (x)dx +

Ω

h(σ)dσ.

(2.4)

ΓN

Under appropriate hypothesis, problem (2.3) is well-posed. In order to obtain a discrete
solution of problem (2.3) based on the finite element method, we introduce at first a partition
Th of the domain Ω, and the finite-dimensional space
n
o
Vh = Xhr = vh ∈ C 0 (Ω̄) : vh |K ∈ Pr (), ∀K ∈ Th ,
(2.5)
where Pr denotes the polynomial functions of degree lower than or equal to r. For sake of
simplicity we suppose homogeneous Dirichlet boundary conditions, i.e. g = 0, in case g 6= 0,
it is possible to operate a lifting to ring back to the homogeneous case.
Finally, the finite dimensional problem reads: find uh ∈ Vh such that
a(uh , vh ) = F vh

v h ∈ Vh .

(2.6)

Starting from equation (2.6), it is possible to write the problems in the form of a linear
system, and it is possible to prove that under appropriate assumptions about the data and
the regularity of the exact solution u, the discrete solution uh satisfies the following error
estimates
ku − uh kL2 (Ω) ≤ Chr+1 |u|H r+1 ,

(2.7)

ku − uh kH 1 (Ω) ≤ Chr |u|H r+1 ,

(2.8)

where h denotes the characteristic size of the mesh, r the polynomial degree employed and C
is a constant independent of h and u, see e.g. [1].

2.2.2

LifeV simulation

To the aim of solving problem (2.6) using LifeV, we set Ω = (−1, 1)3 , ΓD = ∂Ω and the data
f, g, h such that the exact solution of the Poisson problem is u(x) = sin(πx)sin(πy)sin(πz).
Preamble: headers and MPI configuration
We first include the different headers containing the data structures and the algorithms we
are employing along the simulation: At first the Epetra data structures that allow the use of
MPI
• the definition of the MPI environment, that is made exploiting the Epetra framework
13

2.2. THE POISSON PROBLEM

1
2
3
4
5
6
7

CHAPTER 2. LEARNING BY EXAMPLES

#i n c l u d e 
#i f d e f EPETRA MPI
#i n c l u d e 
#i n c l u d e 
#e l s e
#i n c l u d e 
#e n d i f

• the definition of the basis structures of LifeV, in particular meshes, finite elements spaces
and expressions
1
2
3
4
5
6
7
8
9
10
11

#i n c l u d e
#i n c l u d e
#i n c l u d e
#i n c l u d e
#i n c l u d e
#i n c l u d e
#i n c l u d e
#i n c l u d e
#i n c l u d e
#i n c l u d e
#i n c l u d e

< l i f e v / c o r e / L i f e V . hpp>
< l i f e v / c o r e / u t i l / LifeChronoManager . hpp>
< l i f e v / c o r e /mesh/ M e s h P a r t i t i o n e r . hpp>
< l i f e v / c o r e /mesh/ RegionMesh3DStructured . hpp>
< l i f e v / c o r e /mesh/ RegionMesh . hpp>
< l i f e v / c o r e / a r r a y / M a t r i x E p e t r a . hpp>
< l i f e v / c o r e / fem /BCManage . hpp>
< l i f e v / e t a / fem /ETFESpace . hpp>
< l i f e v / e t a / e x p r e s s i o n / BuildGraph . hpp>
< l i f e v / e t a / e x p r e s s i o n / I n t e g r a t e . hpp>


• the definition of the solver and the exporting routines
1
2
3
4
5
6

#i n c l u d e
#i n c l u d e
#i n c l u d e
#i n c l u d e
#i n c l u d e
#i n c l u d e




< l i f e v / c o r e / a l g o r i t h m / L i n e a r S o l v e r . hpp>
< l i f e v / c o r e / a l g o r i t h m / P r e c o n d i t i o n e r I f p a c k . hpp>
< l i f e v / c o r e / f i l t e r / ExporterHDF5 . hpp>

• some other useful classes
1
2

#i n c l u d e 
#i n c l u d e < l i f e v / e t a / e x a m p l e s / l a p l a c i a n / l a p l a c i a n F u n c t o r . hpp>

Next, we define the LifeV namespace
1

u s i n g namespace L i f e V ;

Structured mesh and finite element spaces
After having read the datafile as explained in Section 2.1, we build a cubic structured
mesh and we divide it among the processors which are running the simulation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

// Mesh
typedef RegionMesh< LinearTetra > mesh_Type ;
b o o s t : : s h a r e d _ p t r < m e s h _ T y p e > f u l l M e s h P t r ( new m e s h _ T y p e ( C o m m ) ) ;
// B u i l d i n g s t r u c t u r e d mesh ( i n t h i s c a s e a cube )
regularMesh3D ( ∗ fullMeshPtr , 0 ,
d a t a F i l e ( ”mesh/ nx ” , 15 ) , d a t a F i l e ( ”mesh/ ny ” , 15 ) ,
d a t a F i l e ( ”mesh/ nz ” , 15 ) , d a t a F i l e ( ”mesh/ v e r b o s e ” ,
2 . 0 , 2 . 0 , 2 . 0 , −1.0 , −1.0 , −1.0 ) ;
// P a r t i t i o n i n g mesh , p o s s i b l y w i t h o v e r l a p
c o n s t U I n t o v e r l a p ( d a t a F i l e ( ”mesh/ o v e r l a p ” , 0 ) ) ;
boost : : shared_ptr< mesh_Type > localMeshPtr ;
MeshPartitioner< mesh_Type > meshPart ;

14

false

),

2.2. THE POISSON PROBLEM

16
17
18
19
20
21
22
23
24
25
26

if
{

CHAPTER 2. LEARNING BY EXAMPLES

( overlap )
meshPart . setPartitionOverlap ( overlap ) ;

}
meshPart . doPartition ( fullMeshPtr , Comm ) ;
localMeshPtr = meshPart . meshPartition () ;
// C l e a r i n g g l o b a l mesh
fullMeshPtr . reset () ;

We notice that the domain origins from the point (−1 − 1, −1) and has a length of 2 in
each dimension. The overlap variable states the number of layers that are shared by
two processors with contiguous subdomains.
We next define the finite element space, whose dimension is read by the input file. Then
we build the corresponding Expression Template finite element space, whose use allows
the user to adopt the templated expressions that refer to the weak formulation of the
problem.
1
2
3
4
5
6
7
8
9
10
11
12

// F i n i t e e l e m e n t s p a c e
typedef FESpace< mesh_Type , MapEpetra >
typedef boost : : shared_ptr< uSpaceStd_Type >
typedef ETFESpace< mesh_Type , MapEpetra , 3 , 1 >
typedef boost : : shared_ptr< uSpaceETA_Type >
t y p e d e f F E S p a c e  : : f u n c t i o n _ T y p e

uSpaceStd_Type ;
uSpaceStdPtr_Type ;
uSpaceETA_Type ;
uSpaceETAPtr_Type ;
function_Type ;

// D e f i n i n g f i n i t e e l e m e n t s s t a n d a r d and E x p r e s s i o n Template s p a c e s
u S p a c e S t d P t r _ T y p e u F E S p a c e ( new u S p a c e S t d _ T y p e ( l o c a l M e s h P t r ,
d a t a F i l e ( ” f i n i t e e l e m e n t / d e g r e e ” , ”P1” ) , 1 , C o m m ) ) ;
u S p a c e E T A P t r _ T y p e E T u F E S p a c e ( new u S p a c e E T A _ T y p e ( l o c a l M e s h P t r ,
& ( u F E S p a c e −>r e f F E ( ) ) , & ( u F E S p a c e −>f e ( ) . g e o M a p ( ) ) , ←Comm ) ) ;

Assembly of the stiffness matrix, the right-hand-side and the setting of
boundary conditions
In order to assembly the system that corresponds to the finite element formulation,
we need to build at first the graph that contains the topology of the matrix and then
assemblying the matrix by constructing the elements a(φj , φi )
1
2
3
4
5
6
7
8
9
10
11
12

// M a t r i c e s and g r a p h s
typedef Epetra_FECrsGraph
t y p e d e f b o o s t : : s h a r e d _ p t r 
typedef MatrixEpetra< Real >
typedef boost : : shared_ptr< MatrixEpetra< Real > >

graph_Type ;
graphPtr_Type ;
matrix_Type ;
matrixPtr_Type ;

graphPtr_Type systemGraph ;
matrixPtr_Type systemMatrix ;
if
{

( overlap )
s y s t e m G r a p h . r e s e t ( new g r a p h _ T y p e ( C o p y , ∗ ( u F E S p a c e −>m a p ( ) . m a p ( ←Unique ) ) , 50 , true ) ) ;

13
14
15
16

}
else
{

17
18
19
20
21
22
23
24

}

s y s t e m G r a p h . r e s e t ( new g r a p h _ T y p e ( C o p y , ∗ ( u F E S p a c e −>m a p ( ) . m a p ( ←U n i q u e ) ) , 50 ) ) ;
{
u s i n g namespace E x p r e s s i o n A s s e m b l y ;
buildGraph (
elements ( localMeshPtr ) ,
u F E S p a c e −>q r ( ) ,

15

2.2. THE POISSON PROBLEM

25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57

ETuFESpace ,
ETuFESpace ,
dot ( grad ( phi_i )

CHAPTER 2. LEARNING BY EXAMPLES

, grad ( phi_j ) )

)
>> s y s t e m G r a p h ;
}
s y s t e m G r a p h −>G l o b a l A s s e m b l e ( ) ;
i f ( overlap )
{
s y s t e m M a t r i x . r e s e t ( new m a t r i x _ T y p e ( E T u F E S p a c e −>m a p ( ) , ∗ s y s t e m G r a p h , t r u e ) ←);
}
else
{
s y s t e m M a t r i x . r e s e t ( new m a t r i x _ T y p e ( E T u F E S p a c e −>m a p ( ) , ∗ s y s t e m G r a p h ) ) ;
}
// C l e a r i n g problem s m a t r i x
s y s t e m M a t r i x −>z e r o ( ) ;
{
u s i n g namespace E x p r e s s i o n A s s e m b l y ;
integrate (
elements ( localMeshPtr ) ,
u F E S p a c e −>q r ( ) ,
ETuFESpace ,
ETuFESpace ,
dot ( grad ( phi_i ) , grad ( phi_j ) )
)
>> s y s t e m M a t r i x ;
}

Next, we build the solution and the right hand side vectors. For the latter, we employ the
laplacianFunctor class, that is constructed by providing the function that describes
the source term
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

// V e c t o r s
typedef VectorEpetra
t y p e d e f b o o s t : : s h a r e d _ p t r 

vector_Type ;
vectorPtr_Type ;

vectorPtr_Type rhsLap ;
vectorPtr_Type solutionLap ;
if
{

( overlap )
r h s L a p . r e s e t ( new v e c t o r _ T y p e ( u F E S p a c e −>m a p ( ) , U n i q u e , Z e r o ) ) ;
s o l u t i o n L a p . r e s e t ( new v e c t o r _ T y p e ( u F E S p a c e −>m a p ( ) , U n i q u e , Z e r o ) ) ;

}
else
{
r h s L a p . r e s e t ( new v e c t o r _ T y p e ( u F E S p a c e −>m a p ( ) , U n i q u e ) ) ;
s o l u t i o n L a p . r e s e t ( new v e c t o r _ T y p e ( u F E S p a c e −>m a p ( ) , U n i q u e ) ) ;
}
r h s L a p −>z e r o ( ) ;
s o l u t i o n L a p −>z e r o ( ) ;
R e a l s o u r c e F u n c t i o n ( c o n s t R e a l& /∗ t ∗/ , c o n s t R e a l& x ,
c o n s t R e a l& y , c o n s t R e a l& z ,
c o n s t I D& /∗ i ∗/ )
{
return 3 ∗ M_PI ∗ M_PI
∗ sin ( M_PI ∗ x )
∗ sin ( M_PI ∗ y ) ∗ sin ( M_PI ∗ z ) ;
}
b o o s t : : s h a r e d _ p t r  > l a p l a c i a n S o u r c e F u n c t o r ( new ←l a p l a c i a n F u n c t o r < R e a l >( s o u r c e F u n c t i o n ) ) ;
{
u s i n g namespace E x p r e s s i o n A s s e m b l y ;
integrate (
elements ( localMeshPtr ) ,

16

2.2. THE POISSON PROBLEM

37
38
39
40
41
42

CHAPTER 2. LEARNING BY EXAMPLES

u F E S p a c e −>q r ( ) ,
ETuFESpace ,
eval ( laplacianSourceFunctor , X ) ∗ phi_i
)
>> r h s L a p ;
}

We remark here that the use of the expression templates allows the user to define the
equivalent of the weak formulation, in particular the elements of the matrix are built
using the test and trial functions phii and phij , and setting the quadrature rule to adopt.
Boundary conditions
We explain here how to impose the boundary conditions. At first we give an identification
number to the faces of our domain, and then define the function g that is assigned to the
boundarues, in this case we have homogeneous Dirichlet conditions, so we construct the
function zeroFunction that returns 0. for every value of the spatial domain. In LifeV,
it is possible to impose the boundaries through a BCHandler object, which imposes on
every boundary the corresponding Dirichlet datum by providing the keyword Essential.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

// Cube s
const int
const int
const int
const int
const int
const int

walls
BACK
FRONT
LEFT
RIGHT
BOTTOM
TOP

identifiers
= 1;
= 2;
= 3;
= 4;
= 5;
= 6;

R e a l z e r o F u n c t i o n ( c o n s t R e a l& /∗ t ∗/ , c o n s t R e a l& /∗ x ∗/ , c o n s t R e a l& /∗ y ∗/ , ←c o n s t R e a l& /∗ z ∗/ , c o n s t I D& /∗ i ∗/ )
{
return 0 . ;
}
BCHandler bcHandler ;
BCFunctionBase ZeroBC ( zeroFunction ) ;
BCFunctionBase OneBC ( nonZeroFunction ) ;
bcHandler
bcHandler
bcHandler
bcHandler
bcHandler
bcHandler

.
.
.
.
.
.

addBC (
addBC (
addBC (
addBC (
addBC (
addBC (

” Back ” ,
” Left ” ,
”Top” ,
” Front ” ,
” Right ” ,
” Bottom ” ,

BACK ,
LEFT ,
TOP ,
FRONT ,
RIGHT ,
BOTTOM ,

Essential
Essential
Essential
Essential
Essential
Essential

,
,
,
,
,
,

Scalar
Scalar
Scalar
Scalar
Scalar
Scalar

,
,
,
,
,
,

ZeroBC
ZeroBC
ZeroBC
ZeroBC
ZeroBC
ZeroBC

,
,
,
,
,
,

1
1
1
1
1
1

);
);
);
);
);
);

b c H a n d l e r . b c U p d a t e ( ∗ u F E S p a c e −>m e s h ( ) , u F E S p a c e −>f e B d ( ) , u F E S p a c e −>d o f ( ) ) ;
b c M a n a g e ( ∗ s y s t e m M a t r i x , ∗ r h s L a p , ∗ u F E S p a c e −>m e s h ( ) , u F E S p a c e −>d o f ( ) ,
b c H a n d l e r , u F E S p a c e −>f e B d ( ) , 1 . 0 , 0 . 0 ) ;

Preconditioning and solving the system
Since our computation employs a parallel architecture. before solving the linear system
we need to assemble both the matrix and the right hand side
1
2

s y s t e m M a t r i x −>g l o b a l A s s e m b l e ( ) ;
r h s L a p −>g l o b a l A s s e m b l e ( ) ;

Next we set the solver parameters according to the input file SolverParamList.xml and
the preconditioner that employs the Additive Schwarz method
1

// S o l v e r and p r e c o n d i t i o n e r

17

2.2. THE POISSON PROBLEM

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

typedef
typedef
typedef
typedef
typedef

CHAPTER 2. LEARNING BY EXAMPLES

LinearSolver : : SolverType
LifeV : : Preconditioner
b o o s t : : s h a r e d _ p t r 
PreconditionerIfpack
b o o s t : : s h a r e d _ p t r 

solver_Type ; basePrec_Type ; basePrecPtr_Type ; prec_Type ; precPtr_Type ; LinearSolver linearSolver ( Comm ) ; linearSolver . setOperator ( systemMatrix ) ; T e u c h o s : : RCP< T e u c h o s : : P a r a m e t e r L i s t > a z t e c L i s t = T e u c h o s : : r c p ( new T e u c h o s ←: : ParameterList ) ; a z t e c L i s t = T e u c h o s : : g e t P a r a m e t e r s F r o m X m l F i l e ( ” S o l v e r P a r a m L i s t . xml ” ) ; linearSolver . setParameters ( ∗ aztecList ) ; prec_Type ∗ precRawPtr ; basePrecPtr_Type precPtr ; p r e c R a w P t r = new p r e c _ T y p e ; p r e c R a w P t r −>s e t D a t a F r o m G e t P o t ( d a t a F i l e , ” p r e c ” ) ; precPtr . reset ( precRawPtr ) ; linearSolver . setPreconditioner ( precPtr ) ; And finally we solve the system 1 2 linearSolver . setRightHandSide ( rhsLap ) ; linearSolver . solve ( solutionLap ) ; Exporting and post processing We set the exporter that employs the library HDF5, the result is then visible using a post processing tool, for instance Paraview (http://www.paraview.org/). 1 2 3 4 5 6 7 8 // S e t t i n g e x p o r t e r ExporterHDF5< mesh_Type > exporter ( exporter . setMeshProcId ( localMeshPtr , exporter . setPrefix ( ” laplace ” ) ; exporter . setPostDir ( ” ./ ” ) ; exporter . addVariable ( ExporterData< uFESpace , solutionLap , UInt ( 0 exporter . postProcess ( 0 ) ; exporter . closeFile () ; dataFile , ” exporter ” ) ; C o m m−>M y P I D ( ) ) ; mesh_Type ) ); > : : S c a l a r F i e l d , ” t e m p e r a t u r e ” , ←- Now, suppose we want to investigate the trend of the error by varying the mesh size, to check numerically the estimates (2.7), (2.8). At first, we need to define the function u and its gradient ∇u in our program, in the same way we defined the source term f 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 R e a l u E x a c t F u n c t i o n ( c o n s t R e a l& /∗ t ∗/ , c o n s t R e a l& x , c o n s t R e a l& y , c o n s t ←R e a l& z , c o n s t I D& /∗ i ∗/ ) { return sin ( M_PI ∗ y ) ∗ sin ( M_PI ∗ z ) ∗ sin ( M_PI ∗ x ) ; } function_Type uEx ( uExactFunction ) ; V e c t o r S m a l l < 3 > u G r a d E x a c t F u n c t i o n ( c o n s t R e a l& /∗ t ∗/ , c o n s t R e a l& x , c o n s t ←R e a l& y , c o n s t R e a l& z , c o n s t I D& /∗ i ∗/ ) { VectorSmall< 3 > v ; v [ 0 ] = M_PI ∗ cos ( M_PI ∗ x ) ∗ sin ( M_PI ∗ y ) ∗ sin ( M_PI ∗ z ) ; v [ 1 ] = M_PI ∗ sin ( M_PI ∗ x ) ∗ cos ( M_PI ∗ y ) ∗ sin ( M_PI ∗ z ) ; v [ 2 ] = M_PI ∗ sin ( M_PI ∗ x ) ∗ sin ( M_PI ∗ y ) ∗ cos ( M_PI ∗ z ) ; return v ; } 18 2.2. THE POISSON PROBLEM CHAPTER 2. LEARNING BY EXAMPLES Figure 2.1: Result of Poisson equation with homogeneous Dirichlet boundary conditions 19 20 b o o s t : : s h a r e d _ p t r > l a p l a c i a n E x a c t F u n c t o r ( new ←l a p l a c i a n F u n c t o r < R e a l >( u E x a c t F u n c t i o n ) ) ; b o o s t : : s h a r e d _ p t r > > ←l a p l a c i a n E x a c t G r a d i e n t F u n c t o r ( new l a p l a c i a n F u n c t o r < V e c t o r S m a l l <3> >( ←uGradExactFunction ) ) ; Next, we need to evaluate the norms following their definition, and to do that we still employ the Expression Templates provided in LifeV 1 2 3 4 5 6 7 8 9 10 11 12 13 Real L2ErrorLap = 0 . 0 ; Real TotL2ErrorLap = 0 . 0 ; Real H1SeminormLap = 0 . 0 ; Real TotH1SeminormLap = 0 . 0 ; { u s i n g namespace E x p r e s s i o n A s s e m b l y ; integrate ( elements ( localMeshPtr ) , u F E S p a c e −>q r ( ) , ( e v a l ( l a p l a c i a n E x a c t F u n c t o r , X ) − v a l u e ( E T u F E S p a c e , ∗←solutionLap ) ) ∗ ( e v a l ( l a p l a c i a n E x a c t F u n c t o r , X ) − v a l u e ( E T u F E S p a c e , ∗←solutionLap ) ) ) >> L 2 E r r o r L a p ; 14 15 16 17 18 19 20 21 22 23 24 } { u s i n g namespace E x p r e s s i o n A s s e m b l y ; integrate ( elements ( localMeshPtr ) , u F E S p a c e −>q r ( ) , 19 2.2. THE POISSON PROBLEM 10 1 CHAPTER 2. LEARNING BY EXAMPLES 10 0 H1-Error-P1 H1-Error-P2 L2-Error-P1 L2-Error-P2 10 -1 10 0 10 -2 10 -1 10 -3 10 -2 10 0 10 1 10 -4 10 0 10 1 Figure 2.2: H 1 norm (left) and L2 norm (right) vs mesh size for r = 1, 2. d o t ( e v a l ( l a p l a c i a n E x a c t G r a d i e n t F u n c t o r , X ) − g r a d ( E T u F E S p a c e , ∗←solutionLap ) , e v a l ( l a p l a c i a n E x a c t G r a d i e n t F u n c t o r , X ) − g r a d ( E T u F E S p a c e , ∗←solutionLap ) ) ) >> H 1 S e m i n o r m L a p ; 25 26 27 28 29 30 } C o m m−>B a r r i e r ( ) ; Finally, we gather the results of the different processors and print the norm. We collect the results for different mesh sizes and perform a convergence analysis, whose results are shown in Fig. 2.2. 1 2 3 4 5 6 7 8 9 10 C o m m−>S u m A l l (& L 2 E r r o r L a p , &T o t L 2 E r r o r L a p , 1 ) ; C o m m−>S u m A l l (& H 1 S e m i n o r m L a p , &T o t H 1 S e m i n o r m L a p , 1 ) ; if { ( verbose ) s t d : : c o u t << << s t d : : c o u t << << ” T o t E r r o r i n L2 norm i s ” s q r t ( T o t L 2 E r r o r L a p ) << s t d : : e n d l ; ” T o t E r r o r i n H1 norm i s ” s q r t ( T o t L 2 E r r o r L a p + T o t H 1 S e m i n o r m L a p ) << s t d : : e n d l ; } 20 Bibliography [1] A. Quarteroni. Numerical Models for Differential Problems. Modeling, Simulation and Applications. Springer, Heidelberg, DE, 2009. Written for students of bachelor and master courses in scientific disciplines: engineering, mathematics, physics, computational sciences, and information science. 21


Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.5
Linearized                      : No
Page Count                      : 22
Page Mode                       : UseOutlines
Author                          : 
Title                           : 
Subject                         : 
Creator                         : LaTeX with hyperref package
Producer                        : pdfTeX-1.40.15
Create Date                     : 2015:02:20 16:33:27+01:00
Modify Date                     : 2015:02:20 16:33:27+01:00
Trapped                         : False
PTEX Fullbanner                 : This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2015/dev/Debian) kpathsea version 6.2.1dev
EXIF Metadata provided by EXIF.tools

Navigation menu