[Dune] Parallel CG Solver

Markus Blatt Markus.Blatt at ipvs.uni-stuttgart.de
Fri Nov 21 11:34:42 CET 2008


Hi,

On Thu, Nov 20, 2008 at 12:35:49PM +0100, Arne Rekdal wrote:
> Hey again :)
> 
> I have now changed focus to actually create the local matrices on each  
> processor.  So I am trying the method suggested by Markus.
> 
>  > Assuming a simple 1D problem this might look like this (in terms of
>  > indices)
>  > 0: 0,1,2; 1:2,3,4; 2:4,5,6

I will assume the corresponding local indices and attributes as (you
are not representing boundary conditions in your matrix, but
incorporating them into the right hand side, right? If not the dashes
have to be represented, too.)
     0: -,0,1; 1: 0,1,2; 2:0,1,-
     0: -,o,c; 1: g,o,c; 2:c,o,-

o: owner (marks the disjoint partion), c: copy (owned by other processors)
> 
> Assuming dirichlet boundary conditions at node 0 and 6 and linear  
> elements, does this mean that the local matrices on each processor  
> should be: (MATLAB syntax)
> 
> A_0=(1/h) [ 2  -1 ; -1 2]
> A_1=(1/h) [ 2 -1 0; -1 2 -1; 0 -1 2]
> A_2=(1/h) [ 2 - 1; -1 2],
> 

Represent the copy dofs as dirichlet boundary condions:
 A_0=(1/h) [ 2  -1 ; 0 1]
 A_1=(1/h) [ 1 0 0; -1 2 -1; 0 0 1]
 A_2=(1/h) [ 1 0; -1 2],

> and not
> 
> A_0=(1/h) [ 2  -1 ; -1 1]
> A_1=(1/h) [ 1 -1 0; -1 2 -1; 0 -1 1]
> A_2=(1/h) [ 1- 1; -1 2]
> 
> as it would be if I only had assembled the matrices on each disjoint  
> partition without communication?

To me the disjoint local matrices would have no entries for the copy dofs.

> 
> One quick question regarding BCRSMatrix: From what I can see it would  
> have been easier to add the indices first and then the rowsizes could  
> have been estimated. I can not figure out a "cheap" way to count how  
> many elements a row can have without exploiting the structure of the  
> grid. Suggestions?
> 

The point is that we want to have the matrix entries in contiguous
memory. Therefore one first needs to setup the total size and then add
entries/indices.

I assume your are setting up the matrices in random mode.

Have you considered row-wise mode and specifying (the upper bound for)
the number of dofs in the cronstructor?
Here you use the CreateIterator (createbegin() and createend()) for
iterating over the matrix rows and using insert to the nonzero columns
for each row.

After doing this you can assemble the matrix values (which needs a
second pass over the grid of course.

I have just added some sample code to the unstable BCRSMatrix
documentation. (It will take some time (40 min) until it is availabled
from the website.

Markus



More information about the Dune mailing list