Hello All,
I am trying to compute the derivative of a function (with C++).
My code is as follows:
auto problem1 = std::make_shared<LinearVariationalProblem>(a, L, w, bcs);
...
solver.solve(); // This works fine.
// Now I need to calculate the derivative of w
auto V1 = std::make_shared<Gradient::FunctionSpace>(mesh);
auto _a_g = std::make_shared<Gradient::BilinearForm>(V1,V1);
auto _L_g = std::make_shared<Gradient::LinearForm>(V1);
auto gw = std::make_shared<Function>(V1);
_L_g->u = wp;
// Solve:
auto problem2 = std::make_shared<LinearVariationalProblem>( _a_g , _L_g , gw,bcs);
LinearVariationalSolver dp_solver1(problem2);
dp_solver1.parameters["linear_solver"]="mumps";
dp_solver1.solve();
However solving problem2 works on one computer , and fails on another with this error message:
Error: Unable to define linear variational problem a(u, v) = L(v) for all v.
Reason: Expecting the boundary conditions to to live on (a subspace of) the trial space.
Where: This error was encountered inside LinearVariationalProblem.cpp.
Process: 0
DOLFIN version: 2016.2.0.dev0
Git changeset: b84974e3d89bccf46d165692b5f8c02a9f967c6f
My efl file is as follow:
vector_element = VectorElement("Lagrange", tetrahedron , 1)
element = FiniteElement("Lagrange", tetrahedron , 1)
u = Coefficient(element)
w = TrialFunction(vector_element)
v = TestFunction(vector_element)
a = inner(w, v)*dx
L = inner(grad(u), v)*dx
Can anyone point out what is wrong?
Thanks for the help.
Victor.