Dear Amal,<div><br></div><div>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:</div>
<div><br></div><div><div><b>How to set up a DA for multiple equations in petsc4py or PETSc? (for q)</b></div>
<div><br></div><div>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 (<a href="http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-dev/docs/manualpages/DA/DASetDof.html">http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-dev/docs/manualpages/DA/DASetDof.html</a>) to set the number of degrees of freedom per vertex. </div>
<div><br></div><div><b>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.</b></div>
<div><br></div><div>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.</div>
<div><br></div><div><b>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?</b></div>
<div><br></div><div>PetscPrintf (<a href="http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-dev/docs/manualpages/Sys/PetscPrintf.html">http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-dev/docs/manualpages/Sys/PetscPrintf.html</a>) will do what you want.</div>
<div><br></div><div>Hope this helps,</div><div>Aron</div><div><br></div>
<div class="gmail_quote">On Sat, Sep 18, 2010 at 3:06 AM, Amal Alghamdi <span dir="ltr"><<a href="mailto:amal.ghamdi@kaust.edu.sa" target="_blank">amal.ghamdi@kaust.edu.sa</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Dear Dr. Aron and Dr. Matt,<div><br></div><div>I had a discussion with Dr. David where we had some questions about PETSc. We would appriciate if you can help in this regard. </div><div><br></div><div>- How to set up a DA for multiple equations in petsc4py or PETSc? (for q)</div>
<div>- 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.</div>
<div>- 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?</div>
<div><br></div><div>Thank you,</div><div>Amal<br><div><br></div><div><br></div></div></div>
</blockquote></div><br></div>