On Fri, Oct 21, 2011 at 7:48 AM, Klaij, Christiaan <span dir="ltr"><<a href="mailto:C.Klaij@marin.nl">C.Klaij@marin.nl</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;">
> If you just want to see the monitor, why not use the command line or<br>
> PetscOptionsSetValue()?<br>
<br>
I have three ksp's: one for the momentum eqs (GMRES) and one for<br>
the pressure eq (CG) inside the SIMPLE preconditioner and one for<br>
the matrix-free coupled mass-momentum system (FGMRES). The<br>
command line shows me results for all but right now I'm only<br>
interested in monitoring FGMRES on the coupled system.<br>
<br>
<br>
<br>
<br>
> This is the code for setting up the monitor, you can call the part inside<br>
> the if statement yourself if you like.<br>
><br>
> ierr = PetscOptionsString("-ksp_monitor_singular_value","Monitor<br>
> singular<br>
> values","KSPMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr);<br>
> if (flg) {<br>
> ierr = KSPSetComputeSingularValues(ksp,PETSC_TRUE);CHKERRQ(ierr);<br>
> ierr =<br>
> PetscViewerASCIIOpen(((PetscObject)ksp)->comm,monfilename,&monviewer);CHKERRQ(ierr);<br>
> ierr =<br>
> KSPMonitorSet(ksp,KSPMonitorSingularValue,monviewer,(PetscErrorCode<br>
> (*)(void**))PetscViewerDestroy);CHKERRQ(ierr);<br>
> }<br>
<br>
I'm still confused whether it is supposed to work with FGMRES,<br>
the manual states only CG and GMRES. (Besides, I'm using fortran)<br>
<br>
<br>
<br>
> How are you applying the action of the linear operator? If you use finite<br>
> differencing, it could be inaccurate. Is this incompressible or a low-Mach<br>
> compressible formulation? Try -ksp_monitor_true_residual, if the true<br>
> residual drifts from the unpreconditioned residual computed by FGMRES, the<br>
> Krylov space could be losing orthogonality. You can try<br>
> -ksp_gmres_modifiedgramschmidt. Are you losing a lot of progress in<br>
> restarts?<br>
<br>
It's incompressible Navier-Stokes. No finite differencing, the<br>
action is computed directly without approximations. It's right<br>
preconditioning, so preconditioned and true residual should be<br>
the same. I don't get any progress, the residual is stagnating<br>
from the very first iteration way before any restart.<br>
<br>
Regarding modified Gram Schmidt, I tried to set it as follows:<br>
<br>
call KSPGMRESSetOrthogonalization(ksp,KSPGMRESModifiedGramSchmidtOrthogonalization,ierr)<br>
<br>
But my compiler tells me:<br>
<br>
This name does not have a type, and must have an explicit type. [KSPGMRESMODIFIEDGRAMSCHMIDTORTHOGONALIZATIO]<br></blockquote><div><br></div><div>It looks like you have a line length problem.</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;">
(petsc-3.1-p7, fortran with "use petscksp" and #include "finclude/petsckspdef.h")<br>
<br>
<br>
dr. ir. Christiaan Klaij<br>
CFD Researcher<br>
Research & Development<br>
E mailto:<a href="mailto:C.Klaij@marin.nl">C.Klaij@marin.nl</a><br>
T <a href="tel:%2B31%20317%2049%2033%2044" value="+31317493344">+31 317 49 33 44</a><br>
<br>
MARIN<br>
2, Haagsteeg, P.O. Box 28, 6700 AA Wageningen, The Netherlands<br>
T <a href="tel:%2B31%20317%2049%2039%2011" value="+31317493911">+31 317 49 39 11</a>, F <a href="tel:%2B31%20317%2049%2032%2045" value="+31317493245">+31 317 49 32 45</a>, I <a href="http://www.marin.nl" target="_blank">www.marin.nl</a><br>
<br>
</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>