<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <font face="Droid Serif">Thanks Jed for the Answer.<br>
      <br>
      I am still having problems with this code. In summary what I
      changed from PETSc 3.7 to 3.9 was:<br>
      <br>
      - use of PETSC_NULL_MAT to evaluate if the matrix was defined<br>
      <br>
      mat = PETSC_NULL_MAT<br>
      ...<br>
      if(mat .eq. PETSC_NULL_MAT)then<br>
          create matrix,vectors, ksp<br>
      else<br>
          KSPSetInitialGuessNonzero<br>
          VecResetArray<br>
      end if<br>
      <br>
      - modified MatSetValuesBlocked call<br>
      Previously it was:<br>
      <br>
      call
      MatSetValuesBlocked(mat,1,N-1,IROW,LC(nnz),BB(nnz),INSERT_VALUES,ierr)<br>
      <br>
      with N-1, LC(nnz), and BB(nnz) scalar values, the elements where
      inserted one at a time<br>
      <br>
      Modified to:<br>
      <br>
      call
MatSetValuesBlocked(mat,1,[N-1],IROW,[LC(nnz)],[BB(nnz)],INSERT_VALUES,ierr)<br>
      <br>
      After the matrix is built there is a call to <br>
      <br>
      KSPSolve<br>
      <br>
      When I run the program I get a lot of these errors:<br>
      <br>
      [0]PETSC ERROR: --------------------- Error Message
      --------------------------------------------------------------<br>
      [0]PETSC ERROR: Object is in wrong state<br>
      [0]PETSC ERROR: Matrix is missing diagonal entry 1<br>
      [0]PETSC ERROR: See
      <a class="moz-txt-link-freetext" href="http://www.mcs.anl.gov/petsc/documentation/faq.html">http://www.mcs.anl.gov/petsc/documentation/faq.html</a> for trouble
      shooting.<br>
      [0]PETSC ERROR: Petsc Release Version 3.9.2, unknown <br>
      [0]PETSC ERROR: ../../../UTCOMPRS on a  named bandera by hector
      Wed May 23 18:08:07 2018<br>
      [0]PETSC ERROR: Configure options
      --prefix=/home/hector/installed/petsc_git-intel-debug
      --PETSC_DIR=/home/hector/dwnld_prog/petsc
      --PETSC_ARCH=linux-intel-debug --CC=mpiicc --FC=mpiifort
      --CXX=mpiicpc --with-openmp=1 --with-valgrind=1
      --with-valgrind-dir=/home/hector/installed
      --with-parmetis-dir=/home/hector/installed/parmetis/
      --with-metis-dir=/home/hector/installed/parmetis/
      --with-zoltan-dir=/home/hector/installed/zoltan/
      --with-hypre-dir=/home/hector/installed/hypre --download-ptscotch
--with-blaslapack-lib="[/home/hector/installed/intel/compilers_and_libraries_2019.0.046/linux/mkl/lib/intel64/libmkl_intel_lp64.a,/home/hector/installed/intel/compilers_and_libraries_2019.0.046/linux/mkl/lib/intel64/libmkl_core.a,/home/hector/installed/intel/compilers_and_libraries_2019.0.046/linux/mkl/lib/intel64/libmkl_intel_thread.a]"
--with-scalapack-include=/home/hector/installed/intel/compilers_and_libraries_2019.0.046/linux/mkl/include
--with-scalapack-lib="[/home/hector/installed/intel/compilers_and_libraries_2019.0.046/linux/mkl/lib/intel64/libmkl_scalapack_lp64.a,/home/hector/installed/intel/compilers_and_libraries_2019.0.046/linux/mkl/lib/intel64/libmkl_blacs_intelmpi_lp64.a]"
      --with-shared-libraries=0 --FC_LINKER_FLAGS="-qopenmp
      -qopenmp-link static" --FFLAGS="-qopenmp -qopenmp-link static"
      --LIBS="-Wl,--start-group
/home/hector/installed/intel/compilers_and_libraries_2019.0.046/linux/mkl/lib/intel64/libmkl_intel_lp64.a
/home/hector/installed/intel/compilers_and_libraries_2019.0.046/linux/mkl/lib/intel64/libmkl_core.a
/home/hector/installed/intel/compilers_and_libraries_2019.0.046/linux/mkl/lib/intel64/libmkl_intel_thread.a
      -Wl,--end-group -liomp5 -ldl -lpthread -lm"<br>
      [0]PETSC ERROR: #305869 MatILUFactorSymbolic_SeqBAIJ() line 369 in
      /home/hector/dwnld_prog/petsc/src/mat/impls/baij/seq/baijfact2.c<br>
      [0]PETSC ERROR: #305870 MatILUFactorSymbolic() line 6522 in
      /home/hector/dwnld_prog/petsc/src/mat/interface/matrix.c<br>
      [0]PETSC ERROR: #305871 PCSetUp_ILU() line 144 in
      /home/hector/dwnld_prog/petsc/src/ksp/pc/impls/factor/ilu/ilu.c<br>
      [0]PETSC ERROR: #305872 PCSetUp() line 923 in
      /home/hector/dwnld_prog/petsc/src/ksp/pc/interface/precon.c<br>
      [0]PETSC ERROR: #305873 KSPSetUp() line 381 in
      /home/hector/dwnld_prog/petsc/src/ksp/ksp/interface/itfunc.c<br>
      [0]PETSC ERROR: #305874 KSPSolve() line 612 in
      /home/hector/dwnld_prog/petsc/src/ksp/ksp/interface/itfunc.c<br>
      <br>
      <br>
      What could be the problem?<br>
      <br>
      Thanks for your help,<br>
      <br>
      Hector<br>
      <br>
      <br>
    </font><br>
    <div class="moz-cite-prefix">On 05/22/2018 06:28 PM, Jed Brown
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:877envi83b.fsf@jedbrown.org">
      <pre wrap="">Hector E Barrios Molano <a class="moz-txt-link-rfc2396E" href="mailto:hectorb@utexas.edu"><hectorb@utexas.edu></a> writes:

</pre>
      <blockquote type="cite">
        <pre wrap="">Hi PETSc Experts!

I am updating a Fortran code that use PETSc 3.7 to version 3.9.2 (from 
git repository).

Such code declares:

Mat mat

and used it as an integer, for example, to assign an initial value and 
test it to know if the matrix has been created by PETSc.

data mat/-1/
if (mat .eq. -1) then
</pre>
      </blockquote>
      <pre wrap="">
You can use PETSC_NULL_MAT

</pre>
      <blockquote type="cite">
        <pre wrap="">With the new PETSc Fortran modules the compiler complains about this and 
stops.

Is there a better way to achieve this? So that I do not have to set an 
predefined value to Mat type to test if it was already created by PETSc?

If not, Is there a way to access the value in mat?
Looking at the source code type(tMat) has "v" variable, so could I used 
as mat%v?
</pre>
      </blockquote>
      <pre wrap="">
Please no.
</pre>
    </blockquote>
    <br>
  </body>
</html>