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. We solve for the laplacian with Dirichlet boundary conditions.
We want to solve the following problem:
\[ - \Delta u = 1,\quad u_{|\partial \Omega} = g \]
where \(\Omega \in \mathbb{R}^n, n\in{1,2,3}\).
The variational form reads: looks for \(u \in H^1_g\left( \Omega \right) = \{ v \in H^1(\Omega) | v = g \mbox{ on } \partial \Omega \}\) such that
\[a\left( u,v \right) = l\left( v \right)\quad \forall v \in H^1\left( \Omega \right).\]
with:
\[a\left( u,v \right) = \int_{\Omega} \nabla u \cdot \nabla v ,\quad l\left( v \right) = \int_{\Omega} v \]
The aim of Feel++ is to provide the simplest way to write the \(a\) and \(l\) forms.
From a discrete point of view, we introduce \(V_h\subset H^1\left( \Omega \right)\) such that:
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:
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).
We have to define the mesh, the approximation space and our test and trial functions.
We create now our bilinear and linear forms, we add the homogeneous Dirichlet conditions and solve the discretized (linear) system.
Feel++ provides the possibility to save the results:
To test that part of code, please go to:
cd $FeelppBuildDir/quickstart
and execute the code, by:
./feelpp_qs_laplacian
This will produce several files in directory $HOME/feel/qs_laplacian/np_1/
:
feel.geo feel.msh qs_laplacian-1_0.case qs_laplacian-1_0.geo qs_laplacian-1.sos qs_laplacian-paraview-1.sos qs_laplacian.timeset qs_laplacian.u-1_0.001
You can visualize the results using any Ensight file reader, such as Paraview, opening qs_laplacian-paraview-1.sos
.
paraview qs_laplacian-paraview-1.sos
You may have a look to the options provided by the application
./feelpp_qs_laplacian --help
as well as the options provided by the Feel++ library
./feelpp_qs_laplacian --help-lib