[petsc-users] some questions about PETSc

Aron Ahmadia aron.ahmadia at kaust.edu.sa
Sat Sep 18 19:01:17 CDT 2010


Dear Amal,

Thanks for the questions.  These are great!  I think they show a good
fundamental approach, you are thinking about these problems like a PETSc
scientist would.  I am going to cc petsc-users on the reply in case anybody
wants to add or comment:

*How to set up a DA for multiple equations in petsc4py or PETSc? (for q)*

The PETSc terminology for the number of equations active at a given node is
'degrees of freedom', which as far as I can tell, is a term borrowed from
finite element analysis of structures, originally referring (in mechanics)
to the number of potential displacements or rotations that specify an
element in the system, but in computational science as a way to describe the
total number of equations in the discretized system (i.e., the number of
elements in the right-hand side vector).  After you have called DACreate,
you call DASetDof (
http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-dev/docs/manualpages/DA/DASetDof.html)
to set the number of degrees of freedom per vertex.

*How to deal with boundary conditions where you have special treatment for
them?  In an example we have seen that is done by simply if statements that
checks if this point is a boundary condition cell, should we do it this way.
*

As far as I know, this is the PETSc way, so you do not need to do anything
differently :o)  Later on, when we are tuning for performance, we might
extract the boundary-handling code from the main for loop, and create index
sets to represent each of the sections of the array we would like to iterate
over.  If we profile the code and this is a non-significant section, then we
just leave it.

*When we start incorporating petsc4py structures in clawpack, output is
being duplicate for each process, is the way to avoid this is by (if
statements) to determine that everything need to be done once is the
responsibility of process 0 for instance, or there are other ways to do it?*

PetscPrintf (
http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-dev/docs/manualpages/Sys/PetscPrintf.html)
will do what you want.

Hope this helps,
Aron

On Sat, Sep 18, 2010 at 3:06 AM, Amal Alghamdi <amal.ghamdi at kaust.edu.sa>wrote:

> Dear Dr. Aron and Dr. Matt,
>
> I had a discussion with Dr. David where we had some questions about PETSc.
> We would appriciate if you can help in this regard.
>
> - How to set up a DA for multiple equations in petsc4py or PETSc? (for q)
> - How to deal with boundary conditions where you have special treatment for
> them? and should they be included in the main vector in the DA explicitly.
> In an example we have seen that is done by simply if statements that checks
> if this point is a boundary condition cell, should we do it this way.
> - When we start incorporating petsc4py structures in clawpack, output is
> being duplicate for each process, is the way to avoid this is by (if
> statements) to determine that everything need to be done once is the
> responsibility of process 0 for instance, or there are other ways to do it?
>
> Thank you,
> Amal
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20100918/26964632/attachment.htm>


More information about the petsc-users mailing list