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.

Thank you.
Sincerely,
Huq

On Fri, Jun 5, 2020 at 10:16 AM Matthew Knepley <[email protected]> wrote:

> On Fri, Jun 5, 2020 at 11:04 AM Fazlul Huq <[email protected]> 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: [email protected]
>>
>
>
> --
> 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: [email protected]
Total time starting......

Preparing and assigning values in matrix and vectors...


Allocation is completed in 4.449939 sec. 

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
Linear solve converged due to CONVERGED_RTOL iterations 1
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-07, absolute=1e-50, divergence=10000.
  left preconditioning
  using PRECONDITIONED norm type for convergence test
PC Object: 1 MPI processes
  type: cholesky
    out-of-place factorization
    tolerance for zero pivot 2.22045e-14
    matrix ordering: nd
    factor fill ratio given 5., needed 1.5
      Factored matrix follows:
        Mat Object: 1 MPI processes
          type: seqsbaij
          rows=10000000, cols=10000000
          package used to perform factorization: petsc
          total: nonzeros=29999954, allocated nonzeros=29999954
          total number of mallocs used during MatSetValues calls=0
              block size is 1
  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 15.404302 sec. 


Total time 19.854268 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-07, absolute=1e-50, divergence=10000.
  left preconditioning
  using PRECONDITIONED norm type for convergence test
PC Object: 1 MPI processes
  type: cholesky
    out-of-place factorization
    tolerance for zero pivot 2.22045e-14
    matrix ordering: nd
    factor fill ratio given 5., needed 1.5
      Factored matrix follows:
        Mat Object: 1 MPI processes
          type: seqsbaij
          rows=10000000, cols=10000000
          package used to perform factorization: petsc
          total: nonzeros=29999954, allocated nonzeros=29999954
          total number of mallocs used during MatSetValues calls=0
              block size is 1
  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 1

Reply via email to