← Back to team overview

dolfin team mailing list archive

Function design

 

I'm running into some problems with the new Function design when trying to update a solver. I'll try to sketch the issue as simply as possible.

    Function v;
    Function u, p;

    // First form for U = (u, p)
    FirstBilinearForm a_1(V1, V1);
    FirstLinearForm   L_1(V1);
    LinearPDE pde_first(a_1, L_1);

    // Second form which depends on u
    SecondBilinearForm a_2(V2, V2);
    SecondLinearForm   L_2(V2, u);
    LinearPDE pde_second(a_2, L_2);

    Function U;
    for(uint i = 0; i < 10; ++i)
    {
      pde_first.solve(U);

      // This step breaks down because FunctionSpaces don't match
      u = U[0];
      p = U[1];

      pde_second.solve(v);
    }

The problem is in assigning Functions since we now check the FunctionSpace.

To get around this, I tried

    FunctionSpace V(mesh);
    Function U(V);
    Function u = U[0];
    Function p = U[1];

which throws an exception because U does not have a vector.

Any suggestions on how to address this? Should we have a function that allows assignment of a Function irrespective of the Function space (Function::assign(const Function&))?

Garth


Follow ups