<div dir="ltr">I tried the patch. It initially didn't compile because of a conflict with the corresponding ftn-auto file. When i commented out the stuff there it compiled, but I got a segfault here:<div><br></div><div><div> at /nobackup/gkenway/packages/petsc-3.9.2/src/mat/impls/mffd/ftn-custom/zmffdf.c:52</div><div>52<span style="white-space:pre"> </span> *ierr = MatMFFDSetBase(*mat,*u,*f);</div><div>(gdb) bt</div><div>#0 matmffdsetbase_ (mat=mat@entry=0x7fffb461ba10 <__anksolver_MOD_drdw>, u=u@entry=0x7fffb461b9a0 <__anksolver_MOD_wvec>, f=0x0, f@entry=0x7fffffffb970, ierr=ierr@entry=0x7fffffffb938)</div><div> at /nobackup/gkenway/packages/petsc-3.9.2/src/mat/impls/mffd/ftn-custom/zmffdf.c:52</div><div>#1 0x00007fffb3d7e871 in anksolver::ankstep (firstcall=<optimized out>) at ../NKSolver/NKSolvers.F90:2891</div><div>#2 0x00007fffb3ebbde9 in solvers::solvestate () at ../solver/solvers.F90:1114</div><div>#3 0x00007fffb3ebe4b5 in solvers::solver () at ../solver/solvers.F90:69</div><div>#4 0x00007fffb3cfcaa7 in f2py_rout_libadflow_solvers_solver (capi_self=<optimized out>, capi_args=<optimized out>, capi_keywds=<optimized out>, f2py_func=0x7fffb3ebe310 <solvers::solver>)</div><div> at libadflowmodule.c:6710</div><div>#5 0x00007fffb3cf8643 in fortran_call (fp=<optimized out>, arg=<optimized out>, kw=<optimized out>) at /u/wk/gkenway/.local/lib/python2.7/site-packages/numpy/f2py/src/fortranobject.c:404</div><div>#6 0x00007ffff7a5aa63 in PyObject_Call () from /lib64/libpython2.7.so.1.0</div><div>#7 0x00007ffff7aef236 in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0</div><div>#8 0x00007ffff7af603d in PyEval_EvalCodeEx () from /lib64/libpython2.7.so.1.0</div><div>#9 0x00007ffff7a7f978 in function_call () from /lib64/libpython2.7.so.1.0</div><div>#10 0x00007ffff7a5aa63 in PyObject_Call () from /lib64/libpython2.7.so.1.0</div><div>#11 0x00007ffff7a69a55 in instancemethod_call () from /lib64/libpython2.7.so.1.0</div><div>#12 0x00007ffff7a5aa63 in PyObject_Call () from /lib64/libpython2.7.so.1.0</div><div>#13 0x00007ffff7ab1e27 in slot_tp_call () from /lib64/libpython2.7.so.1.0</div><div>#14 0x00007ffff7a5aa63 in PyObject_Call () from /lib64/libpython2.7.so.1.0</div><div>#15 0x00007ffff7aef236 in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0</div><div>#16 0x00007ffff7af603d in PyEval_EvalCodeEx () from /lib64/libpython2.7.so.1.0</div><div>#17 0x00007ffff7af6142 in PyEval_EvalCode () from /lib64/libpython2.7.so.1.0</div><div>#18 0x00007ffff7b0f57f in run_mod () from /lib64/libpython2.7.so.1.0</div><div>#19 0x00007ffff7b1073e in PyRun_FileExFlags () from /lib64/libpython2.7.so.1.0</div><div>#20 0x00007ffff7b119c9 in PyRun_SimpleFileExFlags () from /lib64/libpython2.7.so.1.0</div><div>#21 0x00007ffff7b22b7f in Py_Main () from /lib64/libpython2.7.so.1.0</div><div>#22 0x00007ffff6d3f3d5 in __libc_start_main () from /lib64/libc.so.6</div><div>#23 0x000000000040066e in _start ()</div></div><div><br></div><div>which was the new code that got added. So I never got the patch to work correctly. </div><div><br></div><div>However, I circumvented the problem by making my own vector and calling the matfd-function, and then passing in the vector. This is essentially the same thing and I means I don't need an if-def for older versions. </div><div><br></div><div>Gaetan</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Jun 19, 2018 at 11:24 AM Smith, Barry F. <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div class="m_1291046938116067548BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="m_1291046938116067548PlainText"><br>
The code to handle the null vector got mistakenly removed. Please find attached a patch that should resolve the problem.<br>
<br>
</div>
</span></font></div>
<div class="m_1291046938116067548BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="m_1291046938116067548PlainText"><br>
<br>
Please let us know if it works,<br>
<br>
Thanks<br>
<br>
Barry<br>
<br>
<br>
> On Jun 19, 2018, at 12:36 PM, Gaetan Kenway <<a href="mailto:gaetank@gmail.com" target="_blank">gaetank@gmail.com</a>> wrote:<br>
> <br>
> Seems like the MatMFFDSetBase is now broken in petsc 3.9<br>
> <br>
> In 3.7 I used: <br>
> <br>
> call MatMFFDSetBase(dRdW, wVec, PETSC_NULL_OBJECT, ierr)<br>
> <br>
> and the most logical translation is now<br>
> <br>
> call MatMFFDSetBase(dRdW, wVec, PETSC_NULL_VEC, ierr)<br>
> <br>
> Unfortunately this just segfaults:<br>
> #0 VecAXPY (y=y@entry=0x10a3750, alpha=alpha@entry=-1, x=x@entry=0xffffffffffffffff) at /nobackup/gkenway/packages/petsc-3.9.2/src/vec/vec/interface/rvector.c:601<br>
> #1 0x00007fffb697faae in MatMult_MFFD (mat=0x291a150, a=0x10b25c0, y=0x10a3750) at /nobackup/gkenway/packages/petsc-3.9.2/src/mat/impls/mffd/mffd.c:368<br>
> #2 0x00007fffb6847af2 in MatMult (mat=0x291a150, x=x@entry=0x10b25c0, y=y@entry=0x10a3750) at /nobackup/gkenway/packages/petsc-3.9.2/src/mat/interface/matrix.c:2305<br>
> #3 0x00007fffb6e982e7 in PCApplyBAorAB (pc=0xe64d00, side=PC_RIGHT, x=0x10aaee0, y=y@entry=0x10a3750, work=0x10b25c0) at /nobackup/gkenway/packages/petsc-3.9.2/src/ksp/pc/interface/precon.c:680<br>
> #4 0x00007fffb6f02b84 in KSP_PCApplyBAorAB (w=<optimized out>, y=0x10a3750, x=<optimized out>, ksp=0xf135e0) at /u/wk/gkenway/scratch/packages/petsc-3.9.2/include/petsc/private/kspimpl.h:304<br>
> #5 KSPGMRESCycle (itcount=itcount@entry=0x7fffffffb73c, ksp=ksp@entry=0xf135e0) at /nobackup/gkenway/packages/petsc-3.9.2/src/ksp/ksp/impls/gmres/gmres.c:152<br>
> #6 0x00007fffb6f035c2 in KSPSolve_GMRES (ksp=0xf135e0) at /nobackup/gkenway/packages/petsc-3.9.2/src/ksp/ksp/impls/gmres/gmres.c:234<br>
> #7 0x00007fffb6f35050 in KSPSolve (ksp=0xf135e0, b=0xf7ced0, x=0xf77be0) at /nobackup/gkenway/packages/petsc-3.9.2/src/ksp/ksp/interface/itfunc.c:669<br>
> #8 0x00007fffb6f482ee in kspsolve_ (ksp=ksp@entry=0x7fffb461bae8 <__anksolver_MOD_ank_ksp>, b=<optimized out>, b@entry=0x7fffb461b9c8 <__anksolver_MOD_rvec>, x=<optimized out>,
<br>
> x@entry=0x7fffb461ba18 <__anksolver_MOD_deltaw>, ierr=ierr@entry=0x7fffffffb938) at /nobackup/gkenway/packages/petsc-3.9.2/src/ksp/ksp/interface/ftn-custom/zitfuncf.c:54<br>
> #9 0x00007fffb3d7e697 in anksolver::ankstep (firstcall=<optimized out>) at ../NKSolver/NKSolvers.F90:2891<br>
> #10 0x00007fffb3ebbbb9 in solvers::solvestate () at ../solver/solvers.F90:1114<br>
> #11 0x00007fffb3ebe285 in solvers::solver () at ../solver/solvers.F90:69<br>
> #12 0x00007fffb3cfca17 in f2py_rout_libadflow_solvers_solver (capi_self=<optimized out>, capi_args=<optimized out>, capi_keywds=<optimized out>, f2py_func=0x7fffb3ebe0e0 <solvers::solver>)<br>
> at libadflowmodule.c:6710<br>
> #13 0x00007fffb3cf85b3 in fortran_call (fp=<optimized out>, arg=<optimized out>, kw=<optimized out>) at /u/wk/gkenway/.local/lib/python2.7/site-packages/numpy/f2py/src/fortranobject.c:404<br>
> #14 0x00007ffff7a5aa63 in PyObject_Call () from /lib64/libpython2.7.so.1.0<br>
> #15 0x00007ffff7aef236 in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0<br>
> #16 0x00007ffff7af603d in PyEval_EvalCodeEx () from /lib64/libpython2.7.so.1.0<br>
> #17 0x00007ffff7a7f978 in function_call () from /lib64/libpython2.7.so.1.0<br>
> #18 0x00007ffff7a5aa63 in PyObject_Call () from /lib64/libpython2.7.so.1.0<br>
> #19 0x00007ffff7a69a55 in instancemethod_call () from /lib64/libpython2.7.so.1.0<br>
> #20 0x00007ffff7a5aa63 in PyObject_Call () from /lib64/libpython2.7.so.1.0<br>
> #21 0x00007ffff7ab1e27 in slot_tp_call () from /lib64/libpython2.7.so.1.0<br>
> #22 0x00007ffff7a5aa63 in PyObject_Call () from /lib64/libpython2.7.so.1.0<br>
> #23 0x00007ffff7aef236 in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0<br>
> #24 0x00007ffff7af603d in PyEval_EvalCodeEx () from /lib64/libpython2.7.so.1.0<br>
> #25 0x00007ffff7af6142 in PyEval_EvalCode () from /lib64/libpython2.7.so.1.0<br>
> #26 0x00007ffff7b0f57f in run_mod () from /lib64/libpython2.7.so.1.0<br>
> #27 0x00007ffff7b1073e in PyRun_FileExFlags () from /lib64/libpython2.7.so.1.0<br>
> #28 0x00007ffff7b119c9 in PyRun_SimpleFileExFlags () from /lib64/libpython2.7.so.1.0<br>
> #29 0x00007ffff7b22b7f in Py_Main () from /lib64/libpython2.7.so.1.0<br>
> #30 0x00007ffff6d3f3d5 in __libc_start_main () from /lib64/libc.so.6<br>
> #31 0x000000000040066e in _start ()<br>
> <br>
> Thanks,<br>
> <br>
> Gaetan<br>
> <br>
> <br>
> <br>
> <br>
<br>
</div>
</span></font></div>
</div>
</blockquote></div>