From 0c65381ec35111c29fd00990273186189cba6d9a Mon Sep 17 00:00:00 2001 From: Martin Schneider <martin.schneider@iws.uni-stuttgart.de> Date: Fri, 29 Apr 2022 08:27:21 +0000 Subject: [PATCH] Merge branch 'bugfix/parallel-solver-adaptive' into 'master' [bugfix][parallel][solver] Rebuild parallel helpers after grid adaption See merge request dumux-repositories/dumux!3080 (cherry picked from commit f9427ce43a9024f925c3cbcb857850581349e525) d505c0be [bugfix][parallel][solver] Rebuild parallel helpers after grid adaption --- dumux/linear/amgbackend.hh | 15 +++++++++++++++ dumux/linear/istlsolverfactorybackend.hh | 15 +++++++++++++++ test/porousmediumflow/2p/adaptive/main.cc | 1 + 3 files changed, 31 insertions(+) diff --git a/dumux/linear/amgbackend.hh b/dumux/linear/amgbackend.hh index 468d4f7dd9..2e3ef24482 100644 --- a/dumux/linear/amgbackend.hh +++ b/dumux/linear/amgbackend.hh @@ -87,6 +87,21 @@ public: checkAvailabilityOfDirectSolver_(); } + /*! + * \brief Update the solver after grid adaption + * + * \param gridView the grid view on which we are performing the multi-grid + * \param dofMapper an index mapper for dof entities + */ + void updateAfterGridAdaption(const typename LinearSolverTraits::GridView& gridView, + const typename LinearSolverTraits::DofMapper& dofMapper) + { +#if HAVE_MPI + if (isParallel_) + phelper_ = std::make_unique<ParallelISTLHelper<LinearSolverTraits>>(gridView, dofMapper); +#endif + } + /*! * \brief Solve a linear system. * diff --git a/dumux/linear/istlsolverfactorybackend.hh b/dumux/linear/istlsolverfactorybackend.hh index 9c90f0f83e..a23c72613c 100644 --- a/dumux/linear/istlsolverfactorybackend.hh +++ b/dumux/linear/istlsolverfactorybackend.hh @@ -158,6 +158,21 @@ public: #endif } + /*! + * \brief Update the solver after grid adaption + * + * \param gridView the grid view on which we are performing the multi-grid + * \param dofMapper an index mapper for dof entities + */ + void updateAfterGridAdaption(const typename LinearSolverTraits::GridView& gridView, + const typename LinearSolverTraits::DofMapper& dofMapper) + { +#if HAVE_MPI + if (isParallel_) + parallelHelper_ = std::make_unique<ParallelISTLHelper<LinearSolverTraits>>(gridView, dofMapper); +#endif + } + /*! * \brief Solve a linear system. * diff --git a/test/porousmediumflow/2p/adaptive/main.cc b/test/porousmediumflow/2p/adaptive/main.cc index 5ee75e1e5a..b060c766fb 100644 --- a/test/porousmediumflow/2p/adaptive/main.cc +++ b/test/porousmediumflow/2p/adaptive/main.cc @@ -202,6 +202,7 @@ int main(int argc, char** argv) xOld = x; //!< Overwrite the old solution with the new (resized & interpolated) one gridVariables->updateAfterGridAdaption(x); //!< Initialize the secondary variables to the new (and "new old") solution assembler->updateAfterGridAdaption(); //!< Tell the assembler that the grid changed + linearSolver->updateAfterGridAdaption(leafGridView, gridGeometry->dofMapper()); //!< Tell the solver that the grid changed problem->computePointSourceMap(); //!< Update the point source map } } -- GitLab