SolverControl stopping criteria

47 views
Skip to first unread message

Yang Liu

unread,
Feb 21, 2022, 8:00:24 AM2/21/22
to deal.II User Group
Dear DEAL.II developers and users,

We are using DEAL.II to address a goal-oriented PDE problem, using SolverCG<> to solve a linear system.

Since we are interested in the accuracy of the quantity of interest, we want the iterative solver to stop when the inner product between a dual solution vector and the residual vector is less than a threshold, rather than controlling the residual vector l_2 norm.

We have two concerns:

1. Is it possible to extract the residual vector from the SolverCG (or other possible solvers) class?

2. Is it possible to use the inner product as mentioned above rather than the l_2 norm as the check_value in the SolverControl class?

Best Regards,
Yang

Bruno Turcksin

unread,
Feb 21, 2022, 8:35:37 AM2/21/22
to deal.II User Group
Yang,

On Monday, February 21, 2022 at 8:00:24 AM UTC-5 Yang Liu wrote:
1. Is it possible to extract the residual vector from the SolverCG (or other possible solvers) class?

Yes, you can extract the residual vector using this  and this

2. Is it possible to use the inner product as mentioned above rather than the l_2 norm as the check_value in the SolverControl class?
 
To do that you will need to create your on SolverControl class. As you can see here, there are already three derived classes of SolverControl. You will need to create a fourth one that does what you want.

Best,

Bruno

Yang Liu

unread,
Feb 22, 2022, 9:48:13 AM2/22/22
to deal.II User Group
Hi Bruno,

It seems that all the three derived classes of SolverControl have the stopping criteria that are based on the residual l_2 norm. The argument `check_value' in the function SolverControl::check() is provided as the residual l_2 norm. I wonder how to provide the `SolverControl::check()' function a different quantity instead of the l_2 norm.

Best,

Yang

Bruno Turcksin

unread,
Feb 22, 2022, 10:27:42 AM2/22/22
to deal.II User Group
Yang,

Sorry, my bad. I think the only way to do what you want, is to modify the code inside deal.II You need to modify this function You will need to change the second argument of iteration_status() Instead of using the residual, you can change it to your inner product.

Best,

Bruno

Wolfgang Bangerth

unread,
Feb 22, 2022, 10:47:38 AM2/22/22
to dea...@googlegroups.com
On 2/22/22 07:48, Yang Liu wrote:
>
> It seems that all the three derived classes of SolverControl have the stopping
> criteria that are based on the residual l_2 norm. The argument `check_value'
> in the function SolverControl::check() is provided as the residual l_2 norm. I
> wonder how to provide the `SolverControl::check()' function a different
> quantity instead of the l_2 norm.

Like Bruno already said, you probably want to write your own modified version
of the CG solver. Alternatively, SolverCG is derived from SolverBase, which
has a member function connect() to which you can attach a callback. This way,
you will get to see the current iterate in each iteration. The callback
doesn't get the residual vector, however, so if that's what you need, you
would have to compute that at the cost of one matrix-vector product -- that's
expensive of course. But for testing purposes, it might be useful.

Best
W.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/

Reply all
Reply to author
Forward
0 new messages