Successive iterations of adaptive solve do not pass new mesh to dual problem

Issue #575 new
Former user created an issue

Hi again,

I have another issue with multiple adaptive solutions of the same problem. The code structure is like this

LinearVariationalProblem p(...);
while(...)
{
    // do stuff
    GoalFunctional M(mesh);
    AdaptiveLinearVariationalSolver s(p,M);
    s.solve(tol);
    mesh = mesh->leaf_node_shared_ptr();
}

What I see is the following progress output

#!

**** while loop iteration 1 ****
Solving variational problem adaptively
Adaptive iteration 0
Stage 0.0: Solving primal problem...
  Solving linear variational problem.
    Solving linear system of size 51 x 51 (PETSc LU solver, petsc).
  Evaluating goal functional.
  Value of goal functional is 8.8519.
Stage 0.1: Computing error estimate...
  Solving dual problem.
  Solving linear variational problem.
    Solving linear system of size 51 x 51 (PETSc LU solver, petsc).
  [...]
  Error estimate is 0.000118719 (tol = 0.0001).
  [on to next iteration...]
Adaptive iteration 1
Stage 1.0: Solving primal problem...
  Solving linear variational problem.
    Solving linear system of size 61 x 61 (PETSc LU solver, petsc).
 [...] 

Error estimate (8.89325e-05) is less than tolerance (0.0001), returning.

**** while loop iteration 2 ****

Solving variational problem adaptively
Adaptive iteration 0
Stage 0.0: Solving primal problem...
  Solving linear variational problem.
    Solving linear system of size 61 x 61 (PETSc LU solver, petsc).
  Value of goal functional is 8.85206.
Stage 0.1: Computing error estimate...
  Solving dual problem.
  Solving linear variational problem.
    Computed bounding box tree with 191 nodes for 96 entities.
    Solving linear system of size 51 x 51 (PETSc LU solver, petsc).
  Extrapolating dual solution.
  Assembling error estimate.
  Error estimate is -0.0267009 (tol = 0.0001).
Stage 0.2: Computing error indicators...
  Computing residual representation.
    Computing cell residual representation.
    Computing facet residual representation.
terminate called after throwing an instance of 'std::runtime_error'
  what():  

*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
***
***     fenics@fenicsproject.org
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------------------------------------------------------------------------
*** Error:   Unable to assemble form.
*** Reason:  Dim 0 of tensor does not match form.
*** Where:   This error was encountered inside AssemblerBase.cpp.
*** Process: 0
*** 
*** DOLFIN version: 1.6.0dev
*** Git changeset:  d266ef5107f3f804fa92d15c60cbd2b4d7239436
*** -------------------------------------------------------------------------

So, what clearly isn't right here is that at the second iteration the primal problem is on the new mesh, and the linear system is of size 61x61, whereas the dual problem is still using the old mesh, and accordingly its linear system is of size 51x51.

Any help greatly appreciated :)

Comments (5)

  1. Former user Account Deleted reporter

    Luckily, this time I can! I was able to reproduce it starting from the demo "auto_adaptive_poisson", with just a few changes. I attach it.

    Actually, I am aware that if I move the AdaptiveLinearVariationalSolver instantiation outside the loop it works as expected, but my problem is that in the "// do stuff" part of the code one of the coefficients of the bilinear form is computed and assigned to it. What I noticed is that if I create the AdaptiveLinearVariationalSolver outside the loop then the coefficient that I assign inside the loop is not assigned to the dual form as well [and I get the relative error].

    I also attach a modified version of the corresponding c++ demo in which I assign a coefficient inside the loop and it shows that the dual form doesn't get it.

  2. Former user Account Deleted reporter

    Hi, were you able to reproduce it? Is there any easy workaround that I am missing?

    I also thought of trying to fix it myself, but I am not sure how to modify and recompile dolfin, as the installer is a user unfriendly blackbox and I don't know where/what to touch... Is there a developer guide anywhere?

  3. Log in to comment