Using the mumps solver when calling solve

Howdy, so I had two questions. I had a 2-d code running now I’m trying to make it work for 3-d. Everything is the same, I just changed the mesh from 2-d box to 3-d box - my code is over 4,000 lines, so I won’t post but the important part is here

state=inner(grad(u_r),grad(v_r))*dx + inner(grad(u_i),grad(v_i))*dx +ko*u_i*v_r*ds -ko*u_r*v_i*ds -v_r*(kosquared*(1+q*w)*u_r +kosquared*q*w*cos_f)*dx -v_i*(kosquared*(1+q*w)*u_i +kosquared*q*w*sin_f)*dx 
				Jac = derivative(state, u, TrialFunction(V))			
				solve(state == 0, u,  J=Jac)

When I run this I get out of memory issue :
UMFPACK V5.7.6 (May 4, 2016): ERROR: out of memory

Traceback (most recent call last):
  File "fullprog.py", line 1299, in <module>
    out = prog(256,.75,d,angles_array,prob_list,grid_size,w,nz,True,True)
  File "fullprog.py", line 671, in prog
    solve(state == 0, u)
  File "/anaconda3/envs/py35/lib/python3.5/site-packages/fenics_adjoint/solving.py", line 31, in solve
    output = backend.solve(*args, **kwargs)
  File "/anaconda3/envs/py35/lib/python3.5/site-packages/dolfin/fem/solving.py", line 220, in solve
    _solve_varproblem(*args, **kwargs)
  File "/anaconda3/envs/py35/lib/python3.5/site-packages/dolfin/fem/solving.py", line 266, in _solve_varproblem
    solver.solve()
RuntimeError: 

*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
***
***     fenics-support@googlegroups.com
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------------------------------------------------------------------------
*** Error:   Unable to successfully call PETSc function 'KSPSolve'.
*** Reason:  PETSc error code is: 76 (Error in external library).
*** Where:   This error was encountered inside /Users/travis/miniconda3/conda-bld/fenics_1535552255351/work/dolfin/la/PETScKrylovSolver.cpp.
*** Process: 0
*** 
*** DOLFIN version: 2018.1.0
*** Git changeset:  
*** -------------------------------------------------------------------------

I saw people also complaining about this - I saw people using mumps as the solver as a fix i.e

				state=inner(grad(u_r),grad(v_r))*dx + inner(grad(u_i),grad(v_i))*dx +ko*u_i*v_r*ds -ko*u_r*v_i*ds -v_r*(kosquared*(1+q*w)*u_r +kosquared*q*w*cos_f)*dx -v_i*(kosquared*(1+q*w)*u_i +kosquared*q*w*sin_f)*dx 
				#Jac = derivative(state, u, TrialFunction(V))			
				solve(state == 0, u,solver_parameters={'linear_solver': 'mumps'})

but when I run this I get
Traceback (most recent call last):
File “fullprog.py”, line 1299, in
out = prog(256,.75,d,angles_array,prob_list,grid_size,w,nz,True,True)
File “fullprog.py”, line 671, in prog
solve(state == 0, u,solver_parameters={‘linear_solver’: ‘mumps’})
File “/anaconda3/envs/py35/lib/python3.5/site-packages/fenics_adjoint/solving.py”, line 31, in solve
output = backend.solve(*args, **kwargs)
File “/anaconda3/envs/py35/lib/python3.5/site-packages/dolfin/fem/solving.py”, line 220, in solve
_solve_varproblem(*args, **kwargs)
File “/anaconda3/envs/py35/lib/python3.5/site-packages/dolfin/fem/solving.py”, line 265, in _solve_varproblem
solver.parameters.update(solver_parameters)
File “/anaconda3/envs/py35/lib/python3.5/site-packages/dolfin/parameter/init.py”, line 40, in update
self[key] = params[key]
RuntimeError: Parameter not found in Parameters object

The underlying equation I’m solving is a poisson type equation - so this should be computationally feasible in my mind. Help?

Thank you.

Did you check if mumps is available in your installation?

dolfin.list_linear_solver_methods()

@Lukas_O Looks like I do have mumps, am I not passing the parameter correctly to solve? -

import dolfin
dolfin.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)
2 Likes

Hi,
I think your problem is non-linear so you should either formulate it as

problem = NonlinearVariationalProblem(F, u, bcs, J)
solver = NonlinearVariationalSolver(problem)
prm = solver.parameters
prm[“nonlinear_solver”]=“newton”
prm[“newton_solver”][“linear_solver”] = “mumps”

or maybe try something like (no tested):

solve(state == 0, u,solver_parameters={'newton_solver': {'linear_solver': 'mumps'}})
1 Like