[petsc-users] overset grids

Mark Adams mfadams at lbl.gov
Mon Jan 27 07:30:49 CST 2020


On Fri, Jan 24, 2020 at 9:25 AM Mark Cunningham <
mark.cunningham at ariacoustics.com> wrote:

> As a novice PETSc user, can I ask for some advice? I've found some test
> examples that do similar sorts of things but I would appreciate any
> suggestions.
> I have a matrix generated from overset meshes with a structure like
> A = |A0  B01     B0n|
>       |B01  A1     B1n|
>          :                 :
>       |B0n    ...        An|   where the Ai are finite difference stencils
> and the Bij
>  represent interpolation between the grids.
> 1. If I create a DMDA composite object that defines each of the grid sizes
> through repeated calls to DMCreate1D (because we are omitting blanked
> points from the 3D mesh) and create the matrix
> through DMCreateMatrix, can I still fill the matrix through MatSetValues
> using the global index?
>

You might just want to use an AIJ matrix if you are sparse (omitting points)


> (This is how the code operates now.)
> 2. If I have to declare the matrix to be matnest and I have to create each
> of the subblocks individually, how do I cope with some of the Bij being all
> zero?
>

A sparse matrix (AIJ) can be empty.


> Must there be a MatSetValues call for each block?
>

With AIJ, yes. You need to keep track of indexing.


> 3. The principle reason at the moment for the change is to use
> diag(A0...An) as the precondition matrix and use ILU on the blocks. If I
> set the preconditioner to be bjacobi and then fetch the subksps, can I then
> set the subpcs to be ilu?
>

ILU is local, not MPI parallel, so you will get a diag block structure by
default. So ILU is bjacobi with something on the blocks (eg, ILU), but you
can specify bjacobi and then specify the PC on each block, not the KSP (I
think). The KSP is global, but there may be a way to use a KSP PC if you
really want to.


> 4. A further complication is we would like to have a boundary condition
> where the values of the boundary points are defined by an expansion in
> functions that satisfy the radiation condition.  So, I would like to define
> an index set that identifies the boundary points and define a PCSHELL on A
> that for the pcsetup phase will do a QR factorization of the auxiliary
> matrix: G, where we're solving
> Gy = QRy =c and then on pcapply do the Ry = Q* c triangular solve that
> will enable me to update
> the boundary points (y subset of x the solution vector.)  How do I get the
> PCSHELL to work with the block jacobi strategy.
>

Block Jacobi has a sub PC for each block. You can set these manually or
with the command line (eg, -pc_type bjacobi -sub_pc_type ilu). You can
register your shell PC, but you probably don't want to jump through
these hoops at this point, so use things like KPSGetPC, PCGetSubBlocks
(something like that). And keep digging down until you get to the block PCs.


>
> Thanks for any suggestions.
>
> Mark Cunningham
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200127/57eb992a/attachment.html>


More information about the petsc-users mailing list