<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    On 4/5/2012 5:17 PM, Matthew Knepley wrote:
    <blockquote
cite="mid:CAMYG4G=xhZjQ_5x=VRT4ZEE67SP3=sf8hGzZCyJLQ8+Mig+UOA@mail.gmail.com"
      type="cite">
      <div class="gmail_extra">On Fri, May 4, 2012 at 11:05 AM, 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">
            <div bgcolor="#FFFFFF" text="#000000"> <br>
              On 4/5/2012 3:05 PM, Matthew Knepley wrote:
              <blockquote type="cite">
                <div class="gmail_extra">On Fri, May 4, 2012 at 8:59 AM,
                  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">
                      <div bgcolor="#FFFFFF" text="#000000"> <br>
                        Hi,<br>
                        <br>
                        Is there anything else I can try to get it
                        working right?<br>
                      </div>
                    </blockquote>
                    <div><br>
                    </div>
                    <div>The MatGetNullSpaceRemove() is missing.</div>
                  </div>
                </div>
              </blockquote>
              Where should I add MatGetNullSpaceRemove and what are its
              syntax? I googled but there's no results.<br>
            </div>
          </blockquote>
          <div><br>
          </div>
          <div>Fixed in p;etsc-dev:</div>
          <div><br>
          </div>
          <div>  <a moz-do-not-send="true"
href="http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Mat/MatNullSpaceRemove.html">http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Mat/MatNullSpaceRemove.html</a></div>
        </div>
      </div>
    </blockquote>
    <br>
    I just compiled the updated petsc-dev but I got the same error msg
    when I use:<br>
    <br>
    call MatNullSpaceRemove(nullspace,b,PETSC_NULL,ierr)<br>
    <br>
    error LNK2019: unresolved external symbol MATNULLSPACEREMOVE
    referenced in function COMPUTERHS<br>
    1&gt;c:\obj_tmp\ex29f\Debug\ex29f.exe : fatal error LNK1120: 1
    unresolved externals<br>
    <blockquote
cite="mid:CAMYG4G=xhZjQ_5x=VRT4ZEE67SP3=sf8hGzZCyJLQ8+Mig+UOA@mail.gmail.com"
      type="cite">
      <div class="gmail_extra">
        <div class="gmail_quote">
          <div><br>
          </div>
          <div><br>
          </div>
          <div>     Matt</div>
          <div> </div>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div bgcolor="#FFFFFF" text="#000000"> Thanks.<br>
              <blockquote type="cite">
                <div class="gmail_extra">
                  <div class="gmail_quote">
                    <div><br>
                    </div>
                    <div>   Matt</div>
                    <div> </div>
                    <blockquote class="gmail_quote" style="margin:0 0 0
                      .8ex;border-left:1px #ccc solid;padding-left:1ex">
                      <div bgcolor="#FFFFFF" text="#000000"> Thanks!<br>
                        <br>
                        <br>
                        On 2/5/2012 10:11 PM, Matthew Knepley wrote:
                        <blockquote type="cite">
                          <div class="gmail_extra">On Wed, May 2, 2012
                            at 1:55 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">
                                <div bgcolor="#FFFFFF" text="#000000">
                                  Hi,<br>
                                  <br>
                                  I did a MatView and VecView on both C
                                  and Fortran, right after Mat and Vec
                                  assembly. I have attached the printout
                                  below. They are exactly the same, but
                                  yet the result is different in Neumann
                                  condition. However, the dirichlet
                                  condition gives the correct ans. Is
                                  there anything else that could be
                                  wrong even if the Mat and Vec are the
                                  same?<br>
                                </div>
                              </blockquote>
                              <div><br>
                              </div>
                              <div>Did you set the null space for the
                                matrix when you have Neumann conditions?</div>
                            </div>
                          </div>
                        </blockquote>
                        Yes, for the matrix, I set as:<br>
                        <br>
                        call
MatNullSpaceCreate(PETSC_COMM_WORLD,PETSC_TRUE,0,PETSC_NULL_OBJECT,nullspace,ierr)<br>
                        <br>
                            call MatSetNullSpace(jac,nullspace,ierr)<br>
                        <br>
                            call MatNullSpaceDestroy(nullspace,ierr)<br>
                        <br>
                        for the Vec, <br>
                        <br>
                        call
