The multigrid preconditioners were being setup at every non-linear iteration, however, we want to be able to reuse them to reduce the setup time.
Description of the solution
The MFNavierStokesPreconditionGMG class now sets the level constraints, operators and transfers in the constructor. Then, depending on the MG being used, there is an initialize function in charge of setting up the smoother and the coarse-grid solver.
Modifications were made in the Newton nonlinear solver to allow to reuse the preconditioner along non-linear newton iterations. A new parameter reuse preconditioner was introduced for this purpose. When this change was introduced, the assemble_matrix and setup_preconditioner functions of all the NavierStokesBase solvers had to be slightly modified. This change now allows to reuse the preconditioner in both lethe-fluid and lethe-fluid-matrix-free. Due to this change, also the auxiliary physics needs a setup_preconditioner function, however, it was explicitly written that is not used for those applications.
The constant modes are now also being used for the local smoothing approach using the recently introduced DoFTools::extract_level_constant_modes(...).
this-> was also included several times in the MFNavierStokesPreconditionGMG class to be able to differentiate between this class member variables and others.
The output of the coarse-grid iterations was finally corrected, and now prints all the information.
How Has This Been Tested?
All the existent test pass.
Ran several tests on my machine and observed a benefit in certain cases (e.g., the TGV) when reusing the preconditioner across all Newton iterations of a transient iteration.
Documentation
The new reuse preconditioner parameter was included in the non linear solver documentation page.
Future changes
This is the second step towards reusing parts of multigrid to improve the performance of the matrix-free solver.
Description of the problem
The multigrid preconditioners were being setup at every non-linear iteration, however, we want to be able to reuse them to reduce the setup time.
Description of the solution
MFNavierStokesPreconditionGMG
class now sets the level constraints, operators and transfers in the constructor. Then, depending on the MG being used, there is an initialize function in charge of setting up the smoother and the coarse-grid solver.reuse preconditioner
was introduced for this purpose. When this change was introduced, theassemble_matrix
andsetup_preconditioner
functions of all the NavierStokesBase solvers had to be slightly modified. This change now allows to reuse the preconditioner in bothlethe-fluid
andlethe-fluid-matrix-free.
Due to this change, also the auxiliary physics needs asetup_preconditioner
function, however, it was explicitly written that is not used for those applications.DoFTools::extract_level_constant_modes(...)
.this->
was also included several times in theMFNavierStokesPreconditionGMG
class to be able to differentiate between this class member variables and others.How Has This Been Tested?
Documentation
reuse preconditioner
parameter was included in the non linear solver documentation page.Future changes