Are there any tips for using Trilinos AMG preconditioner?

75 views
Skip to first unread message

timo Hyvärinen

unread,
Jan 28, 2025, 12:21:38 PM1/28/25
to dea...@googlegroups.com
Hi, dealii devs and users

I have been using the dealii Trilinos API of ML to generate an AMG preconditioner for MPI distributed sparse system matrix quite a while. It roubustely works for most computing of a damped Newton method on clusters.

However, casually the linear solver of Newton update vector gives extremely incorrect update vector, which leads to divergence of iteration. Here is an example shown as log file record for a line search:
```shell
Refinement cycle : 0, iteration_loop: 1
Volume is 1.568e+06

 assembly is done !
 start to build AMG preconditioner.
 AMG preconditioner is built up.
 system_rhs.l2_norm() is 307.629
 Starting linear solving.
   Solved in 8 iterations.
 AMG preconditioned solving is done ! With solver_tol 0.7
 step length alpha is: 1, residual is: 1.08098e+57, previous_residual is: 307.629
...
 step length alpha is: 9.74386e-09, residual is: 1.00003e+33, previous_residual is: 307.629
```
As the last two lines show, the iteration Vn+1 = Vn + alpha Xn went into total failure because Xn, which is solved by FGMRES + Trilinos AMG, is no where close to the right guess. This failure usually is triggered during simulation with a bigger box (100^3 in volume and > 30M DoFs) and relatively small solver_tol of FGMRES (example above is 0.7). The initial configuration on which Xn is solved has random noise on every vertice. This failure happens for Trilinos v12.8, v14.2, v14.4 and dealii 9.3, 9.4, 9.5, 9.6.

This issue won't happen if simulation is done with either
(1) smaller box (about < 70^3 in volume)  or
(2) looser tolerance of linear solver FGERES ( solver_tol> 0.9) even with small number of DoFs (~ 5M)

I want to know if there are "always-working" rules to guarantee successful linear iteration when Trilinos AMG + FGemRES are used or any tips about using AMG preconditioner. The following is the preconditioner initializing block in my code:
```shell
TrilinosWrappers::PreconditionAMG::AdditionalData additional_data;
additional_data.constant_modes = constant_modes;
additional_data.elliptic = true;
additional_data.n_cycles = 4;
additional_data.w_cycle = true;
additional_data.smoother_sweeps = 2;
additional_data.aggregation_threshold = 1e-2;
preconditioner.initialize(system_matrix, additional_data);
```

best,
Tim

Wolfgang Bangerth

unread,
Jan 29, 2025, 11:13:19 PM1/29/25
to dea...@googlegroups.com

Timo:
I don't have "general rules", but I do have questions:

> I have been using the dealii Trilinos API of ML to generate an AMG
> preconditioner for MPI distributed sparse system matrix quite a while. It
> roubustely works for most computing of a damped Newton method on clusters.
>
> However, casually the linear solver of Newton update vector gives extremely
> incorrect update vector, which leads to divergence of iteration. Here is an
> example shown as log file record for a line search:
> ```shell
> Refinement cycle : 0, iteration_loop: 1
> Volume is 1.568e+06
>
>  assembly is done !
>  start to build AMG preconditioner.
>  AMG preconditioner is built up.
>  system_rhs.l2_norm() is 307.629
>  Starting linear solving.
>    Solved in 8 iterations.
>  AMG preconditioned solving is done ! With solver_tol 0.7
>  step length alpha is: 1, residual is: 1.08098e+57, previous_residual is: 307.629

Yes, this clearly isn't good. What does solver_to=0.7 correspond to? A
reduction of the residual by a factor of 0.7? That's of course far from the
1e-6 or so that we always use in the tutorials.

Regardless, it is clear that you made the residual *much* worse, and that...

> ...
>  step length alpha is: 9.74386e-09, residual is: 1.00003e+33,
> previous_residual is: 307.629
> ```

Reducing the step length does not help either.


> As the last two lines show, the iteration Vn+1 = Vn + alpha Xn went into total
> failure because Xn, which is solved by FGMRES + Trilinos AMG, is no where

What is the underlying problem you are trying to solve? AMG is best (and
perhaps only really usable) if applied to elliptic systems. But then you'd be
using CG, not FGMRES. Can you explain what you use the AMG for?

Best
W.
Reply all
Reply to author
Forward
0 new messages