Hello everyone,<br><br>I've implemented a new routine for computing the differencing parameter "h" used with the finite-difference based matrix-free Jacobian by the MATMFFD module. This new approach, which I labeled "avg", can be found in the article entitled "Jacobian-free Newton-Krylov methods: a survey of approaches and applications", 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>"b" is the square root of the machine round-off (10^-6 for 64-bit double precision);</li><li>"n" is the problem dimension (number of unknowns);</li>
<li>"a" is the vector in the Jacobian-vector product that is being approximated (J(U)a);</li><li>"S" = 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'm experiecing difficulties to (statically) incorporate the routine in the PETSc API. I'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 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'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 "avg.c" and "avg.o" to {PETSC_DIR}/src/mat/impls/mffd/makefile;</li>
<li>Added the macro "#define MATMFFD_AVG "avg"" to the petscmat.h file;</li><li>Called MatMFFDRegisterDynamic(MATMFFD_AVG, path, "MatMFFDCreate_AVG", 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>