This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Solve for two RHSs

0 votes

Dear all,

I have a simple problem that needs some optimization. My problem is that I have two linear systems sharing the same form: A u = p and A v = q, with the same BCs (neumann and dirichlet).

Right now what I do is simple, I assemble the system separately, and solve them:

PETScMatrix A;
PETScVector b;

assemble_system(A, b, a, L, bcs);

PETScLUSolver solver;

solver.solve(A, *(du1->vector()), b);

PETScVector b_t;

assemble_system(A, b_t, a, L_t, bcs);

solver.solve(A, *(du2->vector()), b_t);

Since in essence I have just one matrix, and one dirichlet BCs vector, and that won't change in computing the two solutions, what can I do to optimize my code?

I am not bound to LU solvers, just in case another one would be better.

Thanks!

asked May 13, 2016 by senseiwa FEniCS User (2,620 points)

So... is it possible to do something?

1 Answer

0 votes

I believe this kind of functionality is available in Trilinos, with their MultiVector.

answered May 23, 2016 by chris_richardson FEniCS Expert (31,740 points)

Yes, it is, in the past I've used Epetra_MultiVector.

I have two problems with Epetra or Trilinos. First, as far as I remember, they're not part of Fenics, and second, I'd very much like to avoid having two assemble() calls for the RHSs.

How do you suggest I could use Epetra?

PS. The people I'm working with are not really computer-savvy, so the Fenics application is the perfect solution (we're on Mac computers).

...