[petsc-users] On QN + Fieldsplit

Matthew Knepley knepley at gmail.com
Tue Oct 12 09:23:18 CDT 2021


I looked over every place we use that error code. I do not think it is
coming from PETSc, but rather from petsc4py. However, something
is eating the error message, and I think Stefano indicated. My first step
would be to get the FEniCS folks to display the error message.

Another option is to just run it in Firedrake since I think we can see the
stack properly there.

  Thanks,

     Matt

On Tue, Oct 12, 2021 at 8:37 AM Nicolás Barnafi <nabw91 at gmail.com> wrote:

> Thank you Stefano for the help. I added the lines you indicated, but the
> error remains the same, here goes snes.view() + error
>
> > SNES Object: 1 MPI processes
> >   type: qn
> >   SNES has not been set up so information may be incomplete
> >     type is BROYDEN, restart type is DEFAULT, scale type is JACOBIAN
> >     Stored subspace size: 10
> >     Using the single reduction variant.
> >   maximum iterations=10000, maximum function evaluations=30000
> >   tolerances: relative=1e-08, absolute=1e-50, solution=1e-08
> >   total number of function evaluations=0
> >   norm schedule ALWAYS
> >   SNESLineSearch Object: 1 MPI processes
> >     type: basic
> >     maxstep=1.000000e+08, minlambda=1.000000e-12
> >     tolerances: relative=1.000000e-08, absolute=1.000000e-15,
> lambda=1.000000e-08
> >     maximum iterations=1
> > Traceback (most recent call last):
> >   File "Twist.py", line 234, in <module>
> >     snes.setUp()
> >   File "PETSc/SNES.pyx", line 530, in petsc4py.PETSc.SNES.setUp
> > petsc4py.PETSc.Error: error code 83
>
> On Tue, Oct 12, 2021 at 2:07 PM Stefano Zampini <stefano.zampini at gmail.com>
> wrote:
>
>>
>>
>> Il giorno mar 12 ott 2021 alle ore 13:56 Nicolás Barnafi <
>> nabw91 at gmail.com> ha scritto:
>>
>>> Hello PETSc users,
>>>
>>> first email sent!
>>> I am creating a SNES solver using fenics, my example runs smoothly with
>>> 'newtonls', but gives a strange missing function error (error 83):
>>>
>>>
>> Dolphin swallows any useful error information returned from PETSc. You
>> can try using the below code snippet at the beginning of your script
>>
>> from petsc4py import PETSc
>> from dolfin import *
>> # Remove the dolfin error handler
>> PETSc.Sys.pushErrorHandler('python')
>>
>>
>>
>>>
>>> these are the relevant lines of code where I setup the solver:
>>>
>>> > problem = SNESProblem(Res, sol, bcs)
>>> > b = PETScVector()  # same as b = PETSc.Vec()
>>> > J_mat = PETScMatrix()
>>> > snes = PETSc.SNES().create(MPI.COMM_WORLD)
>>> > snes.setFunction(problem.F, b.vec())
>>> > snes.setJacobian(problem.J, J_mat.mat())
>>> > # Set up fieldsplit
>>> > ksp = snes.ksp
>>> > ksp.setOperators(J_mat.mat())
>>> > pc = ksp.pc
>>> > pc.setType('fieldsplit')
>>> > dofmap_s = V.sub(0).dofmap().dofs()
>>> > dofmap_p = V.sub(1).dofmap().dofs()
>>> > is_s = PETSc.IS().createGeneral(dofmap_s)
>>> > is_p = PETSc.IS().createGeneral(dofmap_p)
>>> > pc.setFieldSplitIS((None, is_s), (None, is_p))
>>> > pc.setFromOptions()
>>> > snes.setFromOptions()
>>> > snes.setUp()
>>>
>>>
>> If it can be useful, this are the outputs of snes.view(), ksp.view() and
>>> pc.view():
>>>
>>> >   type: qn
>>> >   SNES has not been set up so information may be incomplete
>>> >     type is BROYDEN, restart type is DEFAULT, scale type is JACOBIAN
>>> >     Stored subspace size: 10
>>> >     Using the single reduction variant.
>>> >   maximum iterations=10000, maximum function evaluations=30000
>>> >   tolerances: relative=1e-08, absolute=1e-50, solution=1e-08
>>> >   total number of function evaluations=0
>>> >   norm schedule ALWAYS
>>> >   SNESLineSearch Object: 4 MPI processes
>>> >     type: basic
>>> >     maxstep=1.000000e+08, minlambda=1.000000e-12
>>> >     tolerances: relative=1.000000e-08, absolute=1.000000e-15,
>>> lambda=1.000000e-08
>>> >     maximum iterations=1
>>> > KSP Object: 4 MPI processes
>>> >   type: gmres
>>> >     restart=1000, using Modified Gram-Schmidt Orthogonalization
>>> >     happy breakdown tolerance 1e-30
>>> >   maximum iterations=1000, initial guess is zero
>>> >   tolerances:  relative=1e-05, absolute=1e-50, divergence=10000.
>>> >   left preconditioning
>>> >   using UNPRECONDITIONED norm type for convergence test
>>> > PC Object: 4 MPI processes
>>> >   type: fieldsplit
>>> >   PC has not been set up so information may be incomplete
>>> >     FieldSplit with Schur preconditioner, factorization FULL
>>>
>>> I know that PC is not setup, but if I do it before setting up the SNES,
>>> the error persists. Thanks in advance for your help.
>>>
>>> Best,
>>> Nicolas
>>> --
>>> Nicolás Alejandro Barnafi Wittwer
>>>
>>
>>
>> --
>> Stefano
>>
>
>
> --
> Nicolás Alejandro Barnafi Wittwer
>


-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20211012/76b0ae57/attachment.html>


More information about the petsc-users mailing list