[petsc-users] Best way to solve eqns for Runge Kutta 3rd order schemes
Jed Brown
jed at 59A2.org
Fri Jul 1 17:40:00 CDT 2011
On Fri, Jul 1, 2011 at 17:19, TAY wee-beng <zonexo at gmail.com> wrote:
> Currently, I write in the matrix at each substep. I doubt this is the best.
>
Profile (perhaps with -log_summary, you may have to register a stage around
your assembly function) and see how much time is spent in assembly. If it's
not too much, then don't worry about it. If it is too much of the run time,
use a fine-grained profiler to see where the time is being spent. Sometimes
you can adjust mesh traversal to get better memory performance, or to remove
other inefficiencies. If it is still too much, think about how you can use
blocking, for example, to solve each velocity component at once (fewer
independent assemblies, fewer synchronization points). If it is still too
much, then perhaps consider alternatives below.
I am thinking of:
>
> 1. Instead of creating 2 matrices for x and y, I create 6, 2 for each
> substep. The off-diagonal elements are always the same. I only use
> MatDiagonalSet to change the diagonal elements for each matrix at different
> time steps
>
This uses a lot more memory.
>
> or
>
> 2. I only create 2 matrices. At each substep, I multiply the matrices by a
> constant, so that off-diagonal elements at one substep is equal to that of
> another. Then I use MatDiagonalSet to do the same as above.
>
If you can compute the diagonal without traversing the mesh, then this makes
sense.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110701/a6f62ccb/attachment.htm>
More information about the petsc-users
mailing list