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