-
Notifications
You must be signed in to change notification settings - Fork 9
Add NSE example with iterative GMRES and ILU preconditioning #47
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
Conversation
0fe15d4
to
e11c430
Compare
After a discussion with @chmerdon: This example will be incorporated into Example250 with |
There is now the "precs" API in LinearSolve: https://docs.sciml.ai/LinearSolve/stable/basics/Preconditioners/#Specifying-Preconditioners This makes much more sense as it passes a constructor of a preconditioner (pair) from a given matrix instead of a preconditioner for a fixed matrix and allows to remove boilerplate in packages like VoronoiFVM (removing the "old" API there is on the list of breaking changes for 3.0) and ExtendableFEM. I considered the API before this as flawed, see SciML/LinearSolve.jl#308 . What I described there I started in ExtendableSparse, but decided to contribute to LinearSolve instead after Chris started to push it. I plan to do PRs to reasonable preconditioning packages like this one: AMGCLWrap also has PreconBuilders now: https://j-fu.github.io/AMGCLWrap.jl/stable/preconditioners/ For the time being I keep PreconBuilders in ExtendableSparse: The idea is to remove them (and other preconditioning infrastructure) from ExtendableSparse in a breaking release, once enough of this stuff has been spread. |
Then for now maybe let's do it as suggested in the documentation of LinearSolve.jl and give the preconditioner to the iterative solver directly method_linear = KrylovJL_GMRES(precs = (A, p) -> (IncompleteLU.ilu(A), I)) so no precon_linear is needed The two HomogeneousBoundaryData operators on region 1 can be replaced by InterpolateBoundaryData(u, u_boundary!; regions = [1]). |
No idea what causes the crash. Seems that there are some open problems with ILU: haampie/IncompleteLU.jl#26 for the new LinearSolve interface. using
Sigh. I will use the old preconditioner interface of ExFEM with ILU. This worked for this problem. I'll add a comment that we should use the new LinearSolve interface once ILU works there. |
e11c430
to
7281df1
Compare
hmm... well, the example works in principle but it is a pity that it only works in this limited case and also is not really faster than the direct solver (probably because it is only a medium-sized 2d saddle-point problem) . Maybe we should have chosen another example for demonstrating that feature. Should we switch to Example301? Here, also other Preconditioners should work (I succesfully tested method_linear = KrylovJL_GMRES(precs = (A, p) -> (Diagonal(A), I))) and the IncompleteLU.ilu gives much better result than the direct solver (for nrefs =4), but still has to be configured via the precon_linear argument. What do you think? |
Well essentially this is to be expected: sparse direct solvers scale with problem sizes on par with iterative solvers in 2D. Not so in 3D - there the sparse direct solvers have a significantly worse complexity scaling compared to iterative ones. As for Pardiso - it just has the better constants... See my two lectures on this: The first refers to estimates of complexity scaling from The second one provided some back-on-the-envelope calculations on complexity of PCG.
See also this one, which I provided: https://docs.sciml.ai/SciMLBenchmarksOutput/stable/LinearSolve/SparsePDE/ |
I previously had good results with the schur complement block preconditioner described here: That would require construction of our own preconditioner, which could be an interesting showcase anyways. |
@jpthiele yes, that is a nice project for later For now, I am in favour of some simple scalar elliptic 3D problem with inhomogeneous boundary data. |
9526610
to
ef19e3c
Compare
Iterative solvers are now out of example 250. |
This was no good: it takes longer than direct solvers and is unstable
ef19e3c
to
089c87f
Compare
No description provided.