[petsc-users] Errors with KSP solver

Matthew Knepley knepley at gmail.com
Mon Nov 2 05:15:13 CST 2020


On Mon, Nov 2, 2020 at 12:31 AM Hien HN- <hoangnhanhien at gmail.com> wrote:

> Dear PETSc developers,
>
>
>
> *I have used KSP solver to solve a linear equation system in parallel with
> 5 processors.*
>
>
>
> *The linear system consists of a pressure matrix (pressure_coeff_mat) and
> its RHS (p_coeff_mat) whose values are set every time step using
> MatSetValue and VecSetValues functions and then assembled using:*
>
>    call MatAssemblyBegin(pressure_coeff_mat,mat_final_assembly,petsc_err)
>
>    call MatAssemblyEnd(pressure_coeff_mat,mat_final_assembly,petsc_err)
>
>    call VecAssemblyBegin(p_coeff_rhs,petsc_err)
>
>    call VecAssemblyEnd(p_coeff_rhs,petsc_err)
>
>
>
>
>
> *One processor solves this linear system using KSBCGS Krylov solver with
> ILU preconditioner, and the result is scattered to all processors*
>
>   call KSPGetPC(petsc_ksp,petsc_pc,petsc_err)
>
>    if (preconditioner==0) then
>
>       call PCSetType(petsc_pc,PCJACOBI,petsc_err
>
>       call
> PetscOptionsSetValue(PETSC_NULL_OPTIONS,"sub_ksp_type","preonly",petsc_err)
>
>       call
> PetscOptionsSetValue(PETSC_NULL_OPTIONS,"sub_pc_type","ilu",petsc_err)
>
>       call PCSetFromOptions(petsc_pc,petsc_err)
>
>    else
>
>       call PCSetType(petsc_pc,PCBJACOBI,petsc_err)
>
>    end if
>
>    call KSPSetFromOptions(petsc_ksp,petsc_err)
>
>    call KSPSetUp(petsc_ksp,petsc_err)
>
>    call KSPSolve(petsc_ksp,p_coeff_rhs,petsc_solution,petsc_err)
>
>    call VecScatterCreateToAll(petsc_solution,ctx,sol_to_all,petsc_err)
>
>    call
> VecScatterBegin(ctx,petsc_solution,sol_to_all,INSERT_VALUES,SCATTER_FORWARD,petsc_err)
>
>    call VecScatterEnd(ctx,petsc_solution,sol_to_all,
> INSERT_VALUES,SCATTER_FORWARD,petsc_err)
>
>    call VecGetValues(sol_to_all,ncells, loc_id_to_global-1,sol, petsc_err)
>
>    call VecScatterDestroy(ctx,petsc_err)
>
>    call VecDestroy(sol_to_all,petsc_err)
>
>
>
>
>
> *However, I got the following errors with vector scattering, i.e.,
> VecScatterBegin, VecScatterEnd, and also VecGetValues. I have checked the
> pressure matrix, its RHS, and the solution for the first call of KSPSolve.
> Their values seem to be okay (see attached file). So, could you please tell
> me what does this error mean and how can I fix it.*
>

1) The error message says that 'sol_to_all'  has not been created

2) Is this system the Laplacian? If so, ILU is a bad preconditioner. You
should try gamg.

  Thanks,

     Matt


>
>
> *Thank you,*
>
>
>
> *Error message:*
>
>
> -----------------------------------------------------------------------------
>
> Configure options --with-cc="win32fe cl" --with-fc="win32fe ifort"
> --with-cxx="win32fe cl"
> --with-blaslapack-lib="[/cygdrive/c/PROGRA~2/Intel/COMPOS~1/mkl/lib/ia32/mkl_intel_c_dll.lib,/cygdrive/c/PROGRA~2/Intel/COMPOS~1/mkl/lib/ia32/mkl_sequential_dll.lib,/cygdrive/c/PROGRA~2/Intel/COMPOS~1/mkl/lib/ia32/mkl_core_dll.lib]"
> --with-mpi-lib="[/cygdrive/c/PROGRA~2/MICROS~1/MPI/Lib/x86/msmpifec.lib,/cygdrive/c/PROGRA~2/MICROS~1/MPI/Lib/x86/msmpi.lib]"
> --with-mpi-include="[/cygdrive/c/PROGRA~2/MICROS~1/MPI/Include,/cygdrive/c/PROGRA~2/MICROS~1/MPI/Include/x86]"
> --with-mpiexec=/cygdrive/c/PROGRA~1/MI564C~1/bin/mpiexec.exe
> --with-debugging=1 --with-shared-libraries=0 --CFLAGS=-Od --FFLAGS=-Od
> CXXFLAGS=-Od --with-clean=1
>
> #4930 VecScatterBegin() line 83 in
> C:\petsc\PE4D24~1.13-\src\vec\vscat\INTERF~1\vscatfce.c
>
> [1]PETSC ERROR:
>
> [2]PETSC ERROR:
>
> [3]PETSC ERROR:
>
> [0]PETSC ERROR:
>
> [4]PETSC ERROR:
>
> #4930 VecScatterBegin() line 83 in
> C:\petsc\PE4D24~1.13-\src\vec\vscat\INTERF~1\vscatfce.c
>
> #4930 VecScatterBegin() line 83 in
> C:\petsc\PE4D24~1.13-\src\vec\vscat\INTERF~1\vscatfce.c
>
> #4930 VecScatterBegin() line 83 in
> C:\petsc\PE4D24~1.13-\src\vec\vscat\INTERF~1\vscatfce.c
>
> #4930 VecScatterBegin() line 83 in
> C:\petsc\PE4D24~1.13-\src\vec\vscat\INTERF~1\vscatfce.c
>
> --------------------- Error Message
> --------------------------------------------------------------
>
> [1]PETSC ERROR:
>
> [2]PETSC ERROR:
>
> [3]PETSC ERROR:
>
> [0]PETSC ERROR:
>
> [4]PETSC ERROR:
>
> --------------------- Error Message
> --------------------------------------------------------------
>
> --------------------- Error Message
> --------------------------------------------------------------
>
> --------------------- Error Message
> --------------------------------------------------------------
>
> --------------------- Error Message
> --------------------------------------------------------------
>
> Null argument, when expecting valid pointer
>
> [1]PETSC ERROR:
>
> [2]PETSC ERROR:
>
> [3]PETSC ERROR:
>
> [0]PETSC ERROR:
>
> [4]PETSC ERROR:
>
> Null argument, when expecting valid pointer
>
> Null argument, when expecting valid pointer
>
> Null argument, when expecting valid pointer
>
> Null argument, when expecting valid pointer
>
> Null Object: Parameter # 3
>
> [1]PETSC ERROR:
>
> [2]PETSC ERROR:
>
> [3]PETSC ERROR:
>
> [0]PETSC ERROR:
>
> [4]PETSC ERROR:
>
> Null Object: Parameter # 3
>
> Null Object: Parameter # 3
>
> Null Object: Parameter # 3
>
> Null Object: Parameter # 3
>
> --
> Hoang Nhan Hien, Ph.D.
>
> 1) Nuclear Safety Department, Institute for Nuclear Science and
> Technology, Vietnam Atomic Energy Insitute
>
> 2) Nuclear Safety Analysis Method Development, Enviroment & Energy
> Technology, Inc.
>
> Email: hoangnhanhien at gmail.com; h <hnhien at kaeri.re.kr>ien at en2t.com
> Phone: +81-10-2635-2411
>
>

-- 
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/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20201102/e1e9b8de/attachment.html>


More information about the petsc-users mailing list