Trilinos AMG ML .reinit() ... how to?

128 views
Skip to first unread message

richard....@gmail.com

unread,
Oct 20, 2021, 5:30:23 PM10/20/21
to deal.II User Group
Hi everyone,
I just recently came across the possibility of using the .reinit() function when using Trilinos' ML AMG methods, which despite being most often super fast, can still add up to some 2-10%(?) runtime. So I went ahead and simply did the .initialize() only once in the beginning and then in the next ~10000 timesteps just called the .reinit().
So far so good; for some of the problems this was working quite well (Elasticity and Laplace), but for momentum balance in the Navier-Stokes equations (I am using a PPE scheme) this lead to non-convergence.
The matrix, boundary conditions and rhs change of course, but the sparsity pattern stays exactly the same, which is the only mentioned condition in the documentation - are there some 'hidden' conditions that need to be met? The ML users guide (attached) was also not really helpful, including a 'xy->DestroyPreconditioner();' (just before 'xy->ReComputePreconditioner();' in the PreconditionAMG::reinit() in trilinos_precondition_ml.cc) as in the guide on page 16 even triggered some errors. 
Neither Aspect nor Lethe make use of this function, maybe for a reason?
A code snippet would be as simple as
>>
amg_prec_set = false;
// assemble system
if (!amg_prec_set)
  {  
    amg_prec.initialize (matrix, data);
    amg_prec_set = true;
  }
else
  amg_prec_fluid_mom.reinit ();
// solve system and go to next time step
<<
so I believe something as simple as that would be used even if it could only save 2% of runtime, right?
I would be grateful for any hints from the developers of aforementioned packages or anyone particularly familiar with TrilinosWrappers::PreconditionAMG - thanks in advance and greetings from Austria!
Best
Richard
mlguide.pdf

richard....@gmail.com

unread,
Oct 22, 2021, 4:53:34 AM10/22/21
to deal.II User Group
HA!
I think I know what it is: the ML guide on p 16 says in footnote 11:
"Note that the hierarchy produced by ReComputePreconditioner() can differ from that produced by ComputePreconditioner() for non-zero threshold values."
So when the matrix changes too much, the const double aggregation_threshold in PreconditionAMG::AdditionalData would lead to different matrix entries being considered.
That is why it was also working for (constant) Laplace and (almost constant Hyper-) Elasticity, but not so well for Navier-Stokes, since I initialized the AMG in the first timestep, where convective terms are completely zero starting from the quiescent state.
Hope someone finds this in the future and updates their AMG every few timesteps as well!
Best
Richard

Wolfgang Bangerth

unread,
Oct 22, 2021, 5:45:41 PM10/22/21
to dea...@googlegroups.com
Richard -- I cannot recall who implemented the AMG preconditioner, but suspect
that that parameter was simply never used. I don't think we use it in ASPECT,
for example.

Since you figured out how to use it, is there a place where one could add a
paragraph that describes what you found out and how one would use this
feature? You might know this one piece of the library better than anyone else
at this time :-) It would be nice to write your experience down in the place
where others might look for it.

Best
Wolfgang

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

Reply all
Reply to author
Forward
0 new messages