<div class="gmail_extra">On Thu, May 3, 2012 at 3:44 AM, Pavanakumar Mohanamuraly <span dir="ltr">&lt;<a href="mailto:m.pavanakumar@gmail.com" target="_blank">m.pavanakumar@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><div><br></div><div>Currently I am planning to use Petsc Krylov solver for implicit time integration of my CFD code. I need some pointer on the implementation. I am providing a detailed list of things I am not very clear with in both the documentation and the mailing list archives.</div>


<div><br></div><div><span>--&gt; The equations to be solved is of the form :  </span>[ I / \delta t + J ]<span> \delta U^n = - R[ U^n ]</span></div><div><br></div><div>--&gt; The Jacobian J is hard to evaluate exactly and hence we use the finite difference method to evaluate J. I want to use a matrix-free approach so all I need is the action of this J on some vector v.</div>


<div><br></div><div>--&gt; Jv = \frac{\partial R}{\partial U}v = ( R[ U^n + hv ] - R[ U^] ) / h, h is some parameter. Since I is identity matrix and \delta t is fixed this diagonal matrix is trivial to evaluate. Thus [ I / \delta t + J ] is available as a user define function in my solver.</div>


<div><br></div><div>1) Vector U^n is from an unstructured node distribution and is partitioned outside of Petsc. I have both the global indexing and local indexing information along with the ghost node information. </div>


<div>2) I have already defined functions to move data across the ghost nodes given the local variable address and memory stride/offset information.</div><div><div><span>3) In </span>Jacobian-vector Jv evaluation<span>, one has to exchange the ghost cell values of vector v with adjacent processor before the calculation is done.</span></div>


<div>4) I can write the Jacobian-vector Jv evaluation function to perform ghost node exchange before evaluation but I am not clear as to how I can interface my local arrays and local / global indexing information into Petsc.</div>


<div>5) I understand that I have to create a Matrix Shell for the matrix free method and define my user-defined function to evaluate the matrix-vector product given an input vector. But it is not clear as to how Petsc understands how I order my vectors locally and how that corresponds to the global indexes.</div>


<div>6) I cannot use the DA object as it is for structured/contiguous partitioning .i.e., the local indices don&#39;t correspond to contiguous global ordering/indexing. </div><div>7) I also don&#39;t want to use the unstructured mesh and decomposition routines in Petsc and I already have my own. </div>

<div><br></div><div>Can this be done in Petsc ?</div></div></blockquote><div><br></div><div>Yes, there are ??? parts:</div><div><br></div><div>  1) You want to manage unstructured data yourself. The easiest way to do this now is to implement a DM. You just need to provide</div>
<div>      routines for making global and local vectors (you have this), and routines for mapping between them (you have this). You will have</div><div>      to use petsc-dev, but this definitely looks like the easiest thing to do.</div>
<div><br></div><div>     a) If you consider using part of our infrastructure, you can build a PetscSection and a PetscSF, and everything else will be automatically</div><div>         calculated. These are very new things, so there is not a lot of documentation, and thus you might prefer to do the whole DM yourself.</div>
<div><br></div><div>  2) You want to do matrix-free action of your Jacobian. This is easy using MatShell, however the real question is How will you precondition that</div><div>       equation?</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><div><br></div><div>Thanking you in anticipation.</div>
<div><br></div><div>Regards,</div><span class="HOEnZb"><font color="#888888"><div><br></div><div><br></div>-- <br><br></font></span></div><span class="HOEnZb"><font color="#888888"><div>Pavanakumar Mohanamuraly<br><br>
</div>
</font></span></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>