<div dir="ltr">On Thu, Feb 21, 2013 at 6:16 PM, Amneet Bhalla <span dir="ltr"><<a href="mailto:mail2amneet@gmail.com" target="_blank">mail2amneet@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Jed, the thing is that I have nonnative PETSc data to work with. It's from SAMRAI<div>
library. We have already defined MatShell to define the individual operators that act</div><div>on nonnative vectors; so writing explicit matrices in PETSc would be very difficult (atleast for me)</div>

<div>and time consuming. What we want is PETSc's algorithm (and NOT the data structures)</div><div> to solve the problem.   </div></blockquote><div><br></div><div style>So I would reiterate:</div><div style><br></div>
<div style><div style="font-family:arial,sans-serif;font-size:13px">1) Solve your system with a standard KSP solver, like GMRES</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">
2) Tell PCFIELDSPLIT about your fields using PCFieldSplitSetIS(), <a href="http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/PC/PCFieldSplitSetIS.html" target="_blank">http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/PC/PCFieldSplitSetIS.html</a></div>
<div><br></div><div style>When running FieldSplit, crank down on all solvers (ksp_rtol 1.0e-10) to start and see if there</div><div style>is any hope of solving it. This will take forever to run. If it works, start backing off the tolerances.</div>
<div style>The tolerances that need to stay low represent the blocks you need to fill-in with an approximation</div><div style>that can be used to build a preconditioner.</div><div style><br></div><div style>   Matt</div>
</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div><div class="h5"><div class="gmail_quote">
On Thu, Feb 21, 2013 at 5:06 PM, Jed Brown <span dir="ltr"><<a href="mailto:jedbrown@mcs.anl.gov" target="_blank">jedbrown@mcs.anl.gov</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div class="gmail_extra"><br><div class="gmail_quote">
On Thu, Feb 21, 2013 at 4:19 PM, Amneet Bhalla <span dir="ltr"><<a href="mailto:mail2amneet@gmail.com" target="_blank">mail2amneet@gmail.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div>Can you guys comment on what example case would be best to start off for shell <div>
operators with FieldSplit? The examples I am looking into all start with creating native </div>


<div>PETSc matrices and vectors. </div></div></blockquote></div><br><br></div></div><div class="gmail_extra">Amneet, do you already have code that applies all the "blocks" of your coupled system or are you starting something new? If it's something new, please don't use MatNest/MatShell just yet. If you have tested existing code, then wrapping it in MatShell/MatNest is fine. If you are working on something new, I recommend the progression below. It will encourage better program structure and better debuggability, and will ultimately be faster than trying to "skip" steps.<br>



<br><div>Step 1: Just write a residual and use -snes_mf to solve all matrix-free without preconditioning.<br></div><div><br>Step 2: Assemble an approximate Jacobian and use -snes_mf_operator<br></div><div><br>Step
 3: use fd_coloring (if possible) to see how much solver benefit you 
could gain by implementing the full Jacobian. Also use fieldsplit 
solvers to find out which blocks of the Jacobian are most important to 
assemble.<br>
<br></div><div>Step 4: Implement those blocks of the Jacobian that you need for effective preconditioning.<br><br></div><div>Step
 5: Profile, consider those preconditioners that are most effective and 
the suitability of the discretization for matrix-free application. If 
you spend a lot of time/memory in things like MatGetSubMatrix, then add 
an option to use MatNest. If you have overly heavy matrices (in terms of
 memory, bandwidth, or assembly time)  that need not be completely 
assembled for effective preconditioning, add an option to use MatShell 
for those parts.<br>
</div><div><div> </div></div><br></div></div>
</blockquote></div><br><br clear="all"><div><br></div></div></div><span class=""><font color="#888888">-- <br><div>Amneet <br><br></div><div><br></div><div><br></div>
</font></span></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
</div></div>