Skip to content

Commit

Permalink
Specify GMRES parameters whent iterating intermediate GMG levels (#1264)
Browse files Browse the repository at this point in the history
Description
In PR #1211 a new parameter was introduced that allow to iterate intermediate GMG levels. This allows to choose a level as coarse grid and used there a GMRES iterative solver preconditioned by a MG. So far, only one parameter was present: mg int level, however, the parameters for the number of iterations and tolerances were being hardcoded. This PR changes that by using already existing GMRES parameters..

Testing
I have tested this in the flow around a sphere case and seems to work just fine.

Documentation
The documentation was updated by adding a note that specifies the use of these parameters for this purpose as well.
  • Loading branch information
lpsaavedra authored Aug 27, 2024
1 parent 498363b commit bf39a0d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion doc/source/parameters/cfd/linear_solver_control.rst
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ Different parameters for the main components of the two geometric multigrid algo
Evaluating terms involving the hessian is expensive. Therefore, one can turn on or off those terms in the mg level operators to improve performance by setting ``mg enable hessians in jacobian`` to ``false``. This is useful for certain problems and must be used carefully.

.. tip::
The ``mg int level`` option only works for ``gcmg`` preconditioner. It allows to choose an intermediate level as coarse grid solver and to perform several multigrid v-cycles there.
The ``mg int level`` option only works for the ``gcmg`` preconditioner. It allows to choose an intermediate level as coarse grid solver where a GMRES preconditioned by several multigrid v-cycles is used. The following parameters: ``set mg gmres max iterations``, ``set mg gmres tolerance`` and ``set mg gmres reduce`` can be used to set the desired number of maximum iterations, the absolute tolerance and the relative tolerance.

In addition, Lethe supports `p-multigrid` through the ``gcmg`` preconditioner. It can be used by specifying two additional parameters:

Expand Down
14 changes: 12 additions & 2 deletions source/solvers/fluid_dynamics_matrix_free.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1647,9 +1647,19 @@ MFNavierStokesPreconditionGMG<dim>::initialize(
std::make_shared<PreconditionMG<dim, VectorType, GCTransferType>>(
this->dof_handler, *this->mg_intermediate, *this->mg_transfer_gc);

// TODO: introduce parameters
const int max_iterations = this->simulation_parameters.linear_solver
.at(PhysicsID::fluid_dynamics)
.mg_gmres_max_iterations;
const double tolerance = this->simulation_parameters.linear_solver
.at(PhysicsID::fluid_dynamics)
.mg_gmres_tolerance;
const double reduce = this->simulation_parameters.linear_solver
.at(PhysicsID::fluid_dynamics)
.mg_gmres_reduce;

this->coarse_grid_solver_control_intermediate =
std::make_shared<ReductionControl>(1000, 1e-20, 1e-2, false, false);
std::make_shared<ReductionControl>(
max_iterations, tolerance, reduce, false, false);

this->coarse_grid_solver_intermediate =
std::make_shared<SolverGMRES<VectorType>>(
Expand Down

0 comments on commit bf39a0d

Please sign in to comment.