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
Forms and Solver

We suppose in this section that you know how to define your mesh (see Meshes) and your function spaces (see Function Spaces). You may need integrations tools too (see Integrations, Operators and Norms ).

There are Feel++ tools you need to create linear and bilinear forms in order to solve variatonnal formulation.

Notations :

  • u : element from your trial function space (unknown function)
  • v : element from your test function space

Building Forms

form1

Interface :

form1(_test, _init);

Required Parameters :

  • _test : test function space.

Optional Parameters :

  • _init : Default = false.

By default, a new linear form is :

\[ l(v)=\int_\Omega v \]

Then you can custom it using integrations tools.

Examples :
From "doc/manual/tutorial/mylaplacian.cpp" :

// right hand side
auto l = form1( _test=Vh );
l = integrate(_range=elements(mesh),
_expr=id(v));

From "doc/manual/tutorial/myadvection.cpp" :

// right hand side
auto l = form1( _test=Xh );
l += integrate( _range=elements( mesh ),
_expr=f*id( v ) );

Notice that += operator is working with linear and bilinear forms.

form2

Interface :

form2(_trial, _test, _init);

Required Parameters :

  • _trial : test function space
  • _test : trial function space

Optional Parameters :

  • _init : Default = false.

By default, a new bilinear form is :

\[ a(u,v)=\int_\Omega uv \]

Then you can custom it using integrations tools

From "doc/manual/tutorial/mylaplacian.cpp" :

// left hand side
auto a = form2( _trial=Vh, _test=Vh );
a = integrate(_range=elements(mesh),
_expr=gradt(u)*trans(grad(v)) );

From "doc/manual/tutorial/mystokes.cpp" :

// left hand side
auto a = form2( _trial=Vh, _test=Vh );
a = integrate(_range=elements(mesh),
_expr=trace(gradt(u)*trans(grad(u))) );
a += integrate(_range=elements(mesh),
_expr=-div(u)*idt(p)+divt(u)*id(p));

Notice that += operator is working with linear and bilinear forms.

top


Solver

In this section we present syntax to solve variational formulations. For more general linear problems see Linear Algebra.

solve

Once you created your linear and bilinear forms you can use the solve() function on your bilinear form.
The solve() function presented there is a method from the class BilinearForm.
Interface :

solve(_solution, _rhs, _rebuild, _name);

Required Parameters :

  • _solution : the solution.
  • _rhs : right hand side. The linear form.

Optional Parameters :

  • _rebuild : rebuild the solver matrix. Default = false.
  • _name : Default = "".

Examples :
From "doc/manual/tutorial/laplacian.cpp" :

a.solve(_rhs=l,_solution=u);

Solve the linear problem $a(u,v)=l(v)$.

on

The function on() allows you to add conditions to your bilinear form before using the solve function.
Interface :

on(_range, _rhs, _element, _expr);

Required Parameters :

  • _range : domain concerned by this condition (see Integrations, Operators and Norms ).
  • _rhs : right hand side. The linear form.
  • _element : element concerned.
  • _expr : the condition.

This function is used with += operator.

Examples :
From "doc/manual/tutorial/mylaplacian.cpp" :

// apply the boundary condition
a+=on(_range=boundaryfaces(mesh),
_rhs=l, _element=u,
_expr=constant(0.) );

There we add the condition : $ u = 0 \text{ on }\;\partial\Omega \;$.

From "doc/manual/tutorial/mystokes.cpp" :

a+=on(_range=markedfaces(mesh,"inlet"),
_rhs=l, _element=u,
_expr=vec(Py()*(1-Py()),cst(0.)));
a+=on(_range=markedfaces(mesh,"wall"),
_rhs=l, _element=u,
_expr=vec(cst(0.),cst(0.)));

There we add the conditions $ u=\left( \begin{aligned} y(1-y) \\ 0 \\ \end{aligned} \right) $ on the face identified by "inlet" and $ u=\left( \begin{aligned} 0 \\ 0 \\ \end{aligned} \right) $ on the face identified by "wall".

top



Generated on Fri Oct 25 2013 14:24:27 for Feel++ by doxygen 1.8.4