This part explains how to solve the Laplacian equation for homogeneous dirichlet conditions,
where is the unknown "trial" function and
the domain.
We multiply each part of the first equation by a "test" function and we integrate the resulting equation on the domain
,
We can integrate by parts this equation (Green Theorem) to obtain the variationnal formulation,
where denotes a unit outward normal vector to the boundary. We can rewrite the problem as find
such that for all
,
where is a bilinear form, continuous, coercive and
a linear form.
Let's take a look at the Feel++ code (source "doc/manual/tutorial/mylaplacian.cpp"
).
We consider for this example constant.
As you can see, the program looks very close to the mathematical formulation.
We use the form2()
function to define the bilinear form and form1()
for the linear one (see Forms and Solver ).
The gradient for the trial functions is declared with the gradt()
expression where as grad()
is used for the test functions (see Keywords). Note that we need to transpose the second vector to perform the scalar product.
To introduce the homogeneous dirichlet conditions on the boundary, we use the function on()
. Once the variationnal formulation and the boundary conditions are set, we call the solver with solve()
.