On Sun, Feb 9, 2014 at 10:58 AM, yuan wang <[email protected]> wrote: > Hi Fipyers, > > I read in the documentation that there are three solvers for Fipy: PySparse, > SciPy, and Trilinos. Does any of the solvers use Thomas Algorithm for > tridiagonal matrix?
I don't believe so. > The most efficient one seems to be PySparse, but it uses > LU factorization. In my situation, Thomas Algorithm will be more efficient. PySparse doesn't need to use LU factorization, you could use PCG assuming that the matrix is symmetric. Also the other solvers are not necessarily slower. Often the default FiPy setup is not the same for each solver suite. They each have different stopping criteria and preconditioners. When these are brought into alignment, often the solver suite run times are similar. > Also, how difficult will it be to implement my own solver with existing Fipy > code? I found a very efficient revised Thomas Algorithm written in Fortran > and thinking of translating it to Python and integrate it with Fipy, because > Fipy is very good in defining coefficient matrix. As Jon suggested, keep it in Fortran and use f2py to wrap it. Once it works with Python it is very easy to incorporate into FiPy. > The main reason I am exploring other solvers is that I found the default > solver takes really long to solve. I have 14 pdes, it sweep to convergence > in 24 sweeps. It will take about 24s to converge. That's about 1s for each > sweep of 14 pdes. The Fortran code I was looking at would take only about > 0.1s for each sweep. Have you profiled to confirm that the inefficiencies are with the solver and not in some other part of the code? Also make sure you are looking at problems of the size that matter to you, not just small test problems. Often FiPy is very expensive for the setup stage of a solution problem and expensive independent of the size of the domain. Once the domain is scaled up a lot of this overhead becomes inconsequential. -- Daniel Wheeler _______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
