← Back to team overview

dolfin team mailing list archive

Re: NonlinearProblem vs. VariationalProblem

 

Check that you're applying the Dirichlet boundary conditions correctly, i.e. using

void apply(GenericMatrix& A, GenericVector& b, const GenericVector& x) const;

which is for applying bcs within Newton iterations.

Garth

Patrick Riesen wrote:
Hi

so i corrected my form-file for the new representation of L = F and a = (F')u. However the solving still repeats and does not converge, the problem remains.

i don't know if it has to with L being expected as a nonlinear form but my L = F is actually linear in u?

it is linear in u because i put the nonlinear part ( the computation of the variable viscosity ) in another form file, so in the main form file (hence in L) i only have something like

eta*dot(D(v),D(u))       (D() is the symmetric part of grad(u))

and eta = trace(mult(D(u),D(u))^(exponent) i get from somewhere else.

patrick




Anders Logg wrote:
Yes, the bilinear form should be the linearized nonlinear form (not
minus).

Note that with UFL, it's now possible to just write down the nonlinear
form

  (v, F(u)) = 0 for all v

and then let UFL compute the linearization.



------------------------------------------------------------------------

__> ouuuuu, this might be the lucky guess, i wasn't aware of that...

Ostien, Jakob T wrote:
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

_______________________________________________
DOLFIN-dev mailing list
DOLFIN-dev@xxxxxxxxxx
http://www.fenics.org/mailman/listinfo/dolfin-dev

_____________________________________________
DOLFIN-dev mailing list
DOLFIN-dev@xxxxxxxxxx
http://www.fenics.org/mailman/listinfo/dolfin-dev

_______________________________________________
DOLFIN-dev mailing list
DOLFIN-dev@xxxxxxxxxx
http://www.fenics.org/mailman/listinfo/dolfin-dev



Follow ups

References