geo-fluid-dynamics / phaseflow-fenics

Phaseflow simulates the convection-coupled melting and solidification of phase-change materials.
MIT License
52 stars 23 forks source link

Use iterative solver with preconditioning #104

Open agzimmerman opened 7 years ago

agzimmerman commented 7 years ago

e.g. https://fenicsproject.org/pub/tutorial/sphinx1/._ftut1006.html

agzimmerman commented 6 years ago

Since a Krylov solver could save us a lot of memory, perhaps this will allow us to get useful 3D results without MPI.

agzimmerman commented 6 years ago

fenics.list_linear_solver_methods()

Solver method | Description

bicgstab | Biconjugate gradient stabilized method cg | Conjugate gradient method default | default linear solver gmres | Generalized minimal residual method minres | Minimal residual method mumps | MUMPS (MUltifrontal Massively Parallel Sparse direct Solver) petsc | PETSc built in LU solver richardson | Richardson method tfqmr | Transpose-free quasi-minimal residual method umfpack | UMFPACK (Unsymmetric MultiFrontal sparse LU factorization)

agzimmerman commented 6 years ago

Make sure to also set the dual solver, as shown in https://www.allanswered.com/post/omvxz/adaptivenonlinearvariationalsolver-does-not-pass-solver-parameters/

agzimmerman commented 6 years ago

So far Krylov solvers are only working for the Stefan problem test.

Preconditioners are usually needed to make Krylov solvers efficient. Maybe in our case they're needed to get a solution at all. Now I'm looking into how to design a preconditioner. I think we'll need a block preconditioner, which I've seen done for the incompressible Navier-Stokes equations. There was a talk at SIAM-CSE a year ago where a guy might have also done something like this with a coupled energy equation; but I don't think he coupled the energy equation monolithically, i.e. he only needed to precondition the NS system.

Here's a nice answer from W. Bangerth about preconditioning in general, advocating block preconditioning: https://scicomp.stackexchange.com/questions/1129/what-guidelines-should-i-use-when-searching-for-good-preconditioning-methods-for

agzimmerman commented 6 years ago

This paper might use an approach similar to what we need: https://arxiv.org/pdf/1610.03991.pdf

Edit: More useful links: https://www.researchgate.net/publication/309131739_Preconditioning_of_a_coupled_Cahn--Hilliard_Navier--Stokes_system , https://www.researchgate.net/publication/260393812_A_stable_and_linear_time_discretization_for_a_thermodynamically_consistent_model_for_two-phase_incompressible_flow

agzimmerman commented 6 years ago

Here's more info about exporting the sparse matrix: https://www.allanswered.com/post/nqzoo/how-to-get-sparse-matrix/

agzimmerman commented 6 years ago

Here's a discussion related to block solving: https://www.allanswered.com/post/bevkr/using-fieldsplit-on-a-petsc-matnest-object-via-cbc-block/

agzimmerman commented 6 years ago

Try block preconditioning only the Navier-Stokes part and not preconditioning Stefan problem part

agzimmerman commented 6 years ago

Here is a package for preconditioning incompressible Navier Stokes using FEniCS : https://github.com/blechta/fenapack

agzimmerman commented 6 years ago

Thomas Gibson from the FEniCS conference pointed me towards Rayleigh–Bénard preconditioners. Here's an example I Googled: https://onlinelibrary.wiley.com/doi/full/10.1002/nla.2096

agzimmerman commented 6 years ago

Consider using the BDDC preconditioner, e.g. https://arxiv.org/abs/1101.1775

I just stumbled on some of my old notes from a conference where I wrote down that BDDC is a very robust preconditioner, and something related to "low rank Schur approximations", and "hierarchical low rank operators". "Taskification", "Meet the curse of dimensionality with the blessing of low rank". I seemed to think it was important to look in to at the time.

agzimmerman commented 6 years ago

Using HDiv conforming FEM for the Navier-Stokes sub problem could allow us to derive a SPD matrix for the Navier-Stokes block. See issue #252

agzimmerman commented 6 years ago

Here's a demo from Firedrake: https://www.firedrakeproject.org/demos/rayleigh-benard.py.html