[petsc-users] nonzero prescribed boundary condition

Jed Brown jed at 59A2.org
Wed May 11 01:33:47 CDT 2011


On Wed, May 11, 2011 at 08:16, Tian(ICT) <rongtian at ncic.ac.cn> wrote:

> -snes_mf_operator does not work:
>
> "-pc_type
> lu -ksp_monitor_true_residual -snes_monitor -ksp_monitor -snes_ms_operator"
>

I assume you spelled that -snes_mf_operator (not -snes_ms_operator). Anyway,
I think the problem is that the MFFD operator is not "assembled". At the
bottom of your FormJacobian(), you should have something like:

  ierr = MatAssemblyBegin(*B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
  ierr = MatAssemblyEnd(*B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
  if (*A != *B) {
    ierr = MatAssemblyBegin(*A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
    ierr = MatAssemblyEnd(*A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
  }

The second line resets the base vector when the Krylov operator A is
different from the preconditioning matrix B. When you run with
-snes_mf_operator, SNES internally changes A to be an MFFD matrix, and your
original matrix is used for B, therefore that is the matrix you should call
MatSetValues() on.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110511/84604367/attachment.htm>


More information about the petsc-users mailing list