<div dir="ltr">* You MUST now call MatXXXSetPreallocation() or MatSetUp() on any matrix you create directly (not using DMCreateMatrix()) before calling MatSetValues(), MatSetValuesBlocked() etc.<br><br><a href="http://www.mcs.anl.gov/petsc/documentation/changes/33.html">http://www.mcs.anl.gov/petsc/documentation/changes/33.html</a><br>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jan 10, 2013 at 1:08 PM, Dharmendar Reddy <span dir="ltr"><<a href="mailto:dharmareddy84@gmail.com" target="_blank">dharmareddy84@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hello,<br> I am seeing an error in my code when i switched from pets 3.2-p5 to petsc 3.3-p5. Please have a look at the error information below. I do not pass any petsc specific command line options. <br>
<br>The following is the subroutine which leads to error message. <br>
<br> subroutine initBCSolver_solver(this,comm,SolverType,NumDof,ierr,EqnCtx)<br> use SolverUtils_m<br> implicit none<br>#include "finclude/petsc.h"<br> class(Solver_t), intent(inout) :: this<br> MPI_Comm :: comm<br>
integer, intent(in) :: SolverType<br> integer, intent(in) :: NumDof<br> class(*),pointer,intent(inout),optional :: EqnCtx<br> PetscErrorCode :: ierr<br> PetscReal :: rtol<br> PetscReal :: abstol<br> PetscReal :: dtol<br>
PetscInt :: maxits<br> ! Local Variables<br> PetscInt :: psize ! problem size<br> PetscScalar :: pfive !<br> ! Set solver type<br> !if(SolverType /= LINEAR .and. SolverType /= NonLinear) then<br> ! print*,'Error:: Solver must be linear or Nonlinear',solverType<br>
! stop<br> !end if<br> this%comm = comm<br> this%SolverType = SolverType<br> ! Set problem size<br> this%numDof = numDof<br> psize = this%numDof ! 3<br> ! intiate Storage vectors<br> call VecCreateSeq(this%comm,psize,this%sol,ierr)<br>
call VecSetOption(this%sol, VEC_IGNORE_NEGATIVE_INDICES,PETSC_TRUE,ierr)<br> call VecDuplicate(this%sol,this%fxn,ierr)<br> this%flag_vec_sol = .true.<br> this%flag_vec_fxn = .true.<br><br> select case(this%SolverType)<br>
case(Linear)<br> ! create the linear operator<br> call MatCreate(this%comm,this%A,ierr)<br> call MatSetSizes(this%A,PETSC_DECIDE,PETSC_DECIDE,psize,psize,ierr)<br> call MatSetFromOptions(this%A,ierr)<br>
! create storage for rhs<br> call VecDuplicate(this%sol,this%rhs,ierr)<br> ! Create KSP context<br> call KSPCreate(this%comm,this%ksp,ierr)<br> this%flag_ksp_ksp = .true.<br> rtol = PETSC_DEFAULT_DOUBLE_PRECISION<br>
abstol = PETSC_DEFAULT_DOUBLE_PRECISION<br> dtol = PETSC_DEFAULT_DOUBLE_PRECISION<br> maxIts = PETSC_DEFAULT_INTEGER<br> call KSPSetTolerances(this%ksp,rtol,abstol,dtol,maxIts,ierr);<br> call KSPSetFromOptions(this%ksp,ierr)<br>
call KSPSetOperators(this%ksp,this%A,this%A,DIFFERENT_NONZERO_PATTERN,ierr)<br> case(nonLinear)<br> call MatCreate(this%comm,this%Jac,ierr)<br> this%flag_mat_Jac = .true.<br> call MatSetSizes(this%Jac,PETSC_DECIDE,PETSC_DECIDE,psize,psize,ierr)<br>
call MatSetFromOptions(this%Jac,ierr)<br> ! create snes context<br> call SNESCreate(this%comm,this%snes,ierr)<br> this%flag_snes_snes = .true.<br> ! Set function evaluation routine and vector<br>
! use the defualt FormFunction_snes<br> call SNESSetFunction(this%snes,this%fxn,FormFunction_snes,this,ierr)<br> ! Set Jacobian matrix data structure and Jacobian evaluation routine<br><br> call SNESSetJacobian(this%snes,this%Jac,this%Jac,FormJacobian_snes,this,ierr)<br>
!call SNESSetJacobian(this%snes,this%Jac,this%Jac,PETSC_NULL_FUNCTION,PETSC_NULL_OBJECT,ierr)<br> call SNESSetTolerances(this%snes,1e-15*25.6E-3,PETSC_DEFAULT_DOUBLE_PRECISION,PETSC_DEFAULT_DOUBLE_PRECISION,25000,100000,ierr);<br>
call SNESSetFromOptions(this%snes,ierr)<br> end select<br><br> !call VecDuplicate(this%sol,this%bOhmic,ierr)<br><br> pfive = 0.0<br> call VecSet(this%sol,pfive,ierr) ! set Intial Guess<br> end subroutine initBCSolver_solver<br>
<br>end module BoundaryConditionUtils_m<br><br><br><br><br>[0]PETSC ERROR: --------------------- Error Message ------------------------------------<br>[0]PETSC ERROR: Object is in wrong state!<br>[0]PETSC ERROR: Must call MatXXXSetPreallocation() or MatSetUp() on argument 1 "mat" before MatGetFactorAvailable()!<br>
[0]PETSC ERROR: ------------------------------------------------------------------------<br>[0]PETSC ERROR: Petsc Release Version 3.3.0, Patch 5, Sat Dec 1 15:10:41 CST 2012 <br>[0]PETSC ERROR: See docs/changes/index.html for recent updates.<br>
[0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.<br>[0]PETSC ERROR: See docs/index.html for manual pages.<br>[0]PETSC ERROR: ------------------------------------------------------------------------<br>
[0]PETSC ERROR: /home1/00924/Reddy135/projects/utgds/test/IIIVTunnelFET2D/PoisTest on a sandybrid named <a href="http://login2.stampede.tacc.utexas.edu" target="_blank">login2.stampede.tacc.utexas.edu</a> by Reddy135 Thu Jan 10 12:50:19 2013<br>
[0]PETSC ERROR: Libraries linked from /opt/apps/intel13/mvapich2_1_9/petsc/3.3/sandybridge-debug/lib<br>[0]PETSC ERROR: Configure run at Mon Jan 7 14:42:13 2013<br>[0]PETSC ERROR: Configure options --with-x=0 -with-pic --with-external-packages-dir=/opt/apps/intel13/mvapich2_1_9/petsc/3.3/externalpackages --with-mpi-compilers=1 --with-mpi-dir=/opt/apps/intel13/mvapich2/1.9 --with-scalar-type=real --with-dynamic-loading=0 --with-shared-libraries=1 --with-spai=1 --download-spai --with-hypre=1 --download-hypre --with-mumps=1 --download-mumps --with-scalapack=1 --download-scalapack --with-blacs=1 --download-blacs --with-spooles=1 --download-spooles --with-superlu=1 --download-superlu --with-superlu_dist=1 --download-superlu_dist --with-parmetis=1 --download-parmetis --with-metis=1 --download-metis --with-debugging=yes --with-blas-lapack-dir=/opt/apps/intel/13/composer_xe_2013.1.117/mkl/lib/intel64 --with-mpiexec=mpirun_rsh --COPTFLAGS= --CXXOPTFLAGS= --FOPTFLAGS=<br>
[0]PETSC ERROR: ------------------------------------------------------------------------<br>[0]PETSC ERROR: MatGetFactorAvailable() line 3921 in /opt/apps/intel13/mvapich2_1_9/petsc/3.3/src/mat/interface/matrix.c<br>[0]PETSC ERROR: PCGetDefaultType_Private() line 26 in /opt/apps/intel13/mvapich2_1_9/petsc/3.3/src/ksp/pc/interface/precon.c<br>
[0]PETSC ERROR: PCSetFromOptions() line 181 in /opt/apps/intel13/mvapich2_1_9/petsc/3.3/src/ksp/pc/interface/pcset.c<br>[0]PETSC ERROR: KSPSetFromOptions() line 287 in /opt/apps/intel13/mvapich2_1_9/petsc/3.3/src/ksp/ksp/interface/itcl.c<br>
[0]PETSC ERROR: SNESSetFromOptions() line 678 in /opt/apps/intel13/mvapich2_1_9/petsc/3.3/src/snes/interface/snes.c<span class=""><font color="#888888"><br><br><br clear="all"><br>-- <br>-----------------------------------------------------<br>
Dharmendar Reddy Palle<br>
Graduate Student<br>Microelectronics Research center,<br>University of Texas at Austin,<br>10100 Burnet Road, Bldg. 160<br>MER 2.608F, TX 78758-4445<br>e-mail: <a href="mailto:dharmareddy84@gmail.com" target="_blank">dharmareddy84@gmail.com</a><br>
Phone: <a href="tel:%2B1-512-350-9082" value="+15123509082" target="_blank">+1-512-350-9082</a><br>United States of America.<br>Homepage: <a href="https://webspace.utexas.edu/~dpr342" target="_blank">https://webspace.utexas.edu/~dpr342</a><br>
</font></span></blockquote></div><br></div></div>