<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi,<br>
    <br>
    I added "Vec x,b" after "KSP ksp"<br>
    and then "call KSPGetSolution(ksp, x, ierr)"<br>
    <br>
    I wanted to see the output so I added "call VecView(x,ierr)" but I
    got this error:<br>
    <br>
    [0]PETSC ERROR:
    ------------------------------------------------------------------------<br>
    [0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation
    Violation, probably memory access out of range<br>
    [0]PETSC ERROR: Try option -start_in_debugger or
    -on_error_attach_debugger<br>
    [0]PETSC ERROR: or see
    <a class="moz-txt-link-freetext" href="http://www.mcs.anl.gov/petsc/petsc-as/documentation/faq.html#valgrind">http://www.mcs.anl.gov/petsc/petsc-as/documentation/faq.html#valgrind</a>[0]PETSC
    ERROR: or try <a class="moz-txt-link-freetext" href="http://valgrind.org">http://valgrind.org</a> on GNU/linux and Apple Mac OS X to
    find memory corruption errors<br>
    [0]PETSC ERROR: configure using --with-debugging=yes, recompile,
    link, and run <br>
    [0]PETSC ERROR: to get more information on the crash.<br>
    [0]PETSC ERROR: --------------------- Error Message
    ------------------------------------<br>
    [0]PETSC ERROR: Signal received!<br>
    [0]PETSC ERROR:
    ------------------------------------------------------------------------<br>
    [0]PETSC ERROR: Petsc Release Version 3.2.0, Patch 5, Sat Oct 29
    13:45:54 CDT 2011 <br>
    [0]PETSC ERROR: See docs/changes/index.html for recent updates.<br>
    [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.<br>
    [0]PETSC ERROR: See docs/index.html for manual pages.<br>
    [0]PETSC ERROR:
    ------------------------------------------------------------------------<br>
    [0]PETSC ERROR: ./ex22f on a arch-linu named hpc12 by wtay Sun Apr
    22 21:02:14 2012<br>
    [0]PETSC ERROR: Libraries linked from
    /home/wtay/Lib/petsc-3.2-p5_mumps_rel/lib<br>
    [0]PETSC ERROR: Configure run at Sun Nov 27 15:18:15 2011<br>
    [0]PETSC ERROR: Configure options --with-mpi-dir=/opt/openmpi-1.5.3/
    --with-blas-lapack-dir=/opt/intel_xe_2011/mkl/lib/intel64/
    --with-debugging=0 --download-hypre=1
    --prefix=/home/wtay/Lib/petsc-3.2-p5_mumps_rel COPTFLAGS=-O3
    FOPTFLAGS=-O3 --download-mumps=1 --download-parmetis=1
    --download-scalapack=1 --download-blacs=1<br>
    [0]PETSC ERROR:
    ------------------------------------------------------------------------<br>
    [0]PETSC ERROR: User provided function() line 0 in unknown directory
    unknown file<br>
--------------------------------------------------------------------------<br>
    MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD <br>
    with errorcode 59.<br>
    <br>
    <br>
    <pre class="moz-signature" cols="72">Yours sincerely,

TAY wee-beng</pre>
    <br>
    On 22/4/2012 2:53 PM, Matthew Knepley wrote:
    <blockquote
cite="mid:CAMYG4G=Gm4mgeAU3amGGjT87a7QVSkJQrYuLNqDsYs+HxmsgDA@mail.gmail.com"
      type="cite">On Sun, Apr 22, 2012 at 3:31 AM, TAY wee-beng <span
        dir="ltr">&lt;<a moz-do-not-send="true"
          href="mailto:zonexo@gmail.com">zonexo@gmail.com</a>&gt;</span>
      wrote:<br>
      <div class="gmail_quote">
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div bgcolor="#FFFFFF" text="#000000"> Hi,<br>
            <br>
            I am using petsc-dev 2012-04-20.<br>
            <br>
            Btw, I'm referring to :<br>
            <br>
            <a moz-do-not-send="true"
href="http://www.mcs.anl.gov/petsc/petsc-dev/src/ksp/ksp/examples/tutorials/ex22f.F.html"
              target="_blank">http://www.mcs.anl.gov/petsc/petsc-dev/src/ksp/ksp/examples/tutorials/ex22f.F.html</a><br>
            <br>
            Part of the code is :<br>
            <br>
            <pre>call KSPSetFromOptions(ksp,ierr)
      call KSPSetUp(ksp,ierr)
      call KSPSolve(ksp,PETSC_NULL_OBJECT,PETSC_NULL_OBJECT,ierr)
      call KSPDestroy(ksp,ierr)
      call DMDestroy(da,ierr)
      call PetscFinalize(ierr)</pre>
            <br>
            <br>
            Unlike other codes like ex29c or ex45c, there isn't a "call
            KSPGetSolution(ksp,x,ierr)"<br>
          </div>
        </blockquote>
        <div><br>
        </div>
        <div>You need to declare "Vec x", and then you can call
          KSPGetSolution(ksp, x, ierr)</div>
        <div><br>
        </div>
        <div>&nbsp; &nbsp;Matt</div>
        <div>&nbsp;</div>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div bgcolor="#FFFFFF" text="#000000"> Also I want to add
            "call VecView(x,ierr)" to print out the results, which is
            usally added after the above.<br>
            <br>
            Thank you<br>
            <pre cols="72">Yours sincerely,

TAY wee-beng</pre>
            <br>
            On 22/4/2012 1:14 AM, Matthew Knepley wrote:
            <blockquote type="cite">On Sat, Apr 21, 2012 at 6:31 PM, TAY
              wee-beng <span dir="ltr">&lt;<a moz-do-not-send="true"
                  href="mailto:zonexo@gmail.com" target="_blank">zonexo@gmail.com</a>&gt;</span>
              wrote:<br>
              <div class="gmail_quote">
                <blockquote class="gmail_quote" style="margin:0 0 0
                  .8ex;border-left:1px #ccc solid;padding-left:1ex"> Hi,<br>
                  <br>
                  May I know if ex22f is complete? I can't find :<br>
                  <br>
                  call KSPGetSolution(ksp,x,ierr)<br>
                  <br>
                  If I entered it, it says x not found.<br>
                </blockquote>
                <div><br>
                </div>
                <div>This is correct in petsc-dev. What version are you
                  using?</div>
                <div><br>
                </div>
                <div>&nbsp; Thanks,</div>
                <div><br>
                </div>
                <div>&nbsp; &nbsp; Matt</div>
                <div>&nbsp;</div>
                <blockquote class="gmail_quote" style="margin:0 0 0
                  .8ex;border-left:1px #ccc solid;padding-left:1ex">
                  Thank you!<span class="HOEnZb"><font color="#888888"><span><font
                          color="#888888"><br>
                          <br>
                          -- <br>
                          Yours sincerely,<br>
                          <br>
                          TAY wee-beng<br>
                          <br>
                        </font></span></font></span></blockquote>
                <span class="HOEnZb"><font color="#888888"> </font></span></div>
              <span class="HOEnZb"><font color="#888888"> <br>
                  <br clear="all">
                  <div><br>
                  </div>
                  -- <br>
                  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<br>
                </font></span></blockquote>
          </div>
        </blockquote>
      </div>
      <br>
      <br clear="all">
      <div><br>
      </div>
      -- <br>
      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<br>
    </blockquote>
  </body>
</html>