[petsc-users] 2D Poisson on nonuniform meshes

Matthew Knepley knepley at gmail.com
Tue Sep 1 04:15:50 CDT 2015


On Tue, Sep 1, 2015 at 4:12 AM, Filippo Leonardi <
filippo.leonardi at sam.math.ethz.ch> wrote:

> Thanks Matt,
>
>
>
> I use the "natural scaling" of the Laplacian Lapl * x = b. The grid is
> *still* uniform.
>
>
>
> I give you a couple of results:
>
>
>
> 1 ) This is e.g. gmres + gamg + 4 levels. As you can see it converges
> after 2 iterations which is totally strange. The solution is incorrect.
>
>
>
> 2 ) This is mg + galerkin matrices + levels. Result is incorrect
>
>
>
> 3 ) Default: works fine
>
>
>
> 4) LU: works fine
>
>
>
> I remove the constant nullspace as usual.
>

If you have a constant null space, how does 4) work? It should fail with a
zero pivot since
the matrix is singular.

   Matt


> I use the usual setcomputeoperator business and compute rhs.
>
>
>
> Instead, if I scale to Lapl * dx * dy * x = b * dx * dy (things work fine
> also with MG). This is fine with uniform grid but I do not know how to do
> that properly on nonuniform.
>
>
>
> Let me know if you need code pieces or other details.
>
>
>
> 1)
>
>
>
>  0 KSP Residual norm 1.793027353791e-05
>  0 KSP preconditioned resid norm 1.793027353791e-05 true resid norm
> 7.912994695029e-03 ||r(i)||/||b|| 1.000000000000e+00
>  1 KSP Residual norm 2.662212708666e-20
>  1 KSP preconditioned resid norm 2.662212708666e-20 true resid norm
> 3.120963188535e-02 ||r(i)||/||b|| 3.944098674167e+00
> Linear solve converged due to CONVERGED_RTOL iterations 1
> KSP Object: 1 MPI processes
>  type: gmres
>    GMRES: restart=30, using Classical (unmodified) Gram-Schmidt
> Orthogonalization with no iterative refinement
>    GMRES: happy breakdown tolerance 1e-30
>  maximum iterations=10000, initial guess is zero
>  tolerances:  relative=1e-05, absolute=1e-50, divergence=10000
>  left preconditioning
>  using PRECONDITIONED norm type for convergence test
> PC Object: 1 MPI processes
>  type: gamg
>    MG: type is MULTIPLICATIVE, levels=4 cycles=v
>      Cycles per PCApply=1
>      Using Galerkin computed coarse grid matrices
>      GAMG specific options
>        Threshold for dropping small values from graph 0
>        AGG specific options
>          Symmetric graph false
>  Coarse grid solver -- level -------------------------------
>    KSP Object:    (mg_coarse_)     1 MPI processes
>      type: gmres
>        GMRES: restart=30, using Classical (unmodified) Gram-Schmidt
> Orthogonalization with no iterative refinement
>        GMRES: happy breakdown tolerance 1e-30
>      maximum iterations=1, initial guess is zero
>      tolerances:  relative=1e-05, absolute=1e-50, divergence=10000
>      left preconditioning
>      using NONE norm type for convergence test
>    PC Object:    (mg_coarse_)     1 MPI processes
>      type: bjacobi
>        block Jacobi: number of blocks = 1
>        Local solve is same for all blocks, in the following KSP and PC
> objects:
>        KSP Object:        (mg_coarse_sub_)         1 MPI processes
>          type: preonly
>          maximum iterations=1, initial guess is zero
>          tolerances:  relative=1e-05, absolute=1e-50, divergence=10000
>          left preconditioning
>          using NONE norm type for convergence test
>        PC Object:        (mg_coarse_sub_)         1 MPI processes
>          type: lu
>            LU: out-of-place factorization
>            tolerance for zero pivot 2.22045e-14
>            using diagonal shift on blocks to prevent zero pivot [INBLOCKS]
>            matrix ordering: nd
>            factor fill ratio given 5, needed 1.10953
>              Factored matrix follows:
>                Mat Object:                 1 MPI processes
>                  type: seqaij
>                  rows=33, cols=33
>                  package used to perform factorization: petsc
>                  total: nonzeros=1013, allocated nonzeros=1013
>                  total number of mallocs used during MatSetValues calls =0
>                    using I-node routines: found 21 nodes, limit used is 5
>          linear system matrix = precond matrix:
>          Mat Object:           1 MPI processes
>            type: seqaij
>            rows=33, cols=33
>            total: nonzeros=913, allocated nonzeros=913
>            total number of mallocs used during MatSetValues calls =0
>              not using I-node routines
>      linear system matrix = precond matrix:
>      Mat Object:       1 MPI processes
>        type: seqaij
>        rows=33, cols=33
>        total: nonzeros=913, allocated nonzeros=913
>        total number of mallocs used during MatSetValues calls =0
>          not using I-node routines
>  Down solver (pre-smoother) on level 1 -------------------------------
>    KSP Object:    (mg_levels_1_)     1 MPI processes
>      type: chebyshev
>        Chebyshev: eigenvalue estimates:  min = -1.79769e+307, max = -inf
>        Chebyshev: eigenvalues estimated using gmres with translations  [0
> 0.1; 0 1.1]
>        KSP Object:        (mg_levels_1_esteig_)         1 MPI processes
>          type: gmres
>            GMRES: restart=30, using Classical (unmodified) Gram-Schmidt
> Orthogonalization with no iterative refinement
>            GMRES: happy breakdown tolerance 1e-30
>          maximum iterations=10, initial guess is zero
>          tolerances:  relative=1e-05, absolute=1e-50, divergence=10000
>          left preconditioning
>          using NONE norm type for convergence test
>      maximum iterations=2
>      tolerances:  relative=1e-05, absolute=1e-50, divergence=10000
>      left preconditioning
>      using nonzero initial guess
>      using NONE norm type for convergence test
>    PC Object:    (mg_levels_1_)     1 MPI processes
>      type: sor
>        SOR: type = local_symmetric, iterations = 1, local iterations = 1,
> omega = 1
>      linear system matrix = precond matrix:
>      Mat Object:       1 MPI processes
>        type: seqaij
>        rows=401, cols=401
>        total: nonzeros=9777, allocated nonzeros=9777
>        total number of mallocs used during MatSetValues calls =0
>          not using I-node routines
>  Up solver (post-smoother) same as down solver (pre-smoother)
>  Down solver (pre-smoother) on level 2 -------------------------------
>    KSP Object:    (mg_levels_2_)     1 MPI processes
>      type: chebyshev
>        Chebyshev: eigenvalue estimates:  min = -1.79769e+307, max = -inf
>        Chebyshev: eigenvalues estimated using gmres with translations  [0
> 0.1; 0 1.1]
>        KSP Object:        (mg_levels_2_esteig_)         1 MPI processes
>          type: gmres
>            GMRES: restart=30, using Classical (unmodified) Gram-Schmidt
> Orthogonalization with no iterative refinement
>            GMRES: happy breakdown tolerance 1e-30
>          maximum iterations=10, initial guess is zero
>          tolerances:  relative=1e-05, absolute=1e-50, divergence=10000
>          left preconditioning
>          using NONE norm type for convergence test
>      maximum iterations=2
>      tolerances:  relative=1e-05, absolute=1e-50, divergence=10000
>      left preconditioning
>      using nonzero initial guess
>      using NONE norm type for convergence test
>    PC Object:    (mg_levels_2_)     1 MPI processes
>      type: sor
>        SOR: type = local_symmetric, iterations = 1, local iterations = 1,
> omega = 1
>      linear system matrix = precond matrix:
>      Mat Object:       1 MPI processes
>        type: seqaij
>        rows=2296, cols=2296
>        total: nonzeros=25038, allocated nonzeros=25038
>        total number of mallocs used during MatSetValues calls =0
>          not using I-node routines
>  Up solver (post-smoother) same as down solver (pre-smoother)
>  Down solver (pre-smoother) on level 3 -------------------------------
>    KSP Object:    (mg_levels_3_)     1 MPI processes
>      type: chebyshev
>        Chebyshev: eigenvalue estimates:  min = -1.79769e+307, max = -inf
>        Chebyshev: eigenvalues estimated using gmres with translations  [0
> 0.1; 0 1.1]
>        KSP Object:        (mg_levels_3_esteig_)         1 MPI processes
>          type: gmres
>            GMRES: restart=30, using Classical (unmodified) Gram-Schmidt
> Orthogonalization with no iterative refinement
>            GMRES: happy breakdown tolerance 1e-30
>          maximum iterations=10, initial guess is zero
>          tolerances:  relative=1e-05, absolute=1e-50, divergence=10000
>          left preconditioning
>          using NONE norm type for convergence test
>      maximum iterations=2
>      tolerances:  relative=1e-05, absolute=1e-50, divergence=10000
>      left preconditioning
>      using nonzero initial guess
>      using NONE norm type for convergence test
>    PC Object:    (mg_levels_3_)     1 MPI processes
>      type: sor
>        SOR: type = local_symmetric, iterations = 1, local iterations = 1,
> omega = 1
>      linear system matrix = precond matrix:
>      Mat Object:       1 MPI processes
>        type: seqaij
>        rows=16384, cols=16384
>        total: nonzeros=81920, allocated nonzeros=81920
>        total number of mallocs used during MatSetValues calls =0
>          has attached null space
>          not using I-node routines
>  Up solver (post-smoother) same as down solver (pre-smoother)
>  linear system matrix = precond matrix:
>  Mat Object:   1 MPI processes
>    type: seqaij
>    rows=16384, cols=16384
>    total: nonzeros=81920, allocated nonzeros=81920
>    total number of mallocs used during MatSetValues calls =0
>      has attached null space
>      not using I-node routines
>
>
>
> 2)
>
>
>
>  0 KSP Residual norm 1.010294060491e-05
>  0 KSP preconditioned resid norm 1.010294060491e-05 true resid norm
> 1.086379257868e-03 ||r(i)||/||b|| 1.000000000000e+00
>  1 KSP Residual norm 8.803303876758e-20
>  1 KSP preconditioned resid norm 8.803303876758e-20 true resid norm
> 2.101751936637e-03 ||r(i)||/||b|| 1.934639235254e+00
> Linear solve converged due to CONVERGED_RTOL iterations 1
> KSP Object: 1 MPI processes
>  type: gmres
>    GMRES: restart=30, using Classical (unmodified) Gram-Schmidt
> Orthogonalization with no iterative refinement
>    GMRES: happy breakdown tolerance 1e-30
>  maximum iterations=10000, initial guess is zero
>  tolerances:  relative=1e-05, absolute=1e-50, divergence=10000
>  left preconditioning
>  using PRECONDITIONED norm type for convergence test
> PC Object: 1 MPI processes
>  type: mg
>    MG: type is MULTIPLICATIVE, levels=4 cycles=v
>      Cycles per PCApply=1
>      Using Galerkin computed coarse grid matrices
>  Coarse grid solver -- level -------------------------------
>    KSP Object:    (mg_coarse_)     1 MPI processes
>      type: preonly
>      maximum iterations=1, initial guess is zero
>      tolerances:  relative=1e-05, absolute=1e-50, divergence=10000
>      left preconditioning
>      using NONE norm type for convergence test
>    PC Object:    (mg_coarse_)     1 MPI processes
>      type: lu
>        LU: out-of-place factorization
>        tolerance for zero pivot 2.22045e-14
>        using diagonal shift on blocks to prevent zero pivot [INBLOCKS]
>        matrix ordering: nd
>        factor fill ratio given 5, needed 4.83507
>          Factored matrix follows:
>            Mat Object:             1 MPI processes
>              type: seqaij
>              rows=256, cols=256
>              package used to perform factorization: petsc
>              total: nonzeros=11140, allocated nonzeros=11140
>              total number of mallocs used during MatSetValues calls =0
>                not using I-node routines
>      linear system matrix = precond matrix:
>      Mat Object:       1 MPI processes
>        type: seqaij
>        rows=256, cols=256
>        total: nonzeros=2304, allocated nonzeros=2304
>        total number of mallocs used during MatSetValues calls =0
>          not using I-node routines
>  Down solver (pre-smoother) on level 1 -------------------------------
>    KSP Object:    (mg_levels_1_)     1 MPI processes
>      type: chebyshev
>        Chebyshev: eigenvalue estimates:  min = -1.79769e+307, max = -inf
>        Chebyshev: eigenvalues estimated using gmres with translations  [0
> 0.1; 0 1.1]
>        KSP Object:        (mg_levels_1_esteig_)         1 MPI processes
>          type: gmres
>            GMRES: restart=30, using Classical (unmodified) Gram-Schmidt
> Orthogonalization with no iterative refinement
>            GMRES: happy breakdown tolerance 1e-30
>          maximum iterations=10, initial guess is zero
>          tolerances:  relative=1e-05, absolute=1e-50, divergence=10000
>          left preconditioning
>          using NONE norm type for convergence test
>      maximum iterations=2
>      tolerances:  relative=1e-05, absolute=1e-50, divergence=10000
>      left preconditioning
>      using nonzero initial guess
>      using NONE norm type for convergence test
>    PC Object:    (mg_levels_1_)     1 MPI processes
>      type: sor
>        SOR: type = local_symmetric, iterations = 1, local iterations = 1,
> omega = 1
>      linear system matrix = precond matrix:
>      Mat Object:       1 MPI processes
>        type: seqaij
>        rows=1024, cols=1024
>        total: nonzeros=9216, allocated nonzeros=9216
>        total number of mallocs used during MatSetValues calls =0
>          not using I-node routines
>  Up solver (post-smoother) same as down solver (pre-smoother)
>  Down solver (pre-smoother) on level 2 -------------------------------
>    KSP Object:    (mg_levels_2_)     1 MPI processes
>      type: chebyshev
>        Chebyshev: eigenvalue estimates:  min = -1.79769e+307, max = -inf
>        Chebyshev: eigenvalues estimated using gmres with translations  [0
> 0.1; 0 1.1]
>        KSP Object:        (mg_levels_2_esteig_)         1 MPI processes
>          type: gmres
>            GMRES: restart=30, using Classical (unmodified) Gram-Schmidt
> Orthogonalization with no iterative refinement
>            GMRES: happy breakdown tolerance 1e-30
>          maximum iterations=10, initial guess is zero
>          tolerances:  relative=1e-05, absolute=1e-50, divergence=10000
>          left preconditioning
>          using NONE norm type for convergence test
>      maximum iterations=2
>      tolerances:  relative=1e-05, absolute=1e-50, divergence=10000
>      left preconditioning
>      using nonzero initial guess
>      using NONE norm type for convergence test
>    PC Object:    (mg_levels_2_)     1 MPI processes
>      type: sor
>        SOR: type = local_symmetric, iterations = 1, local iterations = 1,
> omega = 1
>      linear system matrix = precond matrix:
>      Mat Object:       1 MPI processes
>        type: seqaij
>        rows=4096, cols=4096
>        total: nonzeros=36864, allocated nonzeros=36864
>        total number of mallocs used during MatSetValues calls =0
>          not using I-node routines
>  Up solver (post-smoother) same as down solver (pre-smoother)
>  Down solver (pre-smoother) on level 3 -------------------------------
>    KSP Object:    (mg_levels_3_)     1 MPI processes
>      type: chebyshev
>        Chebyshev: eigenvalue estimates:  min = -1.79769e+307, max = -inf
>        Chebyshev: eigenvalues estimated using gmres with translations  [0
> 0.1; 0 1.1]
>        KSP Object:        (mg_levels_3_esteig_)         1 MPI processes
>          type: gmres
>            GMRES: restart=30, using Classical (unmodified) Gram-Schmidt
> Orthogonalization with no iterative refinement
>            GMRES: happy breakdown tolerance 1e-30
>          maximum iterations=10, initial guess is zero
>          tolerances:  relative=1e-05, absolute=1e-50, divergence=10000
>          left preconditioning
>          using NONE norm type for convergence test
>      maximum iterations=2
>      tolerances:  relative=1e-05, absolute=1e-50, divergence=10000
>      left preconditioning
>      using nonzero initial guess
>      using NONE norm type for convergence test
>    PC Object:    (mg_levels_3_)     1 MPI processes
>      type: sor
>        SOR: type = local_symmetric, iterations = 1, local iterations = 1,
> omega = 1
>      linear system matrix = precond matrix:
>      Mat Object:       1 MPI processes
>        type: seqaij
>        rows=16384, cols=16384
>        total: nonzeros=81920, allocated nonzeros=81920
>        total number of mallocs used during MatSetValues calls =0
>          has attached null space
>          not using I-node routines
>  Up solver (post-smoother) same as down solver (pre-smoother)
>  linear system matrix = precond matrix:
>  Mat Object:   1 MPI processes
>    type: seqaij
>    rows=16384, cols=16384
>    total: nonzeros=81920, allocated nonzeros=81920
>    total number of mallocs used during MatSetValues calls =0
>      has attached null space
>      not using I-node routines
>
> 3)
>
>
>
> 0 KSP Residual norm 2.990548680394e-08
>  0 KSP preconditioned resid norm 2.990548680394e-08 true resid norm
> 2.966915112865e-04 ||r(i)||/||b|| 1.000000000000e+00
>  1 KSP Residual norm 2.368703753809e-08
>  1 KSP preconditioned resid norm 2.368703753809e-08 true resid norm
> 3.109667150576e-04 ||r(i)||/||b|| 1.048114634993e+00
>  2 KSP Residual norm 2.236515515253e-08
>  2 KSP preconditioned resid norm 2.236515515253e-08 true resid norm
> 2.655771471955e-04 ||r(i)||/||b|| 8.951289035670e-01
>  3 KSP Residual norm 1.957630940223e-08
>  3 KSP preconditioned resid norm 1.957630940223e-08 true resid norm
> 2.158250768646e-04 ||r(i)||/||b|| 7.274393390250e-01
>  4 KSP Residual norm 1.771416739221e-08
>  4 KSP preconditioned resid norm 1.771416739221e-08 true resid norm
> 2.075204223802e-04 ||r(i)||/||b|| 6.994484657830e-01
>  5 KSP Residual norm 1.617056152936e-08
>  5 KSP preconditioned resid norm 1.617056152936e-08 true resid norm
> 1.908090487285e-04 ||r(i)||/||b|| 6.431227098516e-01
>  6 KSP Residual norm 1.467170521607e-08
>  6 KSP preconditioned resid norm 1.467170521607e-08 true resid norm
> 1.683698119419e-04 ||r(i)||/||b|| 5.674911668750e-01
>  7 KSP Residual norm 1.321526248809e-08
>  7 KSP preconditioned resid norm 1.321526248809e-08 true resid norm
> 1.473617884651e-04 ||r(i)||/||b|| 4.966835344432e-01
>  8 KSP Residual norm 1.174828665876e-08
>  8 KSP preconditioned resid norm 1.174828665876e-08 true resid norm
> 1.458902362707e-04 ||r(i)||/||b|| 4.917236615167e-01
>  9 KSP Residual norm 1.012151625603e-08
>  9 KSP preconditioned resid norm 1.012151625603e-08 true resid norm
> 1.303866699420e-04 ||r(i)||/||b|| 4.394688253015e-01
> 10 KSP Residual norm 7.876439970777e-09
> 10 KSP preconditioned resid norm 7.876439970777e-09 true resid norm
> 1.162414266035e-04 ||r(i)||/||b|| 3.917922224990e-01
> 11 KSP Residual norm 4.981821461221e-09
> 11 KSP preconditioned resid norm 4.981821461221e-09 true resid norm
> 9.075981784793e-05 ||r(i)||/||b|| 3.059063518683e-01
> 12 KSP Residual norm 2.426217812448e-09
> 12 KSP preconditioned resid norm 2.426217812448e-09 true resid norm
> 5.145334699067e-05 ||r(i)||/||b|| 1.734237247556e-01
> 13 KSP Residual norm 1.049060114422e-09
> 13 KSP preconditioned resid norm 1.049060114422e-09 true resid norm
> 2.107527819651e-05 ||r(i)||/||b|| 7.103431475044e-02
> 14 KSP Residual norm 5.887222551677e-10
> 14 KSP preconditioned resid norm 5.887222551677e-10 true resid norm
> 9.047187295472e-06 ||r(i)||/||b|| 3.049358323817e-02
> 15 KSP Residual norm 4.536407095834e-10
> 15 KSP preconditioned resid norm 4.536407095834e-10 true resid norm
> 6.032647097712e-06 ||r(i)||/||b|| 2.033306268708e-02
> 16 KSP Residual norm 3.564018350025e-10
> 16 KSP preconditioned resid norm 3.564018350025e-10 true resid norm
> 5.116056274149e-06 ||r(i)||/||b|| 1.724368941991e-02
> 17 KSP Residual norm 2.744968239957e-10
> 17 KSP preconditioned resid norm 2.744968239957e-10 true resid norm
> 3.648248676660e-06 ||r(i)||/||b|| 1.229643767306e-02
> 18 KSP Residual norm 2.281847233955e-10
> 18 KSP preconditioned resid norm 2.281847233955e-10 true resid norm
> 2.900148270786e-06 ||r(i)||/||b|| 9.774962074955e-03
> 19 KSP Residual norm 1.881670741813e-10
> 19 KSP preconditioned resid norm 1.881670741813e-10 true resid norm
> 2.473850917169e-06 ||r(i)||/||b|| 8.338125032436e-03
> 20 KSP Residual norm 1.581922522755e-10
> 20 KSP preconditioned resid norm 1.581922522755e-10 true resid norm
> 1.965254213304e-06 ||r(i)||/||b|| 6.623897680059e-03
> 21 KSP Residual norm 1.349952347592e-10
> 21 KSP preconditioned resid norm 1.349952347592e-10 true resid norm
> 1.709953736235e-06 ||r(i)||/||b|| 5.763406336838e-03
> 22 KSP Residual norm 1.148754892680e-10
> 22 KSP preconditioned resid norm 1.148754892680e-10 true resid norm
> 1.452723184020e-06 ||r(i)||/||b|| 4.896409667135e-03
> 23 KSP Residual norm 9.889008860663e-11
> 23 KSP preconditioned resid norm 9.889008860663e-11 true resid norm
> 1.259317356950e-06 ||r(i)||/||b|| 4.244534504846e-03
> 24 KSP Residual norm 8.468070834423e-11
> 24 KSP preconditioned resid norm 8.468070834423e-11 true resid norm
> 1.097968496396e-06 ||r(i)||/||b|| 3.700707484468e-03
> 25 KSP Residual norm 7.340678871498e-11
> 25 KSP preconditioned resid norm 7.340678871498e-11 true resid norm
> 9.388293102378e-07 ||r(i)||/||b|| 3.164328181036e-03
> 26 KSP Residual norm 6.452497596580e-11
> 26 KSP preconditioned resid norm 6.452497596580e-11 true resid norm
> 7.907509627807e-07 ||r(i)||/||b|| 2.665229481464e-03
> 27 KSP Residual norm 5.817349095331e-11
> 27 KSP preconditioned resid norm 5.817349095331e-11 true resid norm
> 6.712549222809e-07 ||r(i)||/||b|| 2.262467568992e-03
> 28 KSP Residual norm 5.382715584394e-11
> 28 KSP preconditioned resid norm 5.382715584394e-11 true resid norm
> 5.883671521302e-07 ||r(i)||/||b|| 1.983093987351e-03
> 29 KSP Residual norm 5.072666199584e-11
> 29 KSP preconditioned resid norm 5.072666199584e-11 true resid norm
> 5.417512216577e-07 ||r(i)||/||b|| 1.825974795533e-03
> 30 KSP Residual norm 4.806650672230e-11
> 30 KSP preconditioned resid norm 4.806650672230e-11 true resid norm
> 5.151866485899e-07 ||r(i)||/||b|| 1.736438789084e-03
> 31 KSP Residual norm 4.675001898732e-11
> 31 KSP preconditioned resid norm 4.675001898732e-11 true resid norm
> 4.825947510614e-07 ||r(i)||/||b|| 1.626587659919e-03
> 32 KSP Residual norm 4.530536181592e-11
> 32 KSP preconditioned resid norm 4.530536181592e-11 true resid norm
> 4.648650267512e-07 ||r(i)||/||b|| 1.566829548764e-03
> 33 KSP Residual norm 4.357157235509e-11
> 33 KSP preconditioned resid norm 4.357157235509e-11 true resid norm
> 4.567209908707e-07 ||r(i)||/||b|| 1.539380041209e-03
> 34 KSP Residual norm 4.135715715343e-11
> 34 KSP preconditioned resid norm 4.135715715343e-11 true resid norm
> 4.469703503011e-07 ||r(i)||/||b|| 1.506515465721e-03
> 35 KSP Residual norm 3.851871986267e-11
> 35 KSP preconditioned resid norm 3.851871986267e-11 true resid norm
> 4.364097171314e-07 ||r(i)||/||b|| 1.470920806730e-03
> 36 KSP Residual norm 3.526035391634e-11
> 36 KSP preconditioned resid norm 3.526035391634e-11 true resid norm
> 4.065382561286e-07 ||r(i)||/||b|| 1.370238920439e-03
> 37 KSP Residual norm 3.144895012756e-11
> 37 KSP preconditioned resid norm 3.144895012756e-11 true resid norm
> 3.810168560499e-07 ||r(i)||/||b|| 1.284218932985e-03
> 38 KSP Residual norm 2.735239124106e-11
> 38 KSP preconditioned resid norm 2.735239124106e-11 true resid norm
> 3.407338934429e-07 ||r(i)||/||b|| 1.148445036278e-03
> 39 KSP Residual norm 2.306734554159e-11
> 39 KSP preconditioned resid norm 2.306734554159e-11 true resid norm
> 2.940484127641e-07 ||r(i)||/||b|| 9.910914251948e-04
> 40 KSP Residual norm 1.924842110922e-11
> 40 KSP preconditioned resid norm 1.924842110922e-11 true resid norm
> 2.443693779909e-07 ||r(i)||/||b|| 8.236480273107e-04
> 41 KSP Residual norm 1.618672399310e-11
> 41 KSP preconditioned resid norm 1.618672399310e-11 true resid norm
> 2.034502467604e-07 ||r(i)||/||b|| 6.857299215548e-04
> 42 KSP Residual norm 1.378885267147e-11
> 42 KSP preconditioned resid norm 1.378885267147e-11 true resid norm
> 1.689714775892e-07 ||r(i)||/||b|| 5.695190834970e-04
> 43 KSP Residual norm 1.179601185051e-11
> 43 KSP preconditioned resid norm 1.179601185051e-11 true resid norm
> 1.483783124701e-07 ||r(i)||/||b|| 5.001097329234e-04
> 44 KSP Residual norm 9.928908801463e-12
> 44 KSP preconditioned resid norm 9.928908801463e-12 true resid norm
> 1.276885725440e-07 ||r(i)||/||b|| 4.303748765523e-04
> 45 KSP Residual norm 8.512555069524e-12
> 45 KSP preconditioned resid norm 8.512555069524e-12 true resid norm
> 1.020939171370e-07 ||r(i)||/||b|| 3.441079817022e-04
> 46 KSP Residual norm 7.600214409478e-12
> 46 KSP preconditioned resid norm 7.600214409478e-12 true resid norm
> 8.873369034852e-08 ||r(i)||/||b|| 2.990772805186e-04
> 47 KSP Residual norm 6.577382322417e-12
> 47 KSP preconditioned resid norm 6.577382322417e-12 true resid norm
> 8.285748008098e-08 ||r(i)||/||b|| 2.792714888326e-04
> 48 KSP Residual norm 5.701374824383e-12
> 48 KSP preconditioned resid norm 5.701374824383e-12 true resid norm
> 6.754179947516e-08 ||r(i)||/||b|| 2.276499222452e-04
> 49 KSP Residual norm 5.201909133133e-12
> 49 KSP preconditioned resid norm 5.201909133133e-12 true resid norm
> 5.807496359589e-08 ||r(i)||/||b|| 1.957419116714e-04
> 50 KSP Residual norm 4.803415857522e-12
> 50 KSP preconditioned resid norm 4.803415857522e-12 true resid norm
> 5.648916764539e-08 ||r(i)||/||b|| 1.903969796791e-04
> 51 KSP Residual norm 4.213404847970e-12
> 51 KSP preconditioned resid norm 4.213404847970e-12 true resid norm
> 5.312367187239e-08 ||r(i)||/||b|| 1.790535618699e-04
> 52 KSP Residual norm 3.583723287544e-12
> 52 KSP preconditioned resid norm 3.583723287544e-12 true resid norm
> 4.482581392980e-08 ||r(i)||/||b|| 1.510855964009e-04
> 53 KSP Residual norm 3.055433343791e-12
> 53 KSP preconditioned resid norm 3.055433343791e-12 true resid norm
> 3.733365588478e-08 ||r(i)||/||b|| 1.258332458617e-04
> 54 KSP Residual norm 2.632415195178e-12
> 54 KSP preconditioned resid norm 2.632415195178e-12 true resid norm
> 3.259461418510e-08 ||r(i)||/||b|| 1.098602856676e-04
> 55 KSP Residual norm 2.358953414259e-12
> 55 KSP preconditioned resid norm 2.358953414259e-12 true resid norm
> 2.755891784400e-08 ||r(i)||/||b|| 9.288744974367e-05
> 56 KSP Residual norm 2.131084837625e-12
> 56 KSP preconditioned resid norm 2.131084837625e-12 true resid norm
> 2.435335186857e-08 ||r(i)||/||b|| 8.208307599694e-05
> 57 KSP Residual norm 1.906113965754e-12
> 57 KSP preconditioned resid norm 1.906113965754e-12 true resid norm
> 2.234444331024e-08 ||r(i)||/||b|| 7.531204116139e-05
> 58 KSP Residual norm 1.666029207693e-12
> 58 KSP preconditioned resid norm 1.666029207693e-12 true resid norm
> 2.187608862971e-08 ||r(i)||/||b|| 7.373344971974e-05
> 59 KSP Residual norm 1.397594452516e-12
> 59 KSP preconditioned resid norm 1.397594452516e-12 true resid norm
> 1.884281030995e-08 ||r(i)||/||b|| 6.350977224879e-05
> 60 KSP Residual norm 1.000720808126e-12
> 60 KSP preconditioned resid norm 1.000720808126e-12 true resid norm
> 1.495264965711e-08 ||r(i)||/||b|| 5.039796923166e-05
> 61 KSP Residual norm 8.368281175845e-13
> 61 KSP preconditioned resid norm 8.368281175845e-13 true resid norm
> 1.198110007063e-08 ||r(i)||/||b|| 4.038234871863e-05
> 62 KSP Residual norm 6.975866756145e-13
> 62 KSP preconditioned resid norm 6.975866756145e-13 true resid norm
> 8.713139114636e-09 ||r(i)||/||b|| 2.936767242465e-05
> 63 KSP Residual norm 6.055685829863e-13
> 63 KSP preconditioned resid norm 6.055685829863e-13 true resid norm
> 7.208696201852e-09 ||r(i)||/||b|| 2.429694119186e-05
> 64 KSP Residual norm 5.321880026091e-13
> 64 KSP preconditioned resid norm 5.321880026091e-13 true resid norm
> 6.450668328122e-09 ||r(i)||/||b|| 2.174200502115e-05
> 65 KSP Residual norm 4.652520314729e-13
> 65 KSP preconditioned resid norm 4.652520314729e-13 true resid norm
> 5.767198491137e-09 ||r(i)||/||b|| 1.943836703022e-05
> 66 KSP Residual norm 4.095554125778e-13
> 66 KSP preconditioned resid norm 4.095554125778e-13 true resid norm
> 5.117612129931e-09 ||r(i)||/||b|| 1.724893343844e-05
> 67 KSP Residual norm 3.575261581129e-13
> 67 KSP preconditioned resid norm 3.575261581129e-13 true resid norm
> 4.479181564454e-09 ||r(i)||/||b|| 1.509710050359e-05
> 68 KSP Residual norm 3.109053579360e-13
> 68 KSP preconditioned resid norm 3.109053579360e-13 true resid norm
> 3.779777902208e-09 ||r(i)||/||b|| 1.273975748689e-05
> 69 KSP Residual norm 2.721884401030e-13
> 69 KSP preconditioned resid norm 2.721884401030e-13 true resid norm
> 3.393605957929e-09 ||r(i)||/||b|| 1.143816330711e-05
> Linear solve converged due to CONVERGED_RTOL iterations 69
> KSP Object: 1 MPI processes
>  type: gmres
>    GMRES: restart=30, using Classical (unmodified) Gram-Schmidt
> Orthogonalization with no iterative refinement
>    GMRES: happy breakdown tolerance 1e-30
>  maximum iterations=10000, initial guess is zero
>  tolerances:  relative=1e-05, absolute=1e-50, divergence=10000
>  left preconditioning
>  using PRECONDITIONED norm type for convergence test
> PC Object: 1 MPI processes
>  type: ilu
>    ILU: out-of-place factorization
>    0 levels of fill
>    tolerance for zero pivot 2.22045e-14
>    matrix ordering: natural
>    factor fill ratio given 1, needed 1
>      Factored matrix follows:
>        Mat Object:         1 MPI processes
>          type: seqaij
>          rows=16384, cols=16384
>          package used to perform factorization: petsc
>          total: nonzeros=81920, allocated nonzeros=81920
>          total number of mallocs used during MatSetValues calls =0
>            not using I-node routines
>  linear system matrix = precond matrix:
>  Mat Object:   1 MPI processes
>    type: seqaij
>    rows=16384, cols=16384
>    total: nonzeros=81920, allocated nonzeros=81920
>    total number of mallocs used during MatSetValues calls =0
>      has attached null space
>      not using I-node routines
>
> 4)
>
>
>
> Linear solve converged due to CONVERGED_ITS iterations 1
> KSP Object: 1 MPI processes
>  type: preonly
>  maximum iterations=10000, initial guess is zero
>  tolerances:  relative=1e-05, absolute=1e-50, divergence=10000
>  left preconditioning
>  using NONE norm type for convergence test
> PC Object: 1 MPI processes
>  type: lu
>    LU: out-of-place factorization
>    tolerance for zero pivot 2.22045e-14
>    matrix ordering: nd
>    factor fill ratio given 5, needed 9.6582
>      Factored matrix follows:
>        Mat Object:         1 MPI processes
>          type: seqaij
>          rows=16384, cols=16384
>          package used to perform factorization: petsc
>          total: nonzeros=791200, allocated nonzeros=791200
>          total number of mallocs used during MatSetValues calls =0
>            not using I-node routines
>  linear system matrix = precond matrix:
>  Mat Object:   1 MPI processes
>    type: seqaij
>    rows=16384, cols=16384
>    total: nonzeros=81920, allocated nonzeros=81920
>    total number of mallocs used during MatSetValues calls =0
>      has attached null space
>      not using I-node routines
>
>
>
> On Tuesday 01 September 2015 03:40:14 Matthew Knepley wrote:
>
> > On Tue, Sep 1, 2015 at 2:22 AM, Filippo Leonardi <
>
> >
>
> > filippo.leonardi at sam.math.ethz.ch> wrote:
>
> > > Dear PETSc Users,
>
> > >
>
> > >
>
> > >
>
> > > I want to use multigrid to solve uniform (just Laplace) poisson in
> 2D/3D
>
> > > on cartesian, non-uniform meshes with a standard 5 (7)-points stencil
> FD.
>
> > >
>
> > >
>
> > >
>
> > > I always scaled my Poisson matrix like in the doc examples, i.e.
>
> > > multiplying by dx*dy (so that in ComputeRHS I need to scale b, in A*x
> = b,
>
> > > as well). This always worked properly with both MG/GAMG and with
> galerkin
>
> > > matrices.
>
> > >
>
> > >
>
> > >
>
> > > Now I'd like to use non-uniform meshes, therefore the scaling is
>
> > > non-uniform. However I cannot get my matrices to scale properly with
> any
>
> > > sort of multigrid.
>
> > >
>
> > >
>
> > >
>
> > > One would think that without scaling, i.e. solving the original
> system, at
>
> > > least MG+galerkin or GAMG should work anyways provided the matrix A
> and b
>
> > > are consistent.
>
> > >
>
> > >
>
> > >
>
> > > I tried without boundaries (i.e. torus), so this is not the problem.
>
> >
>
> > The point of that scaling is to make the boundary values the same size as
>
> > the residuals. If you have
>
> > no boundary values, the problem is scale invariant since its linear. It
>
> > would be nice to scale it so everything
>
> > is about size 1.
>
> >
>
> > When asking about convergence always run with -ksp_view
>
> > -ksp_monitor_true_residual -ksp_converged_reason
>
> >
>
> > Thanks,
>
> >
>
> > Matt
>
> >
>
> > > Anyone did/knows how to do this properly?
>
> > >
>
> > >
>
> > >
>
> > > Thanks,
>
> > >
>
> > > F
>
>
>



-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150901/7856a540/attachment-0001.html>


More information about the petsc-users mailing list