@@ -593,7 +593,15 @@ void trilinos_solve_(const Teuchos::RCP<Trilinos> &trilinos_, double *x, const d
593593
594594 // Run the solver (solve() handles restarts internally)
595595 converged = false ;
596+
597+ Teuchos::Time timer (" Belos Solve Timer" );
598+ timer.start ();
599+
596600 Belos::ReturnType result = solverManager->solve ();
601+
602+ timer.stop ();
603+
604+ solverTime = timer.totalElapsedTime ();
597605
598606 if (result == Belos::Converged) {
599607 converged = true ;
@@ -735,7 +743,9 @@ void setMueLuPreconditioner(Teuchos::RCP<MueLu_Preconditioner> &MueLuPrec,
735743 const Teuchos::RCP<Tpetra_CrsMatrix> &A)
736744{
737745 // MueLuPrec is now a Tpetra::Operator that can be plug into BelosProblem
738- // The following parameters proved to be generally good for big FSI problems
746+ std::string optionsFile = " mueluOptions.xml" ;
747+
748+ // The following built-in parameters proved to be generally good for big FSI problems
739749 Teuchos::ParameterList mueluParams;
740750
741751 mueluParams.set (" verbosity" , " none" );
@@ -775,7 +785,28 @@ void setMueLuPreconditioner(Teuchos::RCP<MueLu_Preconditioner> &MueLuPrec,
775785 mueluParams.set (" coarse: max size" , 2000 );
776786
777787 // Create MueLu preconditioner from matrix and parameter list, as Tpetra::Operator
778- MueLuPrec = MueLu::CreateTpetraPreconditioner (Teuchos::rcp_static_cast<Tpetra_Operator>(A), mueluParams);
788+ std::ifstream ifs (optionsFile.c_str ());
789+ if (ifs.good ())
790+ {
791+ try
792+ {
793+ MueLuPrec = MueLu::CreateTpetraPreconditioner (
794+ Teuchos::rcp_static_cast<Tpetra_Operator>(A), optionsFile);
795+ }
796+ catch (std::exception &e)
797+ {
798+ std::cerr << " [MueLu Warning]: failed to create MueLu from file '" << optionsFile
799+ << " ': " << e.what () << " \n Falling back to built-in parameters.\n " ;
800+ MueLuPrec = MueLu::CreateTpetraPreconditioner (
801+ Teuchos::rcp_static_cast<Tpetra_Operator>(A), mueluParams);
802+ }
803+ }
804+ else
805+ {
806+ MueLuPrec = MueLu::CreateTpetraPreconditioner (
807+ Teuchos::rcp_static_cast<Tpetra_Operator>(A), mueluParams);
808+ }
809+
779810}
780811
781812// ----------------------------------------------------------------------------
0 commit comments