trilinos / Trilinos

Primary repository for the Trilinos Project
https://trilinos.org/
Other
1.19k stars 564 forks source link

MueLu: Reusing the multigrid hierarchy #12473

Open maxfirmbach opened 11 months ago

maxfirmbach commented 11 months ago

Question

Hello everyone,

I'm currently trying to reuse the multigrid hierarchy for subsequent linear solver calls, e.g. build the preconditioner once per time step and not for every nonlinear Newton iteration and have two questions/remarks.

1. reuse xml-file parameter

I got a simple linear elasticity case working with the "simple" xml-file interface, reusing the RAP (coarse grid hierarchy) and rebuilding only the fine level smoother, as my fine level matrix changes for each call. I can verify from the output and timings, that this piece of code works properly with the correct input parameters:

if (create)
  H_ = MueLu::CreateXpetraPreconditioner(Op, *mueluParams);
else
  MueLu::ReuseXpetraPreconditioner(Op, H_);

P_ = Teuchos::rcp(new MueLu::EpetraOperator(H_));

As I mostly work with the "advanced" xml-file interface, I run into the following problem:

// Check for the reuse case
if (hieraList.isParameter("reuse"))
   Factory::DisableMultipleCheckGlobally();

I define my factory hierarchy and in the ParameterListInterpreter, the reuse parameter is disabled ...

Is it possible to define the reuse cases also for the "advanced" xml-file interface? Right now it seems like this is not implemented yet.

2. reuse Xpetra preconditioner with blocked operator

In addition, using MueLu::ReuseXpetraPreconditioner(Op, H_) with a blocked operator results in an error in Clear(startLevel) with following error message:

Level::Clear found Internal data inconsistency

This only appears when my max levels in the input file is bigger than the multigrid hierarchy created so: max levels > actual levels. If max levels <= actual levels it works.

Maybe someone has an idea how to tackle these things.

Best regards, Max

@trilinos/muelu and might also be interesting for @mayrmt

github-actions[bot] commented 11 months ago

Automatic mention of the @trilinos/muelu team

GrahamBenHarper commented 11 months ago

@maxfirmbach regarding your remark in 1., I'm not totally certain whether this is an artificial requirement or the behavior is missing. Have you tried changing that code in MueLu_ParameterListInterpreter_def.hpp to try to allow your case anyway? It looks like it was last touched in 2015, so it might be out of date.