PCNN preconditioner

Barry Smith bsmith at mcs.anl.gov
Tue Mar 3 13:56:19 CST 2009


   Sorry, deleted the original email by mistake.

>> err = PCSetType(prec,PCNN);CHKERRQ(ierr);
>> //ierr = PCFactorSetShiftPd(prec,PETSC_TRUE);CHKERRQ(ierr);

     You need to set the option for the pc that is doing the  
factorization;
this is a PC that is inside the prec.

     The easiest way to find these things is by running with -help
and then looking for the prefix

     For the subdomain solves the prefix are is_localD_ and is_localN_
so you should use the options - 
is_localD_pc_factor_shift_positive_definite and
-is_localN_pc_factor_shift_positive_definite

    There is currently no subroutine that "pulls out" the inner KSP's  
for the
Neuman and Dirichlet problems for use in the code; though there should  
be
PCISGetDPC() and PCISGetNPC() that would get the pointer to ksp_N and  
ksp_D
objects inside the PC_IS data structured defined in src/ksp/pc/impls/ 
is/pcis.h
You can easily add these routines. Then use them to get the inner PC  
and set
the shift option (and anything else you want to set).

   All the code for the NN is in src/ksp/pc/is and src/ksp/pc/is/nn  
you'll have to dig
around in there to figure things out.  This piece of code was written  
a long time
ago and is hardly ever used.


    Barry




On Mar 3, 2009, at 2:33 AM, Andreas Grassl wrote:

> any suggestions?
>
> cheers
>
> ando
>
> Andreas Grassl schrieb:
>> Barry Smith schrieb:
>>> Use MatCreateIS() to create the matrix. Use MatSetValuesLocal() to  
>>> put
>>> the values in the matrix
>>> then use PCSetType(pc,PCNN); to set the preconditioner to NN.
>>>
>>
>> I followed your advice, but still run into problems.
>>
>> my sourcecode:
>>
>> ierr = KSPCreate(comm,&solver);CHKERRQ(ierr);
>> ierr =  
>> KSPSetOperators(solver,A,A,DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr);
>> ierr = KSPSetInitialGuessNonzero(solver,PETSC_TRUE);CHKERRQ(ierr);
>> ierr = KSPGetPC(solver,&prec);CHKERRQ(ierr);
>> ierr = PCSetType(prec,PCNN);CHKERRQ(ierr);
>> //ierr = PCFactorSetShiftPd(prec,PETSC_TRUE);CHKERRQ(ierr);
>> ierr = KSPSetUp(solver);CHKERRQ(ierr);
>> ierr = KSPSolve(solver,B,X);CHKERRQ(ierr);
>>
>> and the error message:
>>
>> [0]PETSC ERROR: --------------------- Error Message
>> ------------------------------------
>> [0]PETSC ERROR: Detected zero pivot in LU factorization
>> see
>> http://www.mcs.anl.gov/petsc/petsc-as/documentation/troubleshooting.html#ZeroPivot 
>> !
>> [0]PETSC ERROR: Zero pivot row 801 value 2.78624e-13 tolerance
>> 4.28598e-12 * rowsum 4.28598!
>> [0]PETSC ERROR:
>> ------------------------------------------------------------------------
>> [0]PETSC ERROR: Petsc Release Version 3.0.0, Patch 3, Fri Jan 30
>> 17:55:56 CST 2009
>> [0]PETSC ERROR: See docs/changes/index.html for recent updates.
>> [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
>> [0]PETSC ERROR: See docs/index.html for manual pages.
>> [0]PETSC ERROR:
>> ------------------------------------------------------------------------
>> [0]PETSC ERROR: Unknown Name on a linux64-g named mat1.uibk.ac.at by
>> csae1801 Fri Feb 27 10:12:34 2009
>> [0]PETSC ERROR: Libraries linked from
>> /home/lux/csae1801/petsc/petsc-3.0.0-p3/linux64-gnu-c-debug/lib
>> [0]PETSC ERROR: Configure run at Wed Feb 18 10:30:58 2009
>> [0]PETSC ERROR: Configure options --with-64-bit-indices
>> --with-scalar-type=real --with-precision=double --with-cc=icc
>> --with-fc=ifort --with-cxx=icpc --with-shared=0 --with-mpi=1
>> --download-mpich=ifneeded --with-scalapack=1
>> --download-scalapack=ifneeded --download-f-blas-lapack=yes
>> --with-blacs=1 --download-blacs=yes PETSC_ARCH=linux64-gnu-c-debug
>> [0]PETSC ERROR:
>> ------------------------------------------------------------------------
>> [0]PETSC ERROR: MatLUFactorNumeric_Inode() line 1335 in
>> src/mat/impls/aij/seq/inode.c
>> [0]PETSC ERROR: MatLUFactorNumeric() line 2338 in src/mat/interface/ 
>> matrix.c
>> [0]PETSC ERROR: PCSetUp_LU() line 222 in src/ksp/pc/impls/factor/lu/ 
>> lu.c
>> [0]PETSC ERROR: PCSetUp() line 794 in src/ksp/pc/interface/precon.c
>> [0]PETSC ERROR: KSPSetUp() line 237 in src/ksp/ksp/interface/itfunc.c
>> [0]PETSC ERROR: PCISSetUp() line 137 in src/ksp/pc/impls/is/pcis.c
>> [0]PETSC ERROR: PCSetUp_NN() line 28 in src/ksp/pc/impls/is/nn/nn.c
>> [0]PETSC ERROR: PCSetUp() line 794 in src/ksp/pc/interface/precon.c
>> [0]PETSC ERROR: KSPSetUp() line 237 in src/ksp/ksp/interface/itfunc.c
>> [0]PETSC ERROR: User provided function() line 1274 in petscsolver.c
>>
>>
>> Running PCFactorSetShift doesn't affect the output.
>>
>> any ideas?
>>
>> cheers
>>
>> ando
>>
>
> -- 
> /"\
> \ /      ASCII Ribbon
>  X    against HTML email
> / \
>
>



More information about the petsc-users mailing list