← Back to team overview

dolfin team mailing list archive

Re: NonlinearProblem vs. VariationalProblem

 

In a totally blind guess, I believe that for a nonlinear problem, the linear
form used to require a minus sign (DOLFIN 0.8), but now (DOLFIN 0.9+) the
minus sign is built into NewtonSolver.  You might want to check that first.

Jake


On 5/1/09 3:09 AM, "Patrick Riesen" <priesen@xxxxxxxxxxxxxxx> wrote:

> 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());
> _______________________________________________
> DOLFIN-dev mailing list
> DOLFIN-dev@xxxxxxxxxx
> http://www.fenics.org/mailman/listinfo/dolfin-dev
> 




Follow ups

References