MatNullSpaceCreate(PETSC_COMM_WORLD,PETSC_TRUE,0,PETSC_NULL_OBJECT,nullspace,ierr)<br>
                        <br>
                            <b>!call
                          MatNullSpaceRemove(nullspace,b,PETSC_NULL,ierr)</b><br>
                        <br>
                            call MatNullSpaceDestroy(nullspace,ierr)<br>
                        <br>
                        MatNullSpaceRemove was comment out because
                        there's error during linking<br>
                        <br>
                        <br>
                        <blockquote type="cite">
                          <div class="gmail_extra">
                            <div class="gmail_quote">
                              <div><br>
                              </div>
                              <div>   Matt</div>
                              <div> </div>
                              <blockquote class="gmail_quote"
                                style="margin:0 0 0 .8ex;border-left:1px
                                #ccc solid;padding-left:1ex">
                                <div bgcolor="#FFFFFF" text="#000000">
                                  Thanks!<br>
                                  <br>
                                  Fortran:<br>
                                  <br>
                                  Matrix Object: 1 MPI processes<br>
                                    type: seqaij<br>
                                  row 0: (0, 2)  (1, -1)  (3, -1)<br>
                                  row 1: (0, -1)  (1, 3)  (2, -1)  (4,
                                  -1)<br>
                                  row 2: (1, -1)  (2, 2)  (5, -1)<br>
                                  row 3: (0, -1)  (3, 3)  (4, -1)  (6,
                                  -1)<br>
                                  row 4: (1, -1)  (3, -1)  (4, 4)  (5,
                                  -1)  (7, -1)<br>
                                  row 5: (2, -1)  (4, -1)  (5, 3)  (8,
                                  -1)<br>
                                  row 6: (3, -1)  (6, 2)  (7, -1)<br>
                                  row 7: (4, -1)  (6, -1)  (7, 3)  (8,
                                  -1)<br>
                                  row 8: (5, -1)  (7, -1)  (8, 2)<br>
                                  Vector Object:Vec_0000000084000000_0 1
                                  MPI processes<br>
                                    type: mpi<br>
                                  Process [0]<br>
                                  0.25<br>
                                  0.0205213<br>
                                  1.135e-005<br>
                                  0.0205213<br>
                                  0.00168449<br>
                                  9.31663e-007<br>
                                  1.135e-005<br>
                                  9.31663e-007<br>
                                  5.15289e-010<br>
                                  Vector Object:Vec_0000000084000000_1 1
                                  MPI processes<br>
                                    type: mpi<br>
                                  Process [0]<br>
                                  0.14924<br>
                                  0.0242397<br>
                                  -0.0260347<br>
                                  0.0242397<br>
                                  -0.0256192<br>
                                  -0.0400102<br>
                                  -0.0260347<br>
                                  -0.0400102<br>
                                  -0.0400102<br>
                                  Press any key to continue . . .<br>
                                  <br>
                                  C:<br>
                                  <br>
                                  Matrix Object: 1 MPI processes<br>
                                    type: seqaij<br>
                                  row 0: (0, 2)  (1, -1)  (3, -1) <br>
                                  row 1: (0, -1)  (1, 3)  (2, -1)  (4,
                                  -1) <br>
                                  row 2: (1, -1)  (2, 2)  (5, -1) <br>
                                  row 3: (0, -1)  (3, 3)  (4, -1)  (6,
                                  -1) <br>
                                  row 4: (1, -1)  (3, -1)  (4, 4)  (5,
                                  -1)  (7, -1) <br>
                                  row 5: (2, -1)  (4, -1)  (5, 3)  (8,
                                  -1) <br>
                                  row 6: (3, -1)  (6, 2)  (7, -1) <br>
                                  row 7: (4, -1)  (6, -1)  (7, 3)  (8,
                                  -1) <br>
                                  row 8: (5, -1)  (7, -1)  (8, 2) <br>
                                  Vector Object:Vec_0x1d3b000_0 1 MPI
                                  processes<br>
                                    type: mpi<br>
                                  Process [0]<br>
                                  0.25<br>
                                  0.0205212<br>
                                  1.135e-05<br>
                                  0.0205212<br>
                                  0.00168449<br>
                                  9.31663e-07<br>
                                  1.135e-05<br>
                                  9.31663e-07<br>
                                  5.15288e-10<br>
                                  Vector Object:Vec_0x1d3b000_1 1 MPI
                                  processes<br>
                                    type: mpi<br>
                                  Process [0]<br>
                                  0.139311<br>
                                  0.0305751<br>
                                  -0.0220633<br>
                                  0.0305751<br>
                                  -0.0135158<br>
                                  -0.042185<br>
                                  -0.0220633<br>
                                  -0.042185<br>
                                  -0.058449<br>
                                  <br>
                                  <br>
                                  <br>
                                  <pre cols="72">Yours sincerely,

