# [Trilinos-Users] [EXTERNAL] Re: problem computing eigenvalues with Sundance

Thornquist, Heidi K hkthorn at sandia.gov
Fri Feb 3 10:07:34 MST 2012

```Hi Andrea,

Thanks for sending the parameter list, this is very helpful.  I can make a couple of observations about the parameters that may help you.
First, I'm not sure how Sundance sets up the eigenvalue problem in its interface to Anasazi, but if you are needing to compute the smallest
magnitude eigenvalues, indicated by setting "Which" as "SM", then convergence is much faster if a spectral transformation is used on the
original eigenvalue problem (i.e. Shift-Invert).  In general, block Krylov-Schur converges to the largest magnitude eigenvalues first and is slow
converging to the smallest magnitude eigenvalues.

Next, two of the parameters in the list indicate the size of the subspace in which the approximate eigenvalues are computed:  "Num Blocks" and "Block Size"
Together, "Num Blocks" x "Block Size", is the total size of the subspace.  This number should be at least 3 times the number of eigenvalues you wish
to compute, which given by "Number of Eigenvalues", should be at least 30 and is currently 16.  This means that at every restart you are adding
at most 6 new vectors to the subspace.  This combined with the slow convergence properties of computing the smallest eigenvalues is probably the
issue.

If a spectral transformation is not available to you, I might suggest significantly increasing the "Num Blocks" parameter and maybe reducing the "Convergence Tolerance"
parameter until Sundance starts returning eigenvalues (you can also try reducing the number of eigenvalues you require temporarily).
It's difficult to know what these numbers should be apriori, so this will be trial and error.  Then you can decrease the convergence tolerance
and increase the subspace size and/or restarts to get the eigenvalues you desire.  FYI, "Num Blocks" x "Block Size" cannot be larger than the
dimension of the eigenproblem or you will receive another kind of exception for Anasazi, so don't increase that number too drastically :)

Hope this helps.

Thanks,
Heidi

________________________________
From: trilinos-users-bounces at software.sandia.gov [trilinos-users-bounces at software.sandia.gov] on behalf of Andrea Penza [pepe.aero at alice.it]
Sent: Friday, February 03, 2012 9:38 AM
To: benk
Cc: trilinos-users at software.sandia.gov
Subject: [EXTERNAL] Re: [Trilinos-Users] problem computing eigenvalues with Sundance

Dear Janos,

thanks to your suggestion I've been able to fix that problem. Anyway the simulation does not end fine.
The problem I'm trying to solve is a generalized non-hermitian eigenvalue problem, and I'm using these parameters:

<ParameterList>
<ParameterList name="Eigensolver">
<Parameter name="Method" type="string" value="Block Krylov Schur"/>
<Parameter name="Number of Eigenvalues" type="int" value="10"/>
<Parameter name="Block Size" type="int" value="4"/>
<Parameter name="Num Blocks" type="int" value="4"/>
<Parameter name="Verbosity" type="int" value="0"/>
<Parameter name="Which" type="string" value="SM"/>
<Parameter name="Use Preconditioner" type="bool" value="true"/>
<Parameter name="Is Hermitian" type="bool" value="false"/>
<Parameter name="Maximum Restarts" type="int" value="100"/>
<Parameter name="Use Locking" type="bool" value="false"/>
<Parameter name="Max Locked" type="int" value="1"/>
<Parameter name="Convergence Tolerance" type="double" value="1.0e-12"/>
<ParameterList name="Preconditioner">
<Parameter name="Type" type="string" value="ML"/>
<Parameter name="Problem Type" type="string" value="SA"/>
<ParameterList name="ML Settings">
<Parameter name="output" type="int" value="0"/>
</ParameterList>
</ParameterList>
</ParameterList>
</ParameterList>

I don't know if there is something wrong in this....
It seems to fail reaching convergence and the system reports this error:

p=0 | return code = 1
Sundance detected exception:
/usr/local/include/PlayaAnasaziEigensolverImpl.hpp:181:

Throw number = 1

Throw test that evaluated to true: returnCode != Anasazi::Converged

Anasazi did not converge!
test FAILED

Hope this sounds familiar to you...thanks to all for your help!
Best regards,

Andrea

Il giorno 02/feb/2012, alle ore 23.28, benk ha scritto:

Dear Andrea,

Try
Expr massExpr = vx*ux + vy*uy + 0.0*q*p;
Expr massExpr = Integral( interior, vx*ux + vy*uy + 0.0*q*p, quad2);
This should cure the problem.
Sundance internally creates the Integral object.

Best Regards,
Janos

On Thu, 2012-02-02 at 21:39 +0100, Andrea Penza wrote:
Dear all,

I have been trying for days to solve the eigenvalue problem related to
Navier-Stokes equations in primitive variables using Sundance. Here is
the formulation that brings me troubles.

// --------------------------------------------------------
bool lumpedMass = false;

BasisFamily L1 = new Lagrange(1);
BasisFamily L2 = new Lagrange(2);

Expr ux = new UnknownFunction(L2, "ux");
Expr vx = new TestFunction(L2, "vx");

Expr uy = new UnknownFunction(L2, "uy");
Expr vy = new TestFunction(L2, "vy");

Expr p = new UnknownFunction(L1, "p");
Expr q = new TestFunction(L1, "q");

Expr u = List(ux, uy);
Expr v = List(vx, vy);

// U is the solution of main flow, previously computed:
Expr U = List(u0, u0);

// Define the new weak form for the operator A:

Expr eqn4 = Integral( interior, (dx*ux + dy*uy) * q, quad2 );

Expr eqnEig = eqn3 + eqn4;

// Define the weak form to build the operator M:
Expr massExpr = Integral( interior, vx*ux + vy*uy + 0.0*q*p, quad2);

LinearEigenproblem probEig(mesh, eqnEig, massExpr, List(vx, vy, q),
List(ux, uy, p), vecType, lumpedMass);
// -------------------------------------------------------------

The compilation of the whole code ends fine.
Trying to run the executable the system reports this error:

Sundance detected exception:
/home/andrea/Projects/trilinos-10.8.3-Source/packages/Sundance/src-core/InternalExprs/SundanceSymbPreprocessor.cpp:221:

Throw number = 1

Throw test that evaluated to true: e==0

Non-evaluatable expr Sum of Integrals[
Integral[
rqc=Integration Region
            cell filter=MaximalCellFilter
            watchpoint=[]

expr=vx*ux+vy*uy
]
]
given to SymbPreprocessor::setupExpr()
test FAILED

Has anyone the idea of what could be the problem?
Kind regards,

Andrea

_______________________________________________
Trilinos-Users mailing list
Trilinos-Users at software.sandia.gov<mailto:Trilinos-Users at software.sandia.gov>
http://software.sandia.gov/mailman/listinfo/trilinos-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://software.sandia.gov/pipermail/trilinos-users/attachments/20120203/fbff594f/attachment.html
```