Hi, I'm trying to use PETSc's ksp method to solve a linear system. When 
running, Error is reported by VecValidValues() that NaN or Inf is found with 
error message listed below 


[3]PETSC ERROR: --------------------- Error Message 
------------------------------------           
[3]PETSC ERROR: Floating point exception!                                       
                   
[3]PETSC ERROR: Vec entry at local location 0 is not-a-number or infinite at 
beginning of function: Parameter number 2!                                      
                                         
[3]PETSC ERROR: 
------------------------------------------------------------------------        
   
[3]PETSC ERROR: Petsc Release Version 3.4.4, Mar, 13, 2014                      
                   
[3]PETSC ERROR: See docs/changes/index.html for recent updates.                 
                   
[3]PETSC ERROR: See docs/faq.html for hints about trouble shooting.             
                   
[3]PETSC ERROR: See docs/index.html for manual pages.                           
                   
[3]PETSC ERROR: 
------------------------------------------------------------------------        
   
[3]PETSC ERROR: ./gtc on a arch-linux2-c-debug named node2.indac.info by jlin 
Mon May  5 20:03:20 2014                                                        
                                        
[3]PETSC ERROR: Libraries linked from /opt/sfw/petsc/3.4.4/intel/openmpi/lib    
                   
[3]PETSC ERROR: Configure run at Sat Apr 26 20:19:41 2014                       
                   
[3]PETSC ERROR: Configure options --prefix=/opt/sfw/petsc/3.4.4/intel/openmpi 
--with-mpi-dir=/opt/sfw/openmpi/1.6.3/intel 
--with-blas-lapack-dir=/opt/sfw/intel/composer_xe_2011_sp1.7.256/mkl/lib/intel64
 --with-mpiexec=mpiexec                                                         
               
[3]PETSC ERROR: 
------------------------------------------------------------------------        
   
[3]PETSC ERROR: VecValidValues() line 28 in 
/tmp/petsc-3.4.4/src/vec/vec/interface/rvector.c       
[3]PETSC ERROR: PCApply() line 436 in 
/tmp/petsc-3.4.4/src/ksp/pc/interface/precon.c               
[3]PETSC ERROR: KSP_PCApply() line 227 in 
/tmp/petsc-3.4.4/include/petsc-private/kspimpl.h         
[3]PETSC ERROR: KSPInitialResidual() line 64 in 
/tmp/petsc-3.4.4/src/ksp/ksp/interface/itres.c     
[3]PETSC ERROR: KSPSolve_GMRES() line 239 in 
/tmp/petsc-3.4.4/src/ksp/ksp/impls/gmres/gmres.c      
[3]PETSC ERROR: KSPSolve() line 441 in 
/tmp/petsc-3.4.4/src/ksp/ksp/interface/itfunc.c             


After read the source code shown by backtrack informations, I realize the 
problem is in the right hand side vector. So I make a trial of set right hand 
side vector to ONE by VecSet, But the program still shows error message above, 
and using VecView or VecGetValue to investigate the first value of rhs vec 
shows the value is 1.0 as I set it to. Hope I clearly describe the problem. The 
code related is listed below

---------------------------Solver section--------------------------

  call VecSet( pet_bp_b, one, ierr)

  vecidx=[0,1]
  call VecGetValues( pet_bp_b, 2, vecidx, first, ierr)
  write(*,*) ' first two values ', first(1), first(2)

  call KSPSetInitialGuessNonzero(solver_bp,Petsc_True,ierr)
  call KSPSolve(solver_bp,pet_bp_b,pet_bp_x,ierr)
  call KSPView(solver_bp, PETSC_VIEWER_STDOUT_SELF,ierr)
  CHKERRQ(ierr)



                                          

Reply via email to