TAY wee-beng</pre>
                                  <br>
                                  On 1/5/2012 11:54 PM, Matthew Knepley
                                  wrote:
                                  <blockquote type="cite">
                                    <div class="gmail_extra">On Tue, May
                                      1, 2012 at 5:48 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>
                                          Do you mean my method is
                                          wrong?<br>
                                          <br>
                                          I am following the template of
                                          ex22f,<br>
                                          <br>
                                          where the variables are
                                          declared as :<br>
                                          <br>
                                          PetscScalar  v(5)<br>
                                          <br>
                                          MatStencil   row(4),col(4,5)<br>
                                          <br>
                                          Hence,<br>
                                          <br>
                                          for the neumann BC<br>
                                          <br>
                                          num = 1<br>
                                          <br>
                                                         if (j/=0) then<br>
                                          <br>
                                                             v(num) =
                                          -rho*HxdHy<br>
                                          <br>
                                                           
                                           col(MatStencil_i,num) = i<br>
                                          <br>
                                                           
                                           col(MatStencil_j,num) = j-1<br>
                                          <br>
                                                             num = num +
                                          1<br>
                                          <br>
                                                         end if<br>
                                          <br>
                                                         if (i/=0) then<br>
                                          <br>
                                                             v(num) =
                                          -rho*HydHx<br>
                                          <br>
                                                           
                                           col(MatStencil_i,num) = i-1<br>
                                          <br>
                                                           
                                           col(MatStencil_j,num) = j<br>
                                          <br>
                                                             num = num +
                                          1<br>
                                          <br>
                                                         end if<br>
                                          <br>
                                                         if (i/=mx-1)
                                          then<br>
                                          <br>
                                                             v(num) =
                                          -rho*HydHx<br>
                                          <br>
                                                           
                                           col(MatStencil_i,num) = i+1<br>
                                          <br>
                                                           
                                           col(MatStencil_j,num) = j<br>
                                          <br>
                                                             num = num +
                                          1<br>
                                          <br>
                                                         end if<br>
                                          <br>
                                                         if (j/=my-1)
                                          then<br>
                                          <br>
                                                             v(num) =
                                          -rho*HxdHy<br>
                                          <br>
                                                           
                                           col(MatStencil_i,num) = i<br>
                                          <br>
                                                           
                                           col(MatStencil_j,num) = j+1<br>
                                          <br>
                                                             num = num +
                                          1<br>
                                          <br>
                                                         end if<br>
                                          <br>
                                                         v(num) =
                                          ((num-1)/2.0)*rho*(HxdHy +
                                          HydHx)<br>
                                          <br>
                                                         print *, v<br>
                                          <br>
                                                       
                                           col(MatStencil_i,num) = i<br>
                                          <br>
                                                       
                                           col(MatStencil_j,num) = j<br>
                                          <br>
                                                         !num = num + 1<br>
                                          <br>
                                                         call
                                          MatSetValuesStencil(jac,i1,row,num,col,v,INSERT_VALUES,ierr)<br>
                                          <br>
                                          I do not get any more out of
                                          range error. However,my ans is
                                          still different from that of
                                          ex29 in C.<br>
                                        </blockquote>
                                        <div><br>
                                        </div>
                                        <div>This is very simple. You
                                          have an error in your code.
                                          Checking it is very simple:
                                          run the code and</div>
                                        <div>break in MatSetValues().
                                          Make sure ex29 makes calls
                                          with exactly the same indices
                                          as your ex29f.</div>
                                        <div><br>
                                        </div>
                                        <div>    Matt</div>
                                        <div> </div>
                                        <blockquote class="gmail_quote"
                                          style="margin:0 0 0
                                          .8ex;border-left:1px #ccc
                                          solid;padding-left:1ex"> Yours
                                          sincerely,<br>
                                          <br>
                                          TAY wee-beng<br>
                                        </blockquote>
                                      </div>
                                      <div><br>
                                        <span><font color="#888888"> <span><font
                                                color="#888888"> </font></span></font></span></div>
                                      <span><font color="#888888"> <span><font
                                              color="#888888"> -- <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></font></span></div>
                                    <span><font color="#888888"> </font></span></blockquote>
                                  <span><font color="#888888"> </font></span></div>
                                <span><font color="#888888"> </font></span></blockquote>
                              <span><font color="#888888"> </font></span></div>
                            <span><font color="#888888"> <br>
                                <br clear="all">
                                <span class="HOEnZb"><font
                                    color="#888888">
                                    <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></font></span></div>
                          <span class="HOEnZb"><font color="#888888"> </font></span></blockquote>
                        <span class="HOEnZb"><font color="#888888"> </font></span></div>
                      <span class="HOEnZb"><font color="#888888"> </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></div>
              </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>
      </div>
    </blockquote>
  </body>
</html>