Hello everyone,<br><br>I&#39;ve implemented a new routine for computing the differencing parameter &quot;h&quot; used with the finite-difference based matrix-free Jacobian by the MATMFFD module. This new approach, which I labeled &quot;avg&quot;, can be found in the article entitled &quot;Jacobian-free Newton-Krylov methods: a survey of approaches and applications&quot;, authored by D. A. Knoll and D. E. Keyes. It has the following formula:<br>
<br>h = b * {[S / (n * || a ||)] + 1}<br><br><ul><li>&quot;b&quot; is the square root of the machine round-off (10^-6 for 64-bit double precision);</li><li>&quot;n&quot; is the problem dimension (number of unknowns);</li>
<li>&quot;a&quot; is the vector in the Jacobian-vector product that is being approximated (J(U)a);</li><li>&quot;S&quot; = sum[i = 1, n] |Ui| is the sum of the absolute values of the solution vector entries.</li></ul>Well, the programming part is all done and correct, but I&#39;m experiecing difficulties to (statically) incorporate the routine in the PETSc API. I&#39;ve done everything that I could, but whenever I try to test my code by running an example with the -mat_mffd_type avg command-line option, I get this error message:<br>
<br>{PETSC_DIR}/petsc-2.3.3-p15/src/snes/examples/tutorials$ mpirun -np 2 ./ex5 -snes_mf -mat_mffd_type avg<br>[1]PETSC ERROR: --------------------- Error Message ------------------------------------<br>[1]PETSC ERROR: Unknown type. Check for miss-spelling or missing external package needed for type!<br>
[1]PETSC ERROR: Unknown MatMFFD type avg given!<br>[1]PETSC ERROR: ------------------------------------------------------------------------<br>[1]PETSC ERROR: Petsc Release Version 2.3.3, Patch 15, Tue Sep 23 10:02:49 CDT 2008 HG revision: 31306062cd1a6f6a2496fccb4878f485c9b91760<br>
[1]PETSC ERROR: See docs/changes/index.html for recent updates.<br>[1]PETSC ERROR: See docs/faq.html for hints about trouble shooting.<br>[1]PETSC ERROR: See docs/index.html for manual pages.<br>[1]PETSC ERROR: ------------------------------------------------------------------------<br>
[1]PETSC ERROR: ./ex5 on a linux-gnu named hepburn by rafael Thu Jan&nbsp; 8 19:52:36 2009<br>[1]PETSC ERROR: Libraries linked from /home/rafael/ufes/petsc-2.3.3-p15/lib/linux-gnu-c-debug<br>[1]PETSC ERROR: Configure run at Sun Nov 23 02:11:51 2008<br>
[1]PETSC ERROR: Configure options --with-cc=mpicc --with-cxx=mpicxx --with-fc=0 --download-c-blas-lapack=1 --with-shared=0<br>[1]PETSC ERROR: ------------------------------------------------------------------------<br>[1]PETSC ERROR: MatMFFDSetType() line 107 in src/mat/impls/mffd/mffd.c<br>
[1]PETSC ERROR: MatMFFDSetFromOptions() line 493 in src/mat/impls/mffd/mffd.c<br>[1]PETSC ERROR: SNESSetUp() line 1194 in src/snes/interface/snes.c<br>[1]PETSC ERROR: SNESSolve() line 1855 in src/snes/interface/snes.c<br>
[1]PETSC ERROR: main() line 209 in src/snes/examples/tutorials/ex5.c<br>[hepburn:22928] MPI_ABORT invoked on rank 1 in communicator MPI_COMM_WORLD with errorcode 86<br>[0]PETSC ERROR: --------------------- Error Message ------------------------------------<br>
[0]PETSC ERROR: Unknown type. Check for miss-spelling or missing external package needed for type!<br>[0]PETSC ERROR: Unknown MatMFFD type avg given!<br>[0]PETSC ERROR: ------------------------------------------------------------------------<br>
<br>So, here&#39;s what I did:<br><br><ol><li>Put the source code (avg.c) in the {PETSC_DIR}/src/mat/impls/mffd/ directory (when writing the avg.c, I basically followed the same code structure in the wp.c file);</li><li>Added &quot;avg.c&quot; and &quot;avg.o&quot; to {PETSC_DIR}/src/mat/impls/mffd/makefile;</li>
<li>Added the macro &quot;#define MATMFFD_AVG &quot;avg&quot;&quot; to the petscmat.h file;</li><li>Called MatMFFDRegisterDynamic(MATMFFD_AVG, path, &quot;MatMFFDCreate_AVG&quot;, MatMFFDCreate_AVG) inside the MatMFFDRegisterAll routine in the mfregis.c file.</li>
</ol>What step am I missing here? Why is this not working? Thanks in advance!<br><br>Rafael<br><br>