The same is happening with "-pc_type hypre -pc_hypre_type boomerang" and
with "-pc_type ilu".

I tried with,
ierr =
KSPSetTolerances(ksp,1.e-10,PETSC_DEFAULT,PETSC_DEFAULT,PETSC_DEFAULT);CHKERRQ(ierr);
this also.

Getting higher values of error even then.

Any suggestion to go over this issue?
Shall I send the code? It's not a large script (single routine, less than
100 lines except comment).

Thank you.
Sincerely,
Huq

On Fri, Jun 5, 2020 at 12:53 PM Matthew Knepley <knep...@gmail.com> wrote:

> On Fri, Jun 5, 2020 at 12:32 PM Fazlul Huq <huq2...@gmail.com> wrote:
>
>> Input string:
>> mpiexec -np 1 ./poisson_m -n 10000000 -pc_type cholesky  -ksp_view
>> -ksp_converged_reason -ksp_monitor_true_residual
>>
>> Output is attached herewith.
>>
>
> Solving the problem...
>
>   0 KSP preconditioned resid norm 9.741453255800e+07 true resid norm
> 1.802775638200e+01 ||r(i)||/||b|| 1.000000000000e+00
>
>   1 KSP preconditioned resid norm 5.796040438920e+00 true resid norm
> 3.146946078273e-05 ||r(i)||/||b|| 1.745611606675e-06
>
> Your Cholesky preconditioner is crap, probably because the system is
> either not symmetric or nearly singular. You can see this
> because the preconditioned residual is 6 orders of magnitude greater than
> the true residual. Also, if you want to evaluate convergence, you
> should probably use a lower tolerance like
>
>   -ksp_rtol 1e-10
>
>   Thanks,
>
>      Matt
>
> Thank you.
>> Sincerely,
>> Huq
>>
>> On Fri, Jun 5, 2020 at 10:16 AM Matthew Knepley <knep...@gmail.com>
>> wrote:
>>
>>> On Fri, Jun 5, 2020 at 11:04 AM Fazlul Huq <huq2...@gmail.com> wrote:
>>>
>>>> Hello All,
>>>> I'm trying to calculate the norm_2 error of a solution.
>>>> Here, vector s: Analytical solution
>>>>           vector x: Numerical solution
>>>>
>>>> ierr = VecView(s,PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr);
>>>> ierr = VecView(x,PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr);
>>>>
>>>>  ierr = VecAXPY(x,-1.0,s);CHKERRQ(ierr);
>>>>  ierr = VecNorm(x,NORM_2,&norm);CHKERRQ(ierr);
>>>>  ierr = VecView(x,PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr);
>>>>  ierr = KSPGetIterationNumber(ksp,&its);CHKERRQ(ierr);
>>>>  if (norm > tol) {
>>>>     ierr = PetscPrintf(PETSC_COMM_WORLD,"Second Norm of error %g\n",
>>>> double)norm);CHKERRQ(ierr);
>>>>     ierr = PetscPrintf(PETSC_COMM_WORLD,"Iterations
>>>> %D\n",its);CHKERRQ(ierr);
>>>>   }
>>>>
>>>> Am I calculating the "Norm_2" error correctly or making any mistake?
>>>> Unfortunately, for large sized matrix, say 10^6, I am getting very high
>>>> value of "Norm_2" error.
>>>>
>>>
>>> 1) I am guessing x comes from a KSPSolve(). It is only as accurate as
>>> your tolerance
>>>
>>> 2) This is the l_2 norm, not the L_2 norm, so if you are using a
>>> continuum method like FEM, this is likely wrong.
>>>
>>>   Thanks,
>>>
>>>      Matt
>>>
>>>
>>>> Thank you.
>>>> Sincerely,
>>>> Huq
>>>>
>>>> --
>>>>
>>>> Fazlul Huq
>>>> Graduate Research Assistant
>>>> Department of Nuclear, Plasma & Radiological Engineering (NPRE)
>>>> University of Illinois at Urbana-Champaign (UIUC)
>>>> E-mail: huq2...@gmail.com
>>>>
>>>
>>>
>>> --
>>> 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
>>>
>>> https://www.cse.buffalo.edu/~knepley/
>>> <http://www.cse.buffalo.edu/~knepley/>
>>>
>>
>>
>> --
>>
>> Fazlul Huq
>> Graduate Research Assistant
>> Department of Nuclear, Plasma & Radiological Engineering (NPRE)
>> University of Illinois at Urbana-Champaign (UIUC)
>> E-mail: huq2...@gmail.com
>>
>
>
> --
> 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
>
> https://www.cse.buffalo.edu/~knepley/
> <http://www.cse.buffalo.edu/~knepley/>
>


-- 

Fazlul Huq
Graduate Research Assistant
Department of Nuclear, Plasma & Radiological Engineering (NPRE)
University of Illinois at Urbana-Champaign (UIUC)
E-mail: huq2...@gmail.com
Total time starting......

Preparing and assigning values in matrix and vectors...


Allocation is completed in 4.340090 sec. 

Solving the problem...  0 KSP preconditioned resid norm 9.660207389609e+07 true resid norm 1.802775638200e+01 ||r(i)||/||b|| 1.000000000000e+00
  1 KSP preconditioned resid norm 4.503532539794e+05 true resid norm 1.482299010613e-01 ||r(i)||/||b|| 8.222315518384e-03
  2 KSP preconditioned resid norm 1.294189457141e+00 true resid norm 1.361533905992e-05 ||r(i)||/||b|| 7.552431246252e-07
  3 KSP preconditioned resid norm 1.248502652604e-05 true resid norm 2.920496315686e-08 ||r(i)||/||b|| 1.619999878966e-09
