← Back to team overview

dolfin team mailing list archive

Re: newton solver

 

On Tue, Mar 17, 2009 at 11:40 AM, Patrick Riesen <priesen@xxxxxxxxxxxxxxx>wrote:

> Hi Matt
>
> i don't know if line search is used in dolfin, but i'll try the parameter
> continuation and a regularization of the viscosity as proposed by my
> colleague Jed.


Regularization of the viscosity is a little more tricky. Can you show that
this solution
converges to the true solution?

  Matt


>
> Thanks for your answer!
>
> patrick
>
>
>
> Matthew Knepley wrote:
>
>> In general, if a Newton iteration is not converging, you can
>>
>>  a) Use a better line search (what is used now?)
>>
>>  b) try a trust-region method
>>
>>  c) use continuation in your parameter
>>
>>  Matt
>>
>> On Tue, Mar 17, 2009 at 10:38 AM, Patrick Riesen <priesen@xxxxxxxxxxxxxxx
>> >wrote:
>>
>>  Anders Logg wrote:
>>>
>>>> On Fri, Mar 13, 2009 at 07:48:39PM +0100, Patrick Riesen wrote:
>>>>
>>>>> Patrick Riesen wrote:
>>>>>
>>>>>> Anders Logg wrote:
>>>>>>
>>>>>>> On Wed, Mar 11, 2009 at 10:21:52AM +0100, Patrick Riesen wrote:
>>>>>>>
>>>>>>>> hello
>>>>>>>>>
>>>>>>>>> So my Etafunction is now being correctly constructed and there are
>>>>>>>>>
>>>>>>>> the
>>>
>>>> correct values in the dof-vector(). i did this by a function class
>>>>>>>>> definition and a call to Eta as
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> class Eta: public Function
>>>>>>>>> {
>>>>>>>>>   Eta (Mesh& mesh, Function& gamma, Form& form, ...) :
>>>>>>>>>
>>>>>>>> Function(mesh,
>>>
>>>> form, argument_id)
>>>>>>>>> { constructor....something as above }
>>>>>>>>>
>>>>>>>>> and then i call it as
>>>>>>>>>
>>>>>>>>> f_eta = new Eta(.....);
>>>>>>>>>
>>>>>>>>> in the main program.
>>>>>>>>>
>>>>>>>>> calling Eta as Function(mesh,form,id) i thought this should create
>>>>>>>>> a
>>>>>>>>> discrete function for f_eta, but the type of the f_eta function is
>>>>>>>>> 'user'. this gives me an error at the assembly, "missing eval() for
>>>>>>>>> user-defined function..."
>>>>>>>>> do i have to add an dummy eval() function to my Eta-class, or what
>>>>>>>>>
>>>>>>>> do i
>>>
>>>> have to change that no eva()-missing error is raised and my f_eta
>>>>>>>>> function is of type discrete?
>>>>>>>>>
>>>>>>>>> thanks for your help,
>>>>>>>>> patrick
>>>>>>>>>
>>>>>>>>>  sorry, i found an error, now the Eta is of type discrete (all 3
>>>>>>>>
>>>>>>> argument
>>>
>>>> functions of my form are now discrete). but the eval() error at
>>>>>>>>
>>>>>>> assembly
>>>
>>>> of the form is still present.
>>>>>>>>
>>>>>>> Have you called vector() inside the constructor of Eta? That should
>>>>>>> make it discrete and the assembler should not complain. Perhaps there
>>>>>>> is some other function in you form that is missing an eval (or a
>>>>>>> vector).
>>>>>>>
>>>>>>>   hi anders,
>>>>>> yes i did that, and now i found the error fortunately. i did not
>>>>>> initialize the bilinear form correctly with some placeholder function
>>>>>> for Eta. now the assembly is working, so i can go on.
>>>>>>
>>>>>> thank you & regards,
>>>>>> patrick
>>>>>>
>>>>> hi all
>>>>> my code is now running but the Eta-funcs still give me some problems. i
>>>>> have initialized my bilinear/linear form with two constant functions as
>>>>>
>>>>> f_eta = new Function(mesh, 1.)
>>>>> f_Deta = new Function(mesh, 1.)
>>>>>
>>>> Are you using an old version? This doesn't work with the current
>>>> interface.
>>>>
>>>>  the first newton iteration gives me a newtonian solution from which i
>>>>> take the velocity to compute the invariant in another form (gamma) and
>>>>> then i construct the discussed functions Eta, DEta, and renew f_eta,
>>>>> f_Deta as
>>>>>
>>>>> f_eta = new Eta(gamma,.....)
>>>>> f_Deta = new DEta(gamma,......)
>>>>>
>>>>>
>>>>> so i guess in the second iteration it will assemble with a variable
>>>>> viscosity as f_eta, f_Deta are different now but it just converges to
>>>>> the newtonian solution.
>>>>>
>>>>> is this a problem, that i constructed the forms with a constant
>>>>> function? does dolfin then not consider the values in the vector() of
>>>>> the new discrete functions for f_eta, f_Deta after renewing?
>>>>>
>>>> Yes, if you construct your form with some Function, then that Function
>>>> will be used. The form won't change just because you create a new
>>>> Function later.
>>>>
>>> hi,
>>> thanks again for the help so far,
>>> now i think i managed to construct my forms correctly and the code is
>>> running. the solution looks reasonable, starting from newtonian solution
>>> with n=1 and then changes when the powerlaw exponent is increased.
>>>
>>> however, the convergence is poor, e.g. with a powerlaw exponent of n=2
>>> it takes almost 30 iterations to converge (incremental criterium) and it
>>> does not converge beyond n=2 so far.
>>>
>>> to compute the variable viscosity terms in my form i followed the
>>> example of the quadrature elements implementation of the nonlinear
>>> poisson demo (sect. 6.10 in the ffc manual from nov 2008) and solve a
>>> linear system with another form-file to obtain the invariant of the
>>> strain tensor. then as discussed in previous mails (see above) i take
>>> power n-something of the invariant and compute the viscosity in the
>>> dof-vector adaptively in each iteration.
>>>
>>> is there a way to play around with the newtonsolver? now i use a
>>> lu-factorization with umfpack and ublas-backend, i just
>>> had
>>>
>>> NewtonSolver newtonsolver;
>>>
>>> e.g but i tried the same as
>>>
>>> NewtonSolver newtonsolver(lu,default_pc);
>>>
>>> i got an error:
>>>
>>> In file included from PowerlawStokesSolver.cpp:4:
>>> PowerlawStokesSolver.h:74: error: 'lu' is not a type
>>> PowerlawStokesSolver.h:74: error: 'default_pc' is not a type
>>>
>>> BTW: i use dolfin0.8.1 with dolfin-grade2
>>>
>>> regards,
>>> patrick
>>>
>>> _______________________________________________
>>> DOLFIN-dev mailing list
>>> DOLFIN-dev@xxxxxxxxxx
>>> http://www.fenics.org/mailman/listinfo/dolfin-dev
>>>
>>>
>>
>>
>>
>


-- 
What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
lead.
-- Norbert Wiener

Follow ups

References