Skip to content
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

Setting mumps options with BlockedNewtonSolver #79

Open
ottarph opened this issue Dec 5, 2024 · 0 comments
Open

Setting mumps options with BlockedNewtonSolver #79

ottarph opened this issue Dec 5, 2024 · 0 comments

Comments

@ottarph
Copy link

ottarph commented Dec 5, 2024

When making my own Newton solver manually with dolfinx.fem.petsc.assemble_matrix/vector_block, I can change the options for the mumps direct solver with something like

A = dolfinx.fem.petsc.create_matrix_block(jacobian_comp)
ksp = PETSc.KSP().create(mesh.comm)
ksp.setOperators(A)
ksp.setType("preonly")
ksp.getPC().setType("lu")
ksp.getPC().setFactorSolverType("mumps")
ksp.getPC().getFactorMatrix().setMumpsIcntl(14, 300)

I would like to set the same options when using the scifem BlockedNewtonSolver, but my attempts using

solver = scifem.BlockedNewtonSolver(residual_comp, [u, v, p, q], bcs, jacobian_comp)
ksp = solver.krylov_solver
ksp.setType("preonly")
ksp.getPC().setType("lu")
ksp.getPC().setFactorSolverType("mumps")
ksp.getPC().getFactorMatrix().setMumpsIcntl(14, 300)

or

solver = scifem.BlockedNewtonSolver(residual_comp, [u, v, p, q], bcs, jacobian_comp)
ksp = solver.krylov_solver
ksp.setType("preonly")
ksp.getPC().setType("lu")
ksp.getPC().setFactorSolverType("mumps")
solver._J.setMumpsIcntl(14, 300)

crash with the errors

petsc4py.PETSc.Error: error code 73
[0] MatMumpsSetIcntl() at /home/conda/feedstock_root/build_artifacts/petsc_1733218859887/work/src/mat/impls/aij/mpi/mumps/mumps.c:2814
[0] Object is in wrong state
[0] Only for factored matrix

and

petsc4py.PETSc.Error: error code 73
[0] PCFactorGetMatrix() at /home/conda/feedstock_root/build_artifacts/petsc_1733218859887/work/src/ksp/pc/interface/precon.c:1461
[0] PCFactorSetUpMatSolverType() at /home/conda/feedstock_root/build_artifacts/petsc_1733218859887/work/src/ksp/pc/impls/factor/factor.c:105
[0] PCFactorSetUpMatSolverType_Factor() at /home/conda/feedstock_root/build_artifacts/petsc_1733218859887/work/src/ksp/pc/impls/factor/factimpl.c:8
[0] Object is in wrong state
[0] You can only call this routine after the matrix object has been provided to the solver, for example with KSPSetOperators() or SNESSetJacobian()

Is there a good way to control these options with the BlockedNewtonSolver?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant