← Back to team overview

dolfin team mailing list archive

NonlinearProblem vs. VariationalProblem

 

hello!

i want to update my powerlaw solver from dolfin 0.8 to dolfin 0.9.2.
the solver class is derived from the NonlinearProblem class and i followed the CahnHillard-demo to do something similar for updating from 0.8 to 0.9.2.

However I have a problem which i do not understand:

If i hand the created forms to VariationalProblem and let it solve, all works fine and in the second iteration the newton solver converges (if i initialize a newtonian problem just for checking).

if i do

newtonsolver.solve(*this,uu->vector());

the problem gets solved as well, i.e. all bcs and my own void F and void J get called but it does not converge, it's like the problem gets solved over and over again and the solution is added, because in the end i get a solution but it's the number of iterations \times velocity.

i tried all kinds of things (with/without pointers, no cast/cast, different classes for problem/solve ...) but i don't get it, i miss something.

maybe somebody has a hint or does see my error and can help me turn on the light?

many thanks in advance

patrick


below is a code snippet of the main part:
/-------------------------------------------------------------------------------
  _uu = new Function(*_V);
  Function* __uu = dynamic_cast<Function*>(_uu);

  // create the forms
  a_powstokes = new PowerlawStokesBilinearForm(*_V,*_V);
PowerlawStokesBilinearForm* _a_powstokes = dynamic_cast<PowerlawStokesBilinearForm*>(a_powstokes);
  _a_powstokes->w0 = *__uu;
  _a_powstokes->eta1 = eta;
  _a_powstokes->eta2 = d_eta;


  L_powstokes = new PowerlawStokesLinearForm(*_V);
PowerlawStokesLinearForm* _L_powstokes = dynamic_cast<PowerlawStokesLinearForm*>(L_powstokes);
  _L_powstokes->w0 = *__uu;
  _L_powstokes->eta1 = eta;
  _L_powstokes->f = f;

//   VariationalProblem pde(*a_powstokes, *L_powstokes, bcs, true);
//   pde.solve(fluid.velocity(),fluid.pressure());

  newtonsolver.solve(*this,__uu->vector());


Follow ups