[Trilinos-Users] using teko

Cyr, Eric C eccyr at sandia.gov
Thu Jan 3 15:52:39 MST 2013


Giang Bui,

Thanks for the question. I'll try to explain what is going on.

   const Teko::LinearOp invA = Teko::buildInverse(*invAfact_, A);
   const Teko::LinearOp invS = Teko::buildInverse(*invSfact_, S);

These operations create some approximation inverse of 'A' and 'S'. None
of the standard inverse factories create a concrete Epetra_CrsMatrix (they
are possibly Epetra_Operator objects). Now when you call

   const Teko::LinearOp tmpP = Teko::explicitMultiply(invS, Teko::explicitMultiply(B2, invA));

What this says is that you want to form the product of invS*B2*invA explicitly. That means
it will try to do first multiply B2*invA and store it as a CRS matrix. Generally this operation is not possible
since B2 is probably a sparse operator and invA is likely an approximation of a dense
inverse (using Aztec for instance). Teko will not allow this operation because it would be
very, very expensive. What Teko does allow is "implicit" multiply operations. That is you
can compute the action of invS*B2*invA by chaining together their application. To do that
the pertinent line is

   const Teko::LinearOp tmpP = Teko::multiply(invS, Teko::multiply(B2, invA));

So what is explicitMultiply and explicitAdd for then? Well sometimes you know you have
a concrete sparse matrix and you want to explicitly form an operator so you can apply
multigrid or ILU to it as an approximate inverse. For example, in the SIMPLE preconditioner
for Navier-Stokes you need to form a Schur complement that looks like

   S=C-B*H*Bt

Where C, B, and Bt are sparse CRS matrices and H is a diagonal matrix. Thus the Teko code
for combining those is (not the most efficient version mind you)

   const Teko::LinearOp S = Teko::explicitAdd(C,Teko::scale(-1.0,Teko::explicitMulitiply(B,H,Bt)));

This gives a concrete sparse CRS matrix that you can then apply ML, IFPACK or Amesos to. The
efficient construction of these approximations is what makes block preconditioning challenging,
but this is an issue that has to be resolved and understood at the mathematical level.

Please let me know if some I said is not clear. I appreciate your interest in Teko and would be eager
to hear about your project and its goals, so please feel free to contact me.

Eric

From: "Heroux, Michael A" <maherou at sandia.gov<mailto:maherou at sandia.gov>>
Date: Thu, 3 Jan 2013 15:30:26 -0700
To: Eric Cyr <eccyr at sandia.gov<mailto:eccyr at sandia.gov>>, Hoang Giang Bui <hgbk2008 at gmail.com<mailto:hgbk2008 at gmail.com>>
Subject: Re: [Trilinos-Users] using teko

Giang Bui,

I have copied Eric Cyr on this message.  He is the principal author of Teko.

Eric, Do you have any advice?

Thanks.

Mike

From: Hoang Giang Bui <hgbk2008 at gmail.com<mailto:hgbk2008 at gmail.com>>
Date: Tuesday, December 25, 2012 7:42 AM
To: "trilinos-users at software.sandia.gov<mailto:trilinos-users at software.sandia.gov>" <trilinos-users at software.sandia.gov<mailto:trilinos-users at software.sandia.gov>>
Subject: [EXTERNAL] [Trilinos-Users] using teko

Hi

When using Teko to build the preconditioner operator for Aztec solver I faced this error:

I tried to create the LinearOp of invS * B2 * invA. The invS is the approximation of S^{-1} and invA is approximation of A^{-1}. I created invS and invA by this code

const Teko::LinearOp invA = Teko::buildInverse(*invAfact_, A);
const Teko::LinearOp invS = Teko::buildInverse(*invSfact_, S);

Then

const Teko::LinearOp tmpP = Teko::explicitMultiply(invS, Teko::explicitMultiply(B2, invA));

At this point, the program crashed and thow the error:

Throw number = 1

Throw test that evaluated to true: true

dyn_cast<Thyra::EpetraLinearOp>(Thyra::LinearOpBase<double>) : Error, the object with the concrete type 'Thyra::DefaultInverseLinearOp<double>' (passed in through the interface type 'Thyra::LinearOpBase<double>')  does not support the interface 'Thyra::EpetraLinearOp' and the dynamic cast failed!

As I assumed, the type of invA and invS is Thyra::DefaultInverseLinearOp<double> and not inherited from Thyra::EpetraLinearOp, hence the dynamic_cast is failed. I also think that the InverseLinearOp does not try to create Crs_Matrix so it is not compatible with EpetraLinearOp.

Please help me on this case. It's important for me to create a block preconditioner for my problem.

BR
Giang Bui

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://software.sandia.gov/pipermail/trilinos-users/attachments/20130103/6ad48900/attachment.html 


More information about the Trilinos-Users mailing list