Linear solve converged due to CONVERGED_RTOL iterations 3
KSP Object: 1 MPI processes
  type: gmres
    restart=30, using Classical (unmodified) Gram-Schmidt Orthogonalization with no iterative refinement
    happy breakdown tolerance 1e-30
  maximum iterations=10000, initial guess is zero
  tolerances:  relative=1e-10, absolute=1e-50, divergence=10000.
  left preconditioning
  using PRECONDITIONED norm type for convergence test
PC Object: 1 MPI processes
  type: hypre
    HYPRE BoomerAMG preconditioning
      Cycle type V
      Maximum number of levels 25
      Maximum number of iterations PER hypre call 1
      Convergence tolerance PER hypre call 0.
      Threshold for strong coupling 0.25
      Interpolation truncation factor 0.
      Interpolation: max elements per row 0
      Number of levels of aggressive coarsening 0
      Number of paths for aggressive coarsening 1
      Maximum row sums 0.9
      Sweeps down         1
      Sweeps up           1
      Sweeps on coarse    1
      Relax down          symmetric-SOR/Jacobi
      Relax up            symmetric-SOR/Jacobi
      Relax on coarse     Gaussian-elimination
      Relax weight  (all)      1.
      Outer relax weight (all) 1.
      Using CF-relaxation
      Not using more complex smoothers.
      Measure type        local
      Coarsen type        Falgout
      Interpolation type  classical
  linear system matrix = precond matrix:
  Mat Object: 1 MPI processes
    type: seqaij
    rows=10000000, cols=10000000
    total: nonzeros=29999998, allocated nonzeros=50000000
    total number of mallocs used during MatSetValues calls=0
      not using I-node routines

Problem solved by 21.329104 sec. 


Total time 25.669220 sec. 

KSP Object: 1 MPI processes
  type: gmres
    restart=30, using Classical (unmodified) Gram-Schmidt Orthogonalization with no iterative refinement
    happy breakdown tolerance 1e-30
  maximum iterations=10000, initial guess is zero
  tolerances:  relative=1e-10, absolute=1e-50, divergence=10000.
  left preconditioning
  using PRECONDITIONED norm type for convergence test
PC Object: 1 MPI processes
  type: hypre
    HYPRE BoomerAMG preconditioning
      Cycle type V
      Maximum number of levels 25
      Maximum number of iterations PER hypre call 1
      Convergence tolerance PER hypre call 0.
      Threshold for strong coupling 0.25
      Interpolation truncation factor 0.
      Interpolation: max elements per row 0
      Number of levels of aggressive coarsening 0
      Number of paths for aggressive coarsening 1
      Maximum row sums 0.9
      Sweeps down         1
      Sweeps up           1
      Sweeps on coarse    1
      Relax down          symmetric-SOR/Jacobi
      Relax up            symmetric-SOR/Jacobi
      Relax on coarse     Gaussian-elimination
      Relax weight  (all)      1.
      Outer relax weight (all) 1.
      Using CF-relaxation
      Not using more complex smoothers.
      Measure type        local
      Coarsen type        Falgout
      Interpolation type  classical
  linear system matrix = precond matrix:
  Mat Object: 1 MPI processes
    type: seqaij
    rows=10000000, cols=10000000
    total: nonzeros=29999998, allocated nonzeros=50000000
    total number of mallocs used during MatSetValues calls=0
      not using I-node routines
Second Norm of error 9.7378e+07
Iterations 3
Total time starting......

Preparing and assigning values in matrix and vectors...


Allocation is completed in 4.313934 sec. 

Solving the problem...  0 KSP preconditioned resid norm 9.741419186704e+07 true resid norm 1.802775638200e+01 ||r(i)||/||b|| 1.000000000000e+00
  1 KSP preconditioned resid norm 4.767085064402e+01 true resid norm 3.158285622856e-05 ||r(i)||/||b|| 1.751901654279e-06
  2 KSP preconditioned resid norm 7.018030464764e-05 true resid norm 2.606059370354e-08 ||r(i)||/||b|| 1.445581643735e-09
Linear solve converged due to CONVERGED_RTOL iterations 2
KSP Object: 1 MPI processes
  type: gmres
    restart=30, using Classical (unmodified) Gram-Schmidt Orthogonalization with no iterative refinement
    happy breakdown tolerance 1e-30
  maximum iterations=10000, initial guess is zero
  tolerances:  relative=1e-10, absolute=1e-50, divergence=10000.
  left preconditioning
  using PRECONDITIONED norm type for convergence test
PC Object: 1 MPI processes
  type: 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=10000000, cols=10000000
          package used to perform factorization: petsc
          total: nonzeros=29999998, allocated nonzeros=29999998
          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=10000000, cols=10000000
    total: nonzeros=29999998, allocated nonzeros=50000000
    total number of mallocs used during MatSetValues calls=0
      not using I-node routines

Problem solved by 5.766347 sec. 


Total time 10.080312 sec. 

KSP Object: 1 MPI processes
  type: gmres
    restart=30, using Classical (unmodified) Gram-Schmidt Orthogonalization with no iterative refinement
    happy breakdown tolerance 1e-30
  maximum iterations=10000, initial guess is zero
  tolerances:  relative=1e-10, absolute=1e-50, divergence=10000.
  left preconditioning
  using PRECONDITIONED norm type for convergence test
PC Object: 1 MPI processes
  type: 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=10000000, cols=10000000
          package used to perform factorization: petsc
          total: nonzeros=29999998, allocated nonzeros=29999998
          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=10000000, cols=10000000
    total: nonzeros=29999998, allocated nonzeros=50000000
    total number of mallocs used during MatSetValues calls=0
      not using I-node routines
Second Norm of error 9.7378e+07
Iterations 2

Reply via email to