Logo  0.95.0-final
Finite Element Embedded Library and Language in C++
Feel++ Feel++ on Github Feel++ community
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Crash Course
Author
Vincent Huber

This chapter is designed for impatient people who wants to test Feel++ as soon as possible.

Requirements

Before installing Feel++, you need to get this required packages :

  • g++ (4.4, 4.5, 4.6, 4.7 or higher) OR Clang (3.1 or higher)
  • MPI : openmpi (preferred) or mpich
  • Boost (1.39 or higher)
  • Petsc (2.3.3 or higher)
  • Cmake (2.6 or higher)
  • Gmsh (can be found at http://www.geuz.org/gmsh)
  • Libxml2 It is assumed that all this packages are properly installed.

Building Feel++

Feel++ is distributed as a tarball once in a while. The tarballs are available at

http://code.google.com/p/feelpp/downloads/list

Download the latest tarball. Then follow the steps and replace x, y, z with the corresponding numbers

  tar xzf feel-x.y.z.tar.gz
  cd feel-x.y.z

We define then the current directory as the source one, ie:

  export FeelppSrcDir=`pwd`

top


Compiling

Please, notice that 4 Gbytes of RAM is a minimum to make Feel++ compiling (with GCC), with clang, the memory footprint is much lower.

In order to compile Feel++ and a test application, we create a new directory:

  mkdir build
  cd build
  export buildDir=`pwd`


and then, we are able to compile our first application:

  cd $buildDir
  cmake $FeelppSrcDir
  make -j4


This procedure will build the entire librarie (with DebWithRelInfo option) and a dummy program to presents the Feel++'s abilities.

There is a procedure to install as a system librarie Feel++.

  make install

See chapter 2 for more details.

top


Feel++ Hello World

As an introduction to the aim and the way to do with Feel++, we provide a sort of Hello World program to evaluate the library.

About the math

We want to solve the simplest problem:

$ \begin{aligned} - \Delta u &= 1,\\ u_{|\partial \Omega} &= 0, \end{aligned} $


where $\Omega \in \mathbb{R}^n, n\in{1,2,3}$.

That problem written in variational form is:
looks for $v\in H^1\left( \Omega \right)$

$ \begin{aligned} a\left( u,v \right)&=l\left( v \right)\\ \forall v &\in H^1\left( \Omega \right). \end{aligned} $


with:

$ \begin{aligned} a\left( u,v \right)&=\int_{\Omega} \nabla u \cdot \nabla v ,\\ l\left( v \right) &= \int_{\Omega} v . \end{aligned} $


The aim of Feel++ is to provide the simplest way to write the $a$ and $f$ forms.

From a discrete point of view, we introduce $V_h\subset H^1\left( \Omega \right)$ such that:

$ \begin{aligned} V_h = \left\{ v \in C^0\left( \Omega \right), \forall K\in \mathcal{T}_h, \right.v\left|_K \in P_1\left( K \right) \right\}, \end{aligned} $


where $\mathcal{T}_h$ is the set of element $K$ forming the mesh of $\Omega$.
We now look for $u_h \in V_h$ such that:

$ \begin{aligned} \forall v_h\in V_h, a\left( u_h,v_h \right)=l\left( v_h \right). \end{aligned} $


About the code

This section is here to declare that we want to use the namespace Feel++, to passe the command line options to the created environnement and add some informations (basics Feel++ options, application name).

using namespace Feel;
Environment env( _argc=argc, _argv=argv,
_desc=feel_options(),
_directory=".",
_about=about(_name="qs_laplacian",
_author="Feel++ Consortium",
_email="feelpp-devel@feelpp.org"));

We have to define the mesh, the approximation space and our test and trial functions.

auto mesh = unitSquare();
auto Vh = Pch<1>( mesh );
auto u = Vh->element();
auto v = Vh->element();

We create now our bilinear and linear forms, we add the homogeneous Dirichlet conditions and solve the discretized (linear) system.

auto l = form1( _test=Vh );
l = integrate(_range=elements(mesh),
_expr=id(v));
auto a = form2( _trial=Vh, _test=Vh );
a = integrate(_range=elements(mesh),
_expr=gradt(u)*trans(grad(v)) );
a+=on(_range=boundaryfaces(mesh), _rhs=l, _element=u,
_expr=constant(0.) );
a.solve(_rhs=l,_solution=u);

Feel++ provides the possibility to save the results:

auto e = exporter( _mesh=mesh );
e->add( "u", u );
e->save();
return 0;

top


First execution & vizualisation

To test that part of code, please go to:

  cd $FeelppSrcDir/quickstart

and execute the code, by:

  ./feelpp_qs_laplacian

This will produce several files:

  qs_laplacian-1_0.case
  qs_laplacian-1.sos
  qs_laplacian.timeset
  qs_laplacian.u-1_0.001
  qs_laplacian-1_0.geo001
  qs_laplacian.pid-1_0.001
  square.geo
  square.msh

You can vizualise the results using any Ensight file reader, such as Paraview, opening =qs_laplacian-1.sos=.

  paraview qs_laplacian-1.sos

You may have a look to the differents option provided by

  ./feelpp_qs_laplacian --help

Generated on Sun Dec 22 2013 13:11:16 for Feel++ by doxygen 1.8.5