<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno mar 12 ott 2021 alle ore 13:56 Nicolás Barnafi <<a href="mailto:nabw91@gmail.com">nabw91@gmail.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello PETSc users, <div><br></div><div>first email sent!<br>I am creating a SNES solver using fenics, my example runs smoothly with 'newtonls', but gives a strange missing function error (error 83):</div><div><br></div></div></blockquote><div><br></div><div>Dolphin swallows any useful error information returned from PETSc. You can try using the below code snippet at the beginning of your script<br></div><div><br></div><div>from petsc4py import PETSc<br>from dolfin import *<br># Remove the dolfin error handler<br>PETSc.Sys.pushErrorHandler('python')</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div></div><div><br></div><div>these are the relevant lines of code where I setup the solver:</div><div><br></div><div>> problem = SNESProblem(Res, sol, bcs)<br>> b = PETScVector() # same as b = PETSc.Vec()<br>> J_mat = PETScMatrix()<br>> snes = PETSc.SNES().create(MPI.COMM_WORLD)<br>> snes.setFunction(problem.F, b.vec())<br>> snes.setJacobian(problem.J, J_mat.mat())<br>> # Set up fieldsplit<br>> ksp = snes.ksp<br>> ksp.setOperators(J_mat.mat())<br>> pc = ksp.pc<br>> pc.setType('fieldsplit')<br>> dofmap_s = V.sub(0).dofmap().dofs()<br>> dofmap_p = V.sub(1).dofmap().dofs()<br>> is_s = PETSc.IS().createGeneral(dofmap_s)<br>> is_p = PETSc.IS().createGeneral(dofmap_p)<br>> pc.setFieldSplitIS((None, is_s), (None, is_p))<br>> pc.setFromOptions()<br>> snes.setFromOptions()<br>> snes.setUp()<br><div> <br></div></div></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div>If it can be useful, this are the outputs of snes.view(), ksp.view() and pc.view():</div><div><br></div><div>> type: qn<br>> SNES has not been set up so information may be incomplete<br>> type is BROYDEN, restart type is DEFAULT, scale type is JACOBIAN<br>> Stored subspace size: 10<br>> Using the single reduction variant.<br>> maximum iterations=10000, maximum function evaluations=30000<br>> tolerances: relative=1e-08, absolute=1e-50, solution=1e-08<br>> total number of function evaluations=0<br>> norm schedule ALWAYS<br>> SNESLineSearch Object: 4 MPI processes<br>> type: basic<br>> maxstep=1.000000e+08, minlambda=1.000000e-12<br>> tolerances: relative=1.000000e-08, absolute=1.000000e-15, lambda=1.000000e-08<br>> maximum iterations=1<br></div><div>> KSP Object: 4 MPI processes<br>> type: gmres<br>> restart=1000, using Modified Gram-Schmidt Orthogonalization<br>> happy breakdown tolerance 1e-30<br>> maximum iterations=1000, initial guess is zero<br>> tolerances: relative=1e-05, absolute=1e-50, divergence=10000.<br>> left preconditioning<br>> using UNPRECONDITIONED norm type for convergence test<br>> PC Object: 4 MPI processes<br>> type: fieldsplit<br>> PC has not been set up so information may be incomplete<br>> FieldSplit with Schur preconditioner, factorization FULL<br></div><div><br></div><div>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. </div><div><br></div><div>Best, </div><div>Nicolas</div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr">Nicolás Alejandro Barnafi Wittwer</div></div></div></div></div></div>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature">Stefano</div></div>