Non-uniform 2D mesh questions
Barry Smith
bsmith at mcs.anl.gov
Thu Mar 1 15:59:00 CST 2007
Yaron,
We don't really have tools to help do this efficiently (especially
in parallel). The DA, IS and AO are not related to this.
It is all doable and not terribly difficult (I think) but we
just don't have the pieces to
1) get the local to global index map (you need to do this based
on your geometry)
2) given a sparse matrix and a mapping from its local rows/columns to
global rows/columns stick the values into the larger map. To start
you can simply loop over the rows of the small matrix and call matsetvalues
onto the big matrix after mapping the row number and the column numbers
for that row. This will be really slow until you preallocate the larger
matrix. Figuring out the preallocation for the larger matrix is not
terribly hard, you again loop over the rows in the small matrix count
how many entries will be in the "diagonal part" of the large parallel
matrix and how many in the "off-diagonal part". Once you have all
this call MatCreateMPIAIJ() with the computed row lengths. All of this
mapping stuff would just be done with arrays of integers.
I'm sorry but this is so different from what our "paying customers"
need that we cannot write the code. But, as always, we'll do our best
to answer questions that may come up.
Good luck,
Barry
On Tue, 6 Feb 2007, yaron at oak-research.com wrote:
> Barry-
> Maybe i'd better provide more details on what I'm trying to do
>
> *) I'm modeling current flowing through several different "block types",
> each of which describes a section of a semiconductor device. Each block
> type has a different geometry, which is triangulated to create an AIJ
> matrix (Each row/column in the matrix represents a coordinate, and the
> matrix values represent electrical admittance). There are about 100
> different types of these blocks, and since they have quite convoluted
> geometries , their triangulation takes quite a while.
>
> *) My complete problem is composed of many (up to 10K) tiles, each of
> which is one of the 100 blocks . I want to reuse the triangulation which
> was done for each of the block, do I'd like to have a way of taking the
> matrix objects of the individual blcks, and combine them into a large
> matrix, taking into account their relative locations.
>
> *) This means that for each block instance, I would need to to translate
> every internal coordinate/node, and map it to a global coordinate/node.
>
> *) Once I have a mapping of local to global indices, I'd like to take the
> matrix values of the instances, and combine them to form a large matrix
> which describes the complete problem.
>
>
> So my question is :
> *) What data structures (DA/IS/AO/???) should I use to achieve the above?
>
> Best Regards
> Yaron
>
>
> -------Original Message-------
> From: Barry Smith
> Subject: Re: Non-uniform 2D mesh questions
> Sent: 02 Feb '07 13:38
>
>
> Yaron,
>
> Anything is possible :-) and maybe not terribly difficult to get
> started.
>
> You could use DAGetMatrx() to give you the properly pre-allocated "huge"
> Mat.
>
> Have each process loop over the "rectangular portion[s] of the domain"
> that
> it mostly owns (that is if a rectangular portion lies across two
> processes just
> assign it to one of them for this loop.)
>
> Then loop over the locations inside the rectangular portion calling
> MatSetValuesStencil() for that row of the huge matrix to put the entries
> from
> the smaller matrix INTO the huge matrix using the natural grid i,j
> coordindates
> (so not have to map the coordinates from the grid location to the
> location in
> the matrix).
>
> This may require some thought to get right but should require little
> coding
> (if you are writting hundreds and hundreds of lines of code then likely
> something is wrong).
>
> Good luck,
>
> Barry
>
>
> On Tue, 30 Jan 2007, [LINK:
> http://webmail.oak-research.com/compose.php?to=yaron@oak-research.com]
> yaron at oak-research.com wrote:
>
> > Barry-
> > So far I only thought of having a single large sparse matrix.
> >
> > Yaron
> >
> >
> > -------Original Message-------
> > From: Barry Smith
> > Subject: Re: Non-uniform 2D mesh questions
> > Sent: 30 Jan '07 10:58
> >
> >
> > Yaron,
> >
> > Do you want to end up generating a single large sparse matrix? Like a
> > MPIAIJ
> > matrix? Or do you want to somehow not store the entire huge matrix but
> > still
> > be able to solve with the composed matrix? Or both?
> >
> > Barry
> >
> >
> > On Mon, 29 Jan 2007, [LINK:
> > [LINK:
> http://webmail.oak-research.com/compose.php?to=yaron@oak-research.com]
> http://webmail.oak-research.com/compose.php?to=yaron@oak-research.com]
> > [LINK:
> http://webmail.oak-research.com/compose.php?to=yaron@oak-research.com]
> yaron at oak-research.com wrote:
> >
> > > Barry-
> > > Yes, each block is a rectangular portion of the domain. Not so small
> > > though (more like 100 x 100 nodes)
> > >
> > > Yaron
> > >
> > >
> > > -------Original Message-------
> > > From: Barry Smith
> > > Subject: Re: Non-uniform 2D mesh questions
> > > Sent: 29 Jan '07 19:40
> > >
> > >
> > > Yaron,
> > >
> > > Is each one of these "blocks" a small rectangular part of the
> > > domain (like a 4 by 5 set of nodes)? I don't understand what you
> > > want to do.
> > >
> > > Barry
> > >
> > >
> > > On Mon, 29 Jan 2007, [LINK:
> > > [LINK:
> > [LINK:
> http://webmail.oak-research.com/compose.php?to=yaron@oak-research.com]
> http://webmail.oak-research.com/compose.php?to=yaron@oak-research.com]
> > [LINK:
> http://webmail.oak-research.com/compose.php?to=yaron@oak-research.com]
> http://webmail.oak-research.com/compose.php?to=yaron@oak-research.com]
> > > [LINK:
> > [LINK:
> http://webmail.oak-research.com/compose.php?to=yaron@oak-research.com]
> http://webmail.oak-research.com/compose.php?to=yaron@oak-research.com]
> > [LINK:
> http://webmail.oak-research.com/compose.php?to=yaron@oak-research.com]
> yaron at oak-research.com wrote:
> > >
> > > > Hi all
> > > > I have a laplace-type problem that's physically built from
> repeating
> > > > instances of the same block.
> > > > I'm creaing matrices for the individual blocks, and I'd like to
> > reuse
> > > > the individual block matrices in order to compose the complete
> > > problem.
> > > > (i.e if there 10K instances of 20 blocks, I'd like to build 20
> > > matrices,
> > > > then use them to compose the large complete matrix)
> > > > Is a 2D DA the right object to do that? And if so, where can I
> find
> > a
> > > > small example of building the DA object in parallel, then using
> the
> > > > different (for every instance) mappings of local nodes to global
> > nodes
> > > in
> > > > order to build the complete matrix?
> > > >
> > > >
> > > > Thanks
> > > > Yaron
> > > >
> > >
> >
>
More information about the petsc-users
mailing list