[petsc-users] SLEPc iterative solver does not converge but ARPACK does
Julian Andrej
juan at tf.uni-kiel.de
Mon Jul 6 07:34:06 CDT 2015
Thanks Jose,
replacing
E.setWhichEigenpairs(E.Which.SMALLEST_MAGNITUDE)
with
E.setTarget(1.0)
did the trick.
$ python ev_test.py
Solution type krylovschur
Number of converged eigenpairs 25
k ||Ax-kx||/||kx||
----------------- -----------------
13.087798 1.80257e-13
23.038756 7.41391e-14
On Mon, Jul 6, 2015 at 1:31 PM, Jose E. Roman <jroman at dsic.upv.es> wrote:
> You should not use SMALLEST_MAGNITUDE with SINVERT.
> If using SINVERT you should set the target value E.setTarget(sigma) and leave the default Which (or set it explicitly to Which.TARGET_MAGNITUDE).
>
> Jose
>
>
>
>> El 6/7/2015, a las 13:26, Julian Andrej <juan at tf.uni-kiel.de> escribió:
>>
>> Hello,
>>
>> i'm using PETSc and SLEPc in Python.
>>
>> I'm trying to calculate eigenvalues for the stokes equations with the
>> following code
>>
>> SHIFT = SLEPc.ST().create()
>> SHIFT.setType(SHIFT.Type.SINVERT)
>> E = SLEPc.EPS().create()
>> E.setST(SHIFT)
>> E.setOperators(K, M)
>> E.setDimensions(25, PETSc.DECIDE)
>> E.setWhichEigenpairs(E.Which.SMALLEST_MAGNITUDE)
>> E.setFromOptions()
>> E.solve()
>>
>> This gives me correct eigenvalues and right eigenvectors.
>>
>> If I want to compute the LEFT eigenvectors i setup a new solver
>> context with the corresponding transposed matrices (these are
>> precalculated)
>>
>> SHIFT = SLEPc.ST().create()
>> SHIFT.setType(SHIFT.Type.SINVERT)
>> E = SLEPc.EPS().create()
>> E.setST(SHIFT)
>> E.setOperators(KT, MT)
>> E.setDimensions(25, PETSc.DECIDE)
>> E.setWhichEigenpairs(E.Which.SMALLEST_MAGNITUDE)
>> E.setFromOptions()
>> E.solve()
>>
>> I don't get any converged eigenvalues.
>>
>> Interfacing ARPACK through scipy
>>
>> v, V = sp.linalg.eigs(A=K, k=64, M=M, sigma=1.0)
>> w, W = sp.linalg.eigs(A=K.T, k=64, M=M.T, sigma=1.0)
>>
>> i get correct left and right eigenvectors (passing (K*V-M*V*diag(v)) < 1e-10)
>>
>> I tried alot of configurations to get it working, so i dont have to
>> convert matrices in my calculations.
>> Is it possible to get the expected results with the iterative solver?
>
More information about the petsc-users
mailing list