On Mon, 12 Jan 2009, John Peterson wrote:

> On Mon, Jan 12, 2009 at 3:00 PM, Brent Kraczek <[email protected]> 
> wrote:
>> Dear all,
>>
>> I am trying to set-up a simple poisson system where I will change my RHS
>> repeatedly, but the main system matrix will not change, so it will only
>> need to be inverted once. I have been looking through the class
>> definition for LinearImplicitSystem and its parent classes, but I don't
>> see how to implement this. (I did run across a comment about multiple
>> RHS in regard to the variable assemble_before_solve, but it's still not
>> clear to me.)
>>
>> Is there an example of this, or could you point me toward which member
>> functions to use to accomplish this?
>
> I think what you'll want is if-tests in your matrix assembly code
> which only assemble the matrix on the first trip through and on
> subsequent calls to assemble only assemble the right-hand sides.
> There's nothing that I know of in the library which makes this
> particularly easy to do, unfortunately.

This isn't too hard without library support.  Just stick a member
boolean in your system (or a static local boolean in your assembly
function) for matrix_valid, default it to false, set it to true after
an assembly, set it back to false when something happens to invalidate
that matrix.  The only time you'll want library support is in those
special cases (FEMSystem's nonlinear solvers, for example) where the
library knows enough to decide that only the residual needs
reassembly, and in that particular case there's already an API for it.

But I digress.  I think Brent's problem wasn't how to avoid redundant
matrix assembly, it was how to avoid redundant matrix inversion (or,
more generally, how to avoid throwing away and rebuilding your
preconditioner).

I think for that we currently force you to add a matrix named
"Preconditioner" to the system, which can be saved and used again on
subsequent solves.  I'm hazy on the details, though; I've never done
that myself.
---
Roy

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to