Trilinos icon indicating copy to clipboard operation
Trilinos copied to clipboard

epetra: create Epetra_FECrsMatrix from Epetra_FEVbrMatrix to solve linear system with direct solver (amesos)

Open swiesheier opened this issue 1 year ago • 8 comments

Question

I use a wrapper to Epetra_FEVbrMatrix to assemble a 2x2 block system matrix arising from finite elements.

To use one of the direct solvers from amesos package, I have to pass an object of type Epetra_FECrsMatrix.

So given a Epetra_FEVbrMatrix, how can I create Epetra_FECrsMatrix in an efficient manner? The dimension of the matrix is moderate (more than 50k degrees of freedom, but not more than 500k dofs).

To have the flexibility to use iterative solvers (where I have to develop a block preconditioner), I decided to use an Epetra_FEVbrMatrix although I use an direct solver in some cases.

Thank you!

swiesheier avatar Dec 16 '23 18:12 swiesheier

@swiesheier Is this in the context of a legacy code base? Otherwise, please do not use Epetra anymore, it will get dropped in the near future. Use Tpetra instead.

cgcgcg avatar Dec 16 '23 18:12 cgcgcg

@cgcgcg I have access to [email protected]. Once I upgrade my software packages, I will link to a newer version of trilinos. But for now and the near future, I have to use 13.4.1.

swiesheier avatar Dec 16 '23 19:12 swiesheier

Tpetra is part of Trilinos 13.4.1 and has been for a while. I want to avoid that any new code is developed against Epetra, given that it will get dropped. (Also, no development of the Epetra stack has happened in years.)

cgcgcg avatar Dec 16 '23 19:12 cgcgcg

@cgcgcg Makes sense. However, the wrapper class I use from my pde package (deal.ii) uses the Epetra class I mentioned.

So in 13.4.1, what could be a way to solve my problem? I mean looping over the elements of the block matrix is a way, but probably very inefficient.

swiesheier avatar Dec 16 '23 19:12 swiesheier

(Caveat: I am not an Epetra user.) Looking at the documentation, maybe try using Epetra_VbrRowMatrix. My understanding is that it allows to wrap an Epetra_VbrMatrix and implements the Epetra_RowMatrix interface.

cgcgcg avatar Dec 16 '23 19:12 cgcgcg

@cgcgcg

I double-checked my implementation. Basically the data structure I am working with consists of 4 Epetra_FECrsMatrix objects that represent the individual blocks of my 2x2 block system. My objective is to combine them into one Epetra_FECrsMatrix object to use the amesos direct solvers.

How could I realize this?

swiesheier avatar Dec 18 '23 14:12 swiesheier

You could use the Teko package to manage your 2x2 system.

cgcgcg avatar Dec 18 '23 16:12 cgcgcg

As I said, I only use wrappers to Trilinos from within my pde software package (deal.ii). Things get too complicated if I start to interface with Trilinos directly from within deal.ii. So what I can work with is the "vector of size 4" of Epetra_FECrsMatrix objects which I somehow have to merge in a single Epetra_FECrsMatrix.

swiesheier avatar Dec 18 '23 16:12 swiesheier