On Fri, Jun 29, 2012 at 6:22 PM, Michele Rosso <span dir="ltr"><<a href="mailto:mrosso@uci.edu" target="_blank">mrosso@uci.edu</a>></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">
    <font face="Ubuntu">Hi Jed,<br>
      <br>
      thank you for your reply.<br>
      I checked the PETSc version currently installed on my system (Blue
      Gene P); it is 3.1-p2<br>
      so I will use the DA type.<br>
      Also, I cannot take advantage of DMDAGlobalToNatural since version
      3.1 does not support it.<br>
      I was able to solve a simple Poisson system successfully but the
      solution vector is not in the correct order<br>
      and I do not understand how to fix this. Is there an equivalent to
    </font><font face="Ubuntu">DMDAGlobalToNatural in version 3.1?<br></font></div></blockquote><div><br></div><div>The code is here:</div><div><br></div><div><a href="http://www.mcs.anl.gov/petsc/petsc-current/src/dm/impls/da/dagtol.c.html#DMDANaturalToGlobalBegin">http://www.mcs.anl.gov/petsc/petsc-current/src/dm/impls/da/dagtol.c.html#DMDANaturalToGlobalBegin</a></div>
<div><br></div><div>It should work in 3.1 with minor alterations. Otherwise, you can build your own 3.3.</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"><font face="Ubuntu">
      Thank you,<br>
      Michele<br>
    </font><font face="Ubuntu"><br>
       <br>
    </font>
    <div>On 06/26/2012 11:36 AM, Jed Brown
      wrote:<br>
    </div>
    <blockquote type="cite">
      <div class="gmail_quote">On Tue, Jun 26, 2012 at 10:24 AM, Michele
        Rosso <span dir="ltr"><<a href="mailto:mrosso@uci.edu" target="_blank">mrosso@uci.edu</a>></span>
        wrote:<br>
        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div text="#000000" bgcolor="#FFFFFF"> <font face="Ubuntu">Thanks
              Jed for your reply.<br>
              <br>
              1) I will use the DMDA object type then. I am still not
              very clear about the difference between DA and DMDA
              though.<br>
            </font></div>
        </blockquote>
        <div><br>
        </div>
        <div>DM is the generic interface, DMDA is the structured grid
          implementation. It used to be called just DA and managed a bit
          different. Maybe you were looking at old docs?</div>
        <div> </div>
        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div text="#000000" bgcolor="#FFFFFF"><font face="Ubuntu"> <br>
              2) I am not interested in having ghost nodes updated. I
              want the proper values of the solution on the proper
              processor.<br>
                   I have to fill the known-terms-vector with
              nodes-dependent values ( in contrast with  </font>ex45f.F,
            where vector b is filled with 1s, thus there is<br>
                 no dependence on the grid location). Since every
            processor defines "non-local" (according to the PETSc
            internal ordering) components, the vector is re-arranged<br>
                 and so is the solution vector.  So I will have on every
            process a solution  which partially should be on a
            difference process. And this is not about ghost cell.<br>
                Sorry for this long explanation but I am trying to be as
            clear as I can.<br>
          </div>
        </blockquote>
        <div><br>
        </div>
        <div><a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DM/DMDAGlobalToNaturalBegin.html" target="_blank">http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DM/DMDAGlobalToNaturalBegin.html</a></div>

        <div> </div>
        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div text="#000000" bgcolor="#FFFFFF"> <br>
            Thank you fro your help and patience,<br>
            <br>
            Michele
            <div>
              <div><br>
                <br>
                <font face="Ubuntu"><br>
                  <br>
                  <br>
                  <br>
                  <br>
                  <br>
                  <br>
                </font>
                <div>On 06/26/2012 10:42 AM, Jed Brown wrote:<br>
                </div>
                <blockquote type="cite">
                  <div class="gmail_quote">On Tue, Jun 26, 2012 at 9:37
                    AM, Michele Rosso <span dir="ltr"><<a href="mailto:mrosso@uci.edu" target="_blank">mrosso@uci.edu</a>></span>
                    wrote:<br>
                    <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                      <div text="#000000" bgcolor="#FFFFFF"> <font face="Ubuntu">Hi,<br>
                          <br>
                          I need some help to use the PETSc library
                          inside my Fortran 95 code.<br>
                          My goal is to solve a symmetric linear system
                          that derives from the finite difference
                          discretization<br>
                          of the Poisson equation. I will use the
                          preconditioned conjugate method.<br>
                          <br>
                          I am mostly interested in how to decompose my
                          data among the different processes. <br>
                          In particular:<br>
                          <br>
                          1) Since my code already implements the
                          2D-decomposition, would it be best to build
                          the matrix with the  DMDA object type, DA
                          object type<br>
                               or the regular Mat type? <br>
                        </font></div>
                    </blockquote>
                    <div><br>
                    </div>
                    <div>It is certainly easiest to just use DMDA (and
                      you will get geometric multigrid for free, which
                      is unbeatable for this problem), but you can work
                      directly with Mat if you prefer. See
                      src/ksp/ksp/examples/tutorials/ex45f.F for a
                      Fortran example.</div>
                    <div> </div>
                    <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                      <div text="#000000" bgcolor="#FFFFFF"><font face="Ubuntu"> <br>
                          2) After inserting values into a
                          vector/matrix, PETSc performs any needed
                          message passing of nonlocal components, thus
                          the values locally contained on a process  may
                          be communicated to another process.  How can I
                          revert this at the end of the computation,
                          that is, how can I be sure that the local
                          solution vector contains the values associated
                          to the grid nodes contained into the hosting
                          process?<br>
                        </font></div>
                    </blockquote>
                    <div><br>
                    </div>
                    <div>Please read the section of the user's manual on
                      local versus global spaces and the structured grid
                      decompositions. If you use DM, there is
                      DMGlobalToLocalBegin/End that update the ghost
                      points in the local vectors.</div>
                    <div> </div>
                    <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                      <div text="#000000" bgcolor="#FFFFFF"><font face="Ubuntu"> <br>
                                <br>
                          Thank you,<br>
                          <br>
                          Michele</font> </div>
                    </blockquote>
                  </div>
                  <br>
                </blockquote>
                <br>
                <br>
              </div>
            </div>
          </div>
        </blockquote>
      </div>
      <br>
    </blockquote>
    <br>
    <br>
  </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>