Default value for NewtonSolver relaxation parameter
Issue #836
invalid
I noticed that in NewtonSolver.cpp:57 there is not an assigned default value to the parameter 'relaxation_parameter' like it used to. Now the following code returns None. Is there a reason for this behavior? Thanks.
import dolfin
newton_parameters = dolfin.NewtonSolver.default_parameters()
newton_parameters['relaxation_parameter'] # returns nothing
Comments (6)
-
-
- changed status to invalid
-
reporter It doesn't default to one, that snippet returns none.
-
Yes.
None
means default, and the default is, of course, one. -
reporter I see, then I will have to change the way I use it. Right now I would like to have the output of newton_parameters['relaxation_parameter'] above to be 1.0, not None. I guess I will just add
import dolfin newton_parameters = dolfin.NewtonSolver.default_parameters() relax_param = newton_parameters['relaxation_parameter'] if relax_param is None: relax_param = 1.0
Thanks
-
You can use
NewtonSolver::get_relaxation_parameter()
which will yield1.0
even when the parameter is unset. Or you can set the parameter to1.0
. - Log in to comment
That's correct. Value can be set by parameter but preferred is to access it by
get/set_relaxation_parameter()
members.None
means unset which defaults, of course, to 1.