<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>