This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Number of arguments to LinearVariationalProblem

0 votes

Hello All,

According to the tutorial, I need not specify the boundary conditions when calculating the gradient of a scalar. However, this brings up a compilation error:

error: no matching function for call to ‘dolfin::LinearVariationalProblem::LinearVariationalProblem(std::shared_ptr<Gradient::Form_a>&, std::shared_ptr<Gradient::Form_L>&, std::shared_ptr<dolfin::Function>&)’

So what is the right way to calculate the gradient? Is the documentation wrong?

This (adding the boundary condition) works :

L2->u = w;
auto wpf_problem = std::make_shared<LinearVariationalProblem>( _a_g , L2 , _w_f_grad,dp_bc);

and this (without the boundary conditions) does not work:

L2->u = w;
auto wpf_problem = std::make_shared<LinearVariationalProblem>( _a_g , L2 , _w_f_grad);

Here w is the solution to $$ -\nabla^2 \varphi(r) = 0 $$ , and I am interested in finding its gradient. Thanks.

Victor.

asked Aug 26, 2016 by wtpot FEniCS Novice (450 points)
...