dealii / code-gallery

A collection of codes based on deal.II contributed by deal.II users
Other
44 stars 54 forks source link

Update linear solver in MCMC-Laplace #87

Closed bangerth closed 2 years ago

bangerth commented 3 years ago

@kronbichler took a stab at making the linear solver in MCMC-Laplace faster and made me look like an amateur :-) He reports that this patch

   template <int dim>
   void PoissonSolver<dim>::solve()
   {
-    SparseDirectUMFPACK solver;
-    solver.factorize(system_matrix);
-    solver.vmult(solution, system_rhs);
+    SparseILU<double> ilu;
+    ilu.initialize(system_matrix);
+    SolverControl control(100, 1e-8*system_rhs.l2_norm());
+    SolverCG<> solver(control);
+    solver.solve(system_matrix, solution, system_rhs, ilu);
   } 

makes the solver run faster by about a factor of 3.

I don't have the time to deal with this right now, but will get to testing that this works as intended (and yields the desired accuracy in the output) at some point.