From: Jed Brown <libmesh@59...>  20080411 15:47:22

On Fri 20080411 16:47, pcorreia@... wrote: > I ran ex3 using the runtime flags and I got the following error message: You'll have to add something like KSPSetInitialGuessNonzero(ksp, PETSC_FALSE); before the solve if you want to use preonly. I was unaware that libmesh sets this by default. A prettier way to unset this parameter might be a nice thing for libmesh to do. I'd be surprised if you actually take a performance hit when leaving the solver as gmres (default) and just specifying 'pc_type lu'. It will converge after one iteration. Jed > [0]PETSC ERROR:  Error Message >  > [0]PETSC ERROR: ! > [0]PETSC ERROR: Running KSP of preonly doesn't make sense with nonzero > initial guess > you probably want a KSP type of Richardson! > [0]PETSC ERROR: >  > [0]PETSC ERROR: Petsc Release Version 2.3.2, Patch 10, Wed Mar 28 19:13:22 > CDT 2007 HG revision: d7298c71db7f5e767f359ae35d33cab3bed44428 > [0]PETSC ERROR: See docs/changes/index.html for recent updates. > [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting. > [0]PETSC ERROR: See docs/index.html for manual pages. > [0]PETSC ERROR: >  > [0]PETSC ERROR: ./ex3opt on a linux named alinex2PUb8L by paulo Fri Apr > 11 15:39:31 2008 > [0]PETSC ERROR: Libraries linked from > /home/paulo/libmesh/contrib/petsc2.3.2p10/lib/linux > [0]PETSC ERROR: Configure run at Fri Apr 11 11:58:22 2008 > [0]PETSC ERROR: Configure options withcc=gcc withcxx=g++ > withfc=g77 withshared=1 downloadfblaslapack=1 > downloadsuperlu=1 withmpidir=/usr/lib/mpich > [0]PETSC ERROR: >  > [0]PETSC ERROR: KSPSolve_PREONLY() line 26 in > src/ksp/ksp/impls/preonly/preonly.c > [0]PETSC ERROR: KSPSolve() line 372 in src/ksp/ksp/interface/itfunc.c > [0]PETSC ERROR: User provided function() line 396 in > unknowndirectory/src/numerics/petsc_linear_solver.C > [0] MPI Abort by user Aborting program ! > [0] Aborting program! > p0_20759: p4_error: : 83 > > > Paulo > > > > > > On Thu 20080410 14:09, pcorreia@... wrote: > >> Hi, > >> How can I use a direct solver to solve a linear system of equations? > >> Thanks in advance, > >> Paulo > > > > You can do this entirely with PETSc command line arguments. For instance > > > > ksp_type preonly pc_type lu > > > > will solve the system using LU decomposition. If your matrix is > > symmetric, you > > can try pc_type cholesky. You can select different direct solvers by > > changing > > the matrix type with mat_type. Run the program with help and you will > > see the > > supported types (such as umfpack, superlu, aijspooles, sbaijmumps). > > Depending > > on the problem, you may want to try preconditioning with algebraic > > multigrid. > > You can build PETSc with libraries like Hypre, ML, and Prometheus, then > > use > > pc_type hypre. For 3D problems, I find this starts beating a direct > > method > > for quite small sizes. > > > > Jed 