<div dir="ltr">On Wed, Oct 16, 2013 at 1:22 PM, Einar Sørheim <span dir="ltr"><<a href="mailto:einar.sorheim@gmail.com" target="_blank">einar.sorheim@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi<div>I am testing out the petsc ksp solvers in our own FEM code, in particluar we are interseted in the GAMG preconditioner.</div>
<div>Applying it to our mechanical problem we get some error messages from petsc, which I suspect is due to some necessary init calls that are missing. First the error message:</div>
<div><div>[0]PETSC ERROR: --------------------- Error Message ------------------------------------</div><div>[0]PETSC ERROR: Petsc has generated inconsistent data!</div><div>[0]PETSC ERROR: 'createdefaultdata' not set(?) need to support NULL data!</div>
<div>[0]PETSC ERROR: ------------------------------------------------------------------------</div><div>[0]PETSC ERROR: Petsc Release Version 3.4.3, Oct, 15, 2013 </div><div>[0]PETSC ERROR: See docs/changes/index.html for recent updates.</div>
<div>[0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.</div><div>[0]PETSC ERROR: See docs/index.html for manual pages.</div><div>[0]PETSC ERROR: ------------------------------------------------------------------------</div>
<div>[0]PETSC ERROR: D:\Programming\gits\Alsim\SharedModules - Copy\Source\Release\Alsim_nypetsc.exe on a arch-mswin-c-opt named CMP3 by admeinar Wed Oct 16 18:23:32 2013</div><div>[0]PETSC ERROR: Libraries linked from /cygdrive/d/Programming/petsc-3.4.3/arch-mswin-c-opt/lib</div>
<div>[0]PETSC ERROR: Configure run at Wed Oct 16 14:46:01 2013</div><div>[0]PETSC ERROR: Configure options --with-debugging=0 --with-openmp=yes --with-pthread=no --with-cc="win32fe icl" --with-fc="win32fe ifort" --with-cxx="win32fe icl" --with-blas-lapack-dir="C:/Program Files (x86)/Intel/Composer XE 2013/mkl/lib/intel64" --download-superlu --with-sowing=0 --with-c2html=0 --with-mpi-dir="C:/Program Files (x86)/Intel/MPI/<a href="http://4.1.0.028/em64t" target="_blank">4.1.0.028/em64t</a>" --useThreads=0 --useThreads=0</div>
<div>[0]PETSC ERROR: ------------------------------------------------------------------------</div><div>[0]PETSC ERROR: PCSetUp_GAMG() line 609 in src/ksp/pc/impls/gamg/D:\PROGRA~1\PETSC-~1.3\src\ksp\pc\impls\gamg\gamg.c</div>
<div>[0]PETSC ERROR: PCSetUp() line 890 in src/ksp/pc/interface/D:\PROGRA~1\PETSC-~1.3\src\ksp\pc\INTERF~1\precon.c</div><div>[0]PETSC ERROR: KSPSetUp() line 278 in src/ksp/ksp/interface/D:\PROGRA~1\PETSC-~1.3\src\ksp\ksp\INTERF~1\itfunc.c</div>
</div><div><br></div><div>In short our code looks like the following:<br></div><div><br></div><div><br></div><div> call KSPGetPC(ksp,pc,ierr)</div><div> tol = 1.e-20</div><div> call KSPSetTolerances(ksp,tol,PETSC_DEFAULT_DOUBLE_PRECISION,PETSC_DEFAULT_DOUBLE_PRECISION,imaxiter,ierr)</div>
<div> select case (i_Precond)</div><div><br></div><div> case ( 3 )</div><div> call PCSetType(pc,PCGAMG,ierr)</div><div>! call PCGAMGInitializePackage()</div><div>! call PCCreate_GAMG(pc,ierr)</div>
<div> case DEFAULT</div><div> call PCSetType(pc,PCJACOBI,ierr)</div><div> end select</div><div><br></div><div>! call PCSetType(pc,PCJACOBI,ierr)</div><div> select case (i_solver)</div><div> case ( 0 )</div>
<div> call KSPSetType(ksp,KSPCG,ierr)</div><div> case DEFAULT</div><div> call KSPSetType(ksp,KSPCG,ierr)</div><div> end select</div><div> call KSPCGSetType(ksp,KSP_CG_SYMMETRIC,ierr)</div><div>
if (i_nodedof==3) then</div><div> write(*,*) "Set coord, number of nodes is:", i_nodes/i_nodedof</div><div> call VecCreateSeqWithArray(MPI_COMM_SELF,3,i_nodes,coords_,vec_coords,ierr)</div>
<div> call MatNullSpaceCreateRigidBody(vec_coords,Matnull,ierr)</div><div> call MatSetNearNullSpace(A,Matnull,ierr)</div><div> call MatNullSpaceDestroy(Matnull,ierr)</div><div> call PetscViewerASCIIOpen(PETSC_COMM_WORLD, "Coordvec.m", viewer,ierr)</div>
<div> call PetscViewerSetFormat( viewer, PETSC_VIEWER_ASCII_MATLAB,ierr)</div><div> call VecView(vec_coords,viewer,ierr)</div><div> call PetscViewerDestroy( viewer,ierr )</div><div> call VecDestroy(vec_coords,ierr)</div>
<div> write(*,*) "Finish setting null space ierr =", ierr</div><div>! call PCSetCoordinates( pc, 3,i_nodes/i_nodedof, coords_, ierr )</div><div>! CHKERRQ(ierr)</div><div> end if</div>
<div><br></div><div><br></div><div>! call KSPSetFromOptions(ksp,ierr)</div></div></blockquote><div><br></div><div>It looks like you have not set the type of aggregation. If you uncomment this SetFromOptions()</div><div>
it should be done automatically.</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div> call KSPSetInitialGuessNonzero(ksp,PETSC_TRUE,ierr)</div>
<div> call KSPSetUp(ksp,ierr)</div><div> call PetscTime(t0,ierr)</div>
<div> write(*,*) "Time setup", t0-t1</div><div>! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - </div><div>! Solve the linear system</div><div>! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - </div>
<div><br></div><div> call KSPSolve(ksp,b,x,ierr)</div><div> call PetscTime(t1,ierr) <span class="HOEnZb"><font color="#888888"><br clear="all"><div><br></div>-- <br>Einar Sørheim
</font></span></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener
</div></div>