Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracer: no reason to setup parameter tree if solver is sequential #6038

Merged
merged 1 commit into from
Feb 26, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions opm/simulators/flow/GenericTracerModel_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,16 +445,16 @@ linearSolveBatchwise_(const TracerMatrix& M, std::vector<TracerVector>& x, std::
int maxIter = 100;

int verbosity = 0;
PropertyTree prm;
prm.put("maxiter", maxIter);
prm.put("tol", tolerance);
prm.put("verbosity", verbosity);
prm.put("solver", std::string("bicgstab"));
prm.put("preconditioner.type", std::string("ParOverILU0"));

#if HAVE_MPI
if(gridView_.grid().comm().size() > 1)
if (gridView_.grid().comm().size() > 1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the if-branch do the correct thing even without MPI? The overhead introduced should be negligble.

{
PropertyTree prm;
prm.put("maxiter", maxIter);
prm.put("tol", tolerance);
prm.put("verbosity", verbosity);
prm.put("solver", std::string("bicgstab"));
prm.put("preconditioner.type", std::string("ParOverILU0"));
auto [tracerOperator, solver] =
createParallelFlexibleSolver<TracerVector>(gridView_.grid(), M, prm);
(void) tracerOperator;
Expand All @@ -468,8 +468,8 @@ linearSolveBatchwise_(const TracerMatrix& M, std::vector<TracerVector>& x, std::
return converged;
}
else
{
#endif
{
using TracerSolver = Dune::BiCGSTABSolver<TracerVector>;
using TracerOperator = Dune::MatrixAdapter<TracerMatrix,TracerVector,TracerVector>;
using TracerScalarProduct = Dune::SeqScalarProduct<TracerVector>;
Expand All @@ -493,9 +493,7 @@ linearSolveBatchwise_(const TracerMatrix& M, std::vector<TracerVector>& x, std::

// return the result of the solver
return converged;
#if HAVE_MPI
}
#endif
}

} // namespace Opm
Expand Down