<div dir="ltr"><div dir="ltr"><div dir="ltr">On Mon, Apr 1, 2019 at 9:08 AM Nicola Creati via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello,<br>
<br>
thanks Barry. I cannot test both codes, C and Python, since the filling <br>
of the Jacobian matrix  get the following Error:<br>
<br>
Traceback (most recent call last):<br>
   File "PETSc/petscts.pxi", line 382, in petsc4py.PETSc.TS_IJacobian<br>
   File "ex13.py", line 61, in Jacobian_func<br>
     B.setValueStencil(row, col, value)<br>
   File "PETSc/Mat.pyx", line 948, in petsc4py.PETSc.Mat.setValueStencil<br>
   File "PETSc/petscmat.pxi", line 1100, in <br>
petsc4py.PETSc.matsetvaluestencil<br>
petsc4py.PETSc.Error: error code 63<br>
[0] TSComputeIJacobian() line 912 in <br>
/home/ncreati/Downloads/petsc-3.10.3/src/ts/interface/ts.c<br>
[0] MatSetValuesStencil() line 1576 in <br>
/home/ncreati/Downloads/petsc-3.10.3/src/mat/interface/matrix.c<br>
[0] MatSetValuesLocal() line 2152 in <br>
/home/ncreati/Downloads/petsc-3.10.3/src/mat/interface/matrix.c<br>
[0] MatSetValues() line 1349 in <br>
/home/ncreati/Downloads/petsc-3.10.3/src/mat/interface/matrix.c<br>
[0] MatSetValues_SeqAIJ() line 477 in <br>
/home/ncreati/Downloads/petsc-3.10.3/src/mat/impls/aij/seq/aij.c<br>
[0] Argument out of range<br>
[0] Inserting a new nonzero at (9,8) in the matrix<br></blockquote><div><br></div><div>This comes from improper preallocation of the matrix. You can call</div><div><br></div><div>  J.setOption(MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE)</div><div><br></div><div>to turn it off I believe. If you created this matrix yourself, then its probably</div><div>just a logic error in preallocation. If you got it from a DM, then you a</div><div>trying to insert outside the stencil you told the DM about.</div><div><br></div><div>  Thanks,</div><div><br></div><div>    Matt</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">
The above exception was the direct cause of the following exception:<br>
<br>
SystemError: <built-in method insert of list object at 0x7fa47b53c0c8> <br>
returned a result with an error set<br>
Exception ignored in: 'petsc4py.PETSc.traceback'<br>
SystemError: <built-in method insert of list object at 0x7fa47b53c0c8> <br>
returned a result with an error set<br>
Traceback (most recent call last):<br>
   File "ex13.py", line 121, in <module><br>
     ts.solve(u)<br>
   File "PETSc/TS.pyx", line 657, in petsc4py.PETSc.TS.solve<br>
petsc4py.PETSc.Error: error code 73<br>
[0] TSSolve() line 3775 in <br>
/home/ncreati/Downloads/petsc-3.10.3/src/ts/interface/ts.c<br>
[0] TSStep() line 3592 in <br>
/home/ncreati/Downloads/petsc-3.10.3/src/ts/interface/ts.c<br>
[0] TSStep_Theta() line 216 in <br>
/home/ncreati/Downloads/petsc-3.10.3/src/ts/impls/implicit/theta/theta.c<br>
[0] TSTheta_SNESSolve() line 176 in <br>
/home/ncreati/Downloads/petsc-3.10.3/src/ts/impls/implicit/theta/theta.c<br>
[0] SNESSolve() line 4397 in <br>
/home/ncreati/Downloads/petsc-3.10.3/src/snes/interface/snes.c<br>
[0] SNESSolve_NEWTONLS() line 224 in <br>
/home/ncreati/Downloads/petsc-3.10.3/src/snes/impls/ls/ls.c<br>
[0] KSPSolve() line 723 in <br>
/home/ncreati/Downloads/petsc-3.10.3/src/ksp/ksp/interface/itfunc.c<br>
[0] KSPSetUp() line 391 in <br>
/home/ncreati/Downloads/petsc-3.10.3/src/ksp/ksp/interface/itfunc.c<br>
[0] PCSetUp() line 932 in <br>
/home/ncreati/Downloads/petsc-3.10.3/src/ksp/pc/interface/precon.c<br>
[0] PCSetUp_ILU() line 134 in <br>
/home/ncreati/Downloads/petsc-3.10.3/src/ksp/pc/impls/factor/ilu/ilu.c<br>
[0] MatGetOrdering() line 180 in <br>
/home/ncreati/Downloads/petsc-3.10.3/src/mat/order/sorder.c<br>
[0] Object is in wrong state<br>
[0] Not for unassembled matrix<br>
<br>
I believe that my Python conversion is wrong but I cannot figure it out.<br>
<br>
Nicola<br>
<br>
<br>
-- <br>
<br>
Nicola Creati<br>
Istituto Nazionale di Oceanografia e di Geofisica Sperimentale - OGS <a href="http://www.inogs.it" rel="noreferrer" target="_blank">www.inogs.it</a><br>
Dipartimento di Geofisica della Litosfera Geophysics of Lithosphere Department<br>
CARS (Cartography and Remote Sensing) Research Group <a href="http://www.inogs.it/Cars/" rel="noreferrer" target="_blank">http://www.inogs.it/Cars/</a><br>
Borgo Grotta Gigante 42/c 34010 Sgonico - Trieste - ITALY <a href="mailto:ncreati@ogs.trieste.it" target="_blank">ncreati@ogs.trieste.it</a><br>
off.   +39 040 2140 213<br>
fax.   +39 040 327307<br>
<br>
_____________________________________________________________________<br>
This communication, that may contain confidential and/or legally privileged information, is intended solely for the use of the intended addressees. Opinions, conclusions and other information contained in this message, that do not relate to the official business of OGS, shall be considered as not given or endorsed by it. Every opinion or advice contained in this communication is subject to the terms and conditions provided by the agreement governing the engagement with such a client. Any use, disclosure, copying or distribution of the contents of this communication by a not-intended recipient or in violation of the purposes of this communication is strictly prohibited and may be unlawful. For Italy only: Ai sensi del D.Lgs.196/2003 - "T.U. sulla Privacy" si precisa che le informazioni contenute in questo messaggio sono riservate ed a uso esclusivo del destinatario.<br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div></div>