[petsc-users] Fwd: Questions using PCFIELDSPLIT
Adriano Côrtes
adrimacortes at gmail.com
Sun Dec 15 19:18:42 CST 2013
Dear Jed,
Your comments helped a lot, and yes there was a sign problem on the
linear system (that is the linear system was being computed as
skew-symmetric), but I'm still confused of what is going on and what
Petsc is doing inside. With the same setting of the last emails if I
use the options
-snes_type ksponly
-ksp_type minres
-pc_type fieldsplit
-ksp_rtol 1e-10
-snes_rtol 1e-5
#Velocity
-fieldsplit_u_ksp_type cg
-fieldsplit_u_pc_type bjacobi
-fieldsplit_u_ksp_rtol 1e-03
#Pressure
-fieldsplit_p_ksp_type cg
-fieldsplit_p_pc_type bjacobi
-fieldsplit_p_ksp_rtol 1e-05
then I obtain the following output
0 SNES Function norm 9.644918978350e-02
0 KSP Residual norm 1.297267655138e-01
1 KSP Residual norm 4.149750591421e-02
2 KSP Residual norm 4.122610029985e-02
3 KSP Residual norm 4.791668571219e-06
4 KSP Residual norm 2.031018181616e-06
5 KSP Residual norm 1.909762237646e-06
6 KSP Residual norm 1.731835783849e-07
7 KSP Residual norm 1.341665413528e-07
8 KSP Residual norm 8.811364282590e-08
9 KSP Residual norm 4.886961323938e-08
10 KSP Residual norm 2.900680379628e-08
[...]
937 KSP Residual norm 1.313544933163e-11
938 KSP Residual norm 1.311355904193e-11
939 KSP Residual norm 1.309345645355e-11
940 KSP Residual norm 1.307133575538e-11
941 KSP Residual norm 1.305066151443e-11
942 KSP Residual norm 1.302844549705e-11
943 KSP Residual norm 1.300734852025e-11
944 KSP Residual norm 1.298516726546e-11
945 KSP Residual norm 1.296378673406e-11
Linear solve converged due to CONVERGED_RTOL iterations 945
1 SNES Function norm 6.472010982055e-07
Nonlinear solve converged due to CONVERGED_ITS iterations 1
L2 errors: u=4.09689e-05 p=8.94374e-05
BUT if I just change -fieldsplit_p_ksp_rtol to 1e-03 I get the output
0 SNES Function norm 9.644918978350e-02
0 KSP Residual norm 1.297267655138e-01
1 KSP Residual norm 4.149750203710e-02
2 KSP Residual norm 4.122609648562e-02
3 KSP Residual norm 6.532932382460e-06
4 KSP Residual norm 5.527048080699e-06
5 KSP Residual norm 3.343796902211e-06
6 KSP Residual norm 7.517943074624e-08
Linear solve did not converge due to DIVERGED_INDEFINITE_MAT iterations 7
1 SNES Function norm 6.833028247701e-07
Nonlinear solve did not converge due to DIVERGED_LINEAR_SOLVE iterations 1
L2 errors: u=4.09697e-05 p=8.95148e-05
That is in the first case MINRES is converging (very slowly) after 945
iterations, but in the second it is signaled as
DIVERGED_INDEFINITE_MAT. Another information: I used the options
-fieldsplit_u_ksp_converged_reason and
-fieldsplit_p_ksp_converged_reason for both cases, and for both in
every iteration I get
Linear solve converged due to CONVERGED_RTOL iterations XXX
Can you help interpret those behaviors? Any clue?
Thanks again.
Adriano.
2013/12/14 Jed Brown <jedbrown at mcs.anl.gov>
>
> Adriano Côrtes <adrimacortes at gmail.com> writes:
>
> > 2013/12/14 Jed Brown <jedbrown at mcs.anl.gov>
> >>
> >> See that "fieldsplit_p_" uses a MATSCHURCOMPLEMENT and actually iterates
> >> on that reduced system. This is different from what is typically done
> >> in full-space iterative methods.
> >>
> >
> > Dear Jed,
> > Can you elaborate more this comment? What is a MATSCHURCOMPLEMENT
> > object? You mean that S is built? Or is it matrix-free as you said
> > bellow?
>
> It is a special Mat type that applies the action of the Schur complement
> via the definition rather than by explicitly computing its entries.
> This is often referred to as "matrix-free", though it is still a Mat in
> PETSc (Mat in PETSc means "finite-dimensional linear operator").
>
> >> Use -ksp_converged_reason to find out why the linear solve above did not
> >> converge. Maybe due to an indefinite preconditioner?
> >>
> >
> > This was there result of -ksp_converged_reason
> >
> > 0 SNES Function norm 9.644918978350e-02
> > 0 KSP Residual norm 1.297271248442e-01
> > Linear solve did not converge due to DIVERGED_INDEFINITE_MAT iterations 1
> > 1 SNES Function norm 9.644918978350e-02
> > Nonlinear solve did not converge due to DIVERGED_LINEAR_SOLVE iterations 1
> > SNES Object: 1 MPI processes
> >
> > This I didn't understand, because minres is supposed to work for
> > symmetric indefinite matrices. Isn't it? What am I missing here?
>
> MINRES requires an SPD preconditioner. As I guessed earlier, you may
> have just gotten the sign wrong for the preconditioner.
>
> > I will take a look. Thanks. But just to know if I set
> > -fieldsplit_p_ksp_type preonly -fieldsplit_p_pc_type ksp, how do I
> > choose the ksp?
>
> -fieldsplit_p_ksp_ksp_type cg.
>
> > Multigrid V-cycle as you said is the default in this case?
>
> No, but it would be a good choice if the pressure Schur complement is
> similar to a Laplacian. For Stokes (as opposed to finite-time step or
> Navier-Stokes), the Schur complement is spectrally equivalent to a
> scaled mass matrix, so most people use Jacobi.
More information about the petsc-users
mailing list