<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jul 26, 2013 at 2:32 PM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="im">On Fri, Jul 26, 2013 at 7:28 AM, Bishesh Khanal <span dir="ltr"><<a href="mailto:bisheshkh@gmail.com" target="_blank">bisheshkh@gmail.com</a>></span> wrote:<br>
</div><div class="gmail_extra"><div class="gmail_quote"><div class="im">
<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"><br><div class="gmail_extra"><br><br><div class="gmail_quote">

On Wed, Jul 17, 2013 at 9:48 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-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div>Bishesh Khanal <<a href="mailto:bisheshkh@gmail.com" target="_blank">bisheshkh@gmail.com</a>> writes:<br>



<br>
> Now, I implemented two different approaches, each for both 2D and 3D, in<br>
> MATLAB. It works for the smaller sizes but I have problems solving it for<br>
> the problem size I need (250^3 grid size).<br>
> I use staggered grid with p on cell centers, and components of v on cell<br>
> faces. Similar split up of K to cell center and faces to account for the<br>
> variable viscosity case)<br>
<br>
</div>Okay, you're using a staggered-grid finite difference discretization of<br>
variable-viscosity Stokes.  This is a common problem and I recommend<br>
starting with PCFieldSplit with Schur complement reduction (make that<br>
work first, then switch to block preconditioner).  </blockquote><div><br></div><div>Ok, I made my 3D problem work with PCFieldSplit with Schur complement reduction using the options:<br>-pc_fieldsplit_type schur -pc_fieldsplit_detect_saddle_point -fieldsplit_1_ksp_constant_null_space<br>


</div><div> <br><br></div><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">You can use PCLSC or<br>
(probably better for you), assemble a preconditioning matrix containing<br>
the inverse viscosity in the pressure-pressure block.  This diagonal<br>
matrix is a spectrally equivalent (or nearly so, depending on<br>
discretization) approximation of the Schur complement.  The velocity<br>
block can be solved with algebraic multigrid.  Read the PCFieldSplit<br>
docs (follow papers as appropriate) and let us know if you get stuck.<br>
</blockquote></div><br></div><div class="gmail_extra">Now,  I got a little confused in how exactly to use command line options to use multigrid for the velocity bock and PCLS for the pressure block. After going through the manual I tried the following:<br>

</div></div></blockquote><div> </div></div><div>You want Algebraic Multigrid</div><div><br></div><div>-pc_type fieldsplit -pc_fieldsplit_detect_saddle_point</div><div>-pc_fieldsplit_type schur</div><div>  -fieldsplit_0_pc_type gamg</div>
<div class="im">
<div>  -fieldsplit_1_ksp_type fgmres</div><div>   -fieldsplit_1_ksp_constant_null_space</div><div>   -fieldsplit_1_ksp_monitor_short</div><div>   -fieldsplit_1_pc_type lsc</div><div>-ksp_converged_reason<br></div><div><br>
</div></div></div></div></div></blockquote><div>I tried the above set of options but the solution I get seem to be not correct. The velocity field I get are quite different than the one I got before without using gamg which were the expected one.<br>
Note: (Also, I had to add one extra option of -fieldsplit_1_ksp_gmres_restart 100 , because the fieldsplit_1_ksp residual norm did not converge within default 30 iterations before restarting).<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div class="im"><div>
</div></div><div>   Matt</div><div><div class="h5"><div><br></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 dir="ltr"><div class="gmail_extra">

<br></div><div class="gmail_extra">but I get the following errror:<br><br>[0]PETSC ERROR: --------------------- Error Message ------------------------------------<br>[0]PETSC ERROR: Null argument, when expecting valid pointer!<br>


[0]PETSC ERROR: Null Object: Parameter # 2!<br>[0]PETSC ERROR: ------------------------------------------------------------------------<br>[0]PETSC ERROR: Petsc Release Version 3.4.2, Jul, 02, 2013 <br>[0]PETSC ERROR: See docs/changes/index.html for recent updates.<br>


[0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.<br>[0]PETSC ERROR: See docs/index.html for manual pages.<br>[0]PETSC ERROR: ------------------------------------------------------------------------<br>

[0]PETSC ERROR: src/AdLemMain on a arch-linux2-cxx-debug named edwards by bkhanal Fri Jul 26 14:23:40 2013<br>
[0]PETSC ERROR: Libraries linked from /home/bkhanal/Documents/softwares/petsc-3.4.2/arch-linux2-cxx-debug/lib<br>[0]PETSC ERROR: Configure run at Fri Jul 19 14:25:01 2013<br>[0]PETSC ERROR: Configure options --with-cc=gcc --with-fc=g77 --with-cxx=g++ --download-f-blas-lapack=1 --download-mpich=1 -with-clanguage=cxx --download-hypre=1<br>


[0]PETSC ERROR: ------------------------------------------------------------------------<br>[0]PETSC ERROR: MatPtAP() line 8166 in /home/bkhanal/Documents/softwares/petsc-3.4.2/src/mat/interface/matrix.c<br>[0]PETSC ERROR: PCSetUp_MG() line 628 in /home/bkhanal/Documents/softwares/petsc-3.4.2/src/ksp/pc/impls/mg/mg.c<br>


[0]PETSC ERROR: PCSetUp() line 890 in /home/bkhanal/Documents/softwares/petsc-3.4.2/src/ksp/pc/interface/precon.c<br>[0]PETSC ERROR: KSPSetUp() line 278 in /home/bkhanal/Documents/softwares/petsc-3.4.2/src/ksp/ksp/interface/itfunc.c<br>


[0]PETSC ERROR: KSPSolve() line 399 in /home/bkhanal/Documents/softwares/petsc-3.4.2/src/ksp/ksp/interface/itfunc.c<br>[0]PETSC ERROR: PCApply_FieldSplit_Schur() line 807 in /home/bkhanal/Documents/softwares/petsc-3.4.2/src/ksp/pc/impls/fieldsplit/fieldsplit.c<br>


[0]PETSC ERROR: PCApply() line 442 in /home/bkhanal/Documents/softwares/petsc-3.4.2/src/ksp/pc/interface/precon.c<br>[0]PETSC ERROR: KSP_PCApply() line 227 in /home/bkhanal/Documents/softwares/petsc-3.4.2/include/petsc-private/kspimpl.h<br>


[0]PETSC ERROR: KSPInitialResidual() line 64 in /home/bkhanal/Documents/softwares/petsc-3.4.2/src/ksp/ksp/interface/itres.c<br>[0]PETSC ERROR: KSPSolve_GMRES() line 239 in /home/bkhanal/Documents/softwares/petsc-3.4.2/src/ksp/ksp/impls/gmres/gmres.c<br>


[0]PETSC ERROR: KSPSolve() line 441 in /home/bkhanal/Documents/softwares/petsc-3.4.2/src/ksp/ksp/interface/itfunc.c<br><br></div><div class="gmail_extra"><br></div></div>
</blockquote></div></div></div><br><br clear="all"><div class="im"><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></div>
</blockquote></div><br></div></div>