<div dir="ltr">On Sat, Oct 26, 2013 at 3:12 AM, Bishesh Khanal <span dir="ltr"><<a href="mailto:bisheshkh@gmail.com" target="_blank">bisheshkh@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote"><div class="im">On Fri, Oct 25, 2013 at 10:21 PM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>On Fri, Oct 25, 2013 at 2:55 PM, Bishesh Khanal <span dir="ltr"><<a href="mailto:bisheshkh@gmail.com" target="_blank">bisheshkh@gmail.com</a>></span> wrote:</div>

<div class="gmail_extra"><div class="gmail_quote"><div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Oct 25, 2013 at 8:18 PM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div>On Fri, Oct 25, 2013 at 12:09 PM, Bishesh Khanal <span dir="ltr"><<a href="mailto:bisheshkh@gmail.com" target="_blank">bisheshkh@gmail.com</a>></span> wrote:<br>



</div></div><div class="gmail_extra"><div class="gmail_quote"><div><div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div>Dear all,<br></div>I would like to know if some of the petsc objects that I have not used so far (IS, DMPlex, PetscSection) could be useful in the following case (of irregular domains): <br>




<br>
</div>Let's say that I have a 3D binary image (a cube).<br>The binary information of the image partitions the cube into a computational domain and non-computational domain. <br>I must solve a pde (say a Poisson equation) only on the computational domains (e.g: two isolated spheres within the cube). I'm using finite difference and say a dirichlet boundary condition<br>





</div><div><br>I know that I can create a dmda that will let me access the information from this 3D binary image, get all the coefficients, rhs values etc using the natural indexing (i,j,k).<br><br>Now, I would like to create a matrix corresponding to the laplace 
operator (e.g. with standard 7 pt. stencil), and the corresponding RHS 
that takes care of the dirchlet values too. <br></div><div>But in this matrix it should have the rows corresponding to the nodes only on the computational domain. It would be nice if I can easily (using (i,j,k) indexing) put on the rhs dirichlet values corresponding to the boundary points. <br>





Then, once the system is solved, put the values of the solution back to the corresponding positions in the binary image.<br></div><div>Later, I might have to extend this for the staggered grid case too.<br></div><div>So is petscsection or dmplex suitable for this so that I can set up the matrix with something like DMCreateMatrix ? Or what would you suggest as a suitable approach to this problem ?<br>





</div><div><br></div><div>I have looked at the manual and that led me to search for a simpler examples in petsc src directories. But most of the ones I encountered are with FEM (and I'm not familiar at all with FEM, so these examples serve more as a distraction with FEM jargon!) <br>




</div></div></blockquote><div><br></div></div></div><div>It sounds like the right solution for this is to use PetscSection on top of DMDA. I am working on this, but it is really</div><div>alpha code. If you feel comfortable with that level of development, we can help you.</div>



</div></div></div></blockquote><div> </div><div>Thanks, with the (short) experience of using Petsc so far and being familiar with the awesomeness (quick and helpful replies) of this mailing list, I would like to give it a try. Please give me some pointers to get going for the example case I mentioned above. A simple example of using PetscSection along with DMDA for finite volume (No FEM) would be great I think.<br>



Just a note: I'm currently using the petsc3.4.3 and have not used the development version before. </div></div></div></div></blockquote><div><br></div></div><div>Okay,</div><div><br></div><div>1)  clone the repository using Git and build the 'next' branch.</div>

</div></div></div></blockquote></div><div><br>I encountered errors when doing make on the 'next' branch. The errors 
are as follows (I tried attached the configure.log file but the email bounced back saying it awaits moderator approval for having too big an attachment, so I'm sending this one with only make.log attached. ) :<br></div>
</div></div></div></blockquote><div><br></div><div>They are fixed. Pull again and rebuild.</div><div><br></div><div>  Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>
         CXX arch-linux2-cxx-debug/obj/src/<div><div class="im">mat/order/ftn-auto/spectralf.o<br>
         CXX arch-linux2-cxx-debug/obj/src/mat/order/ftn-custom/zsorderf.o<br>src/mat/order/wbm.c: In function ‘PetscErrorCode MatGetOrdering_WBM(Mat, MatOrderingType, _p_IS**, _p_IS**)’:<br>src/mat/order/wbm.c:12:24: warning: variable ‘cntl’ set but not used [-Wunused-but-set-variable]<br>


src/mat/order/wbm.c:15:36: warning: unused variable ‘num’ [-Wunused-variable]<br>src/mat/order/wbm.c:15:56: warning: variable ‘icntl’ set but not used [-Wunused-but-set-variable]<br>src/mat/order/wbm.c:15:66: warning: unused variable ‘info’ [-Wunused-variable]<br>


         CXX arch-linux2-cxx-debug/obj/src/mat/matfd/fdmatrix.o<br>src/mat/order/ftn-auto/spectralf.c: In function ‘void matcreatelaplacian_(Mat, PetscReal*, PetscBool*, _p_Mat**, int*)’:<br>src/mat/order/ftn-auto/spectralf.c:44:40: error: ‘MatCreateLaplacian’ was not declared in this scope<br>


gmake[2]: *** [arch-linux2-cxx-debug/obj/src/mat/order/ftn-auto/spectralf.o] Error 1<br>gmake[2]: *** Waiting for unfinished jobs....<br>src/mat/order/hslmc64.c:
 In function ‘PetscErrorCode HSLmc64AD(const PetscInt*, PetscInt*, 
PetscInt*, PetscInt*, const PetscInt*, const PetscInt*, PetscScalar*, 
PetscInt*, PetscInt*, PetscInt*, PetscInt*, PetscInt*, PetscScalar*, 
PetscInt*, PetscScalar*, PetscInt*)’:<br>
src/mat/order/hslmc64.c:332:21: warning: variable ‘warn1’ set but not used [-Wunused-but-set-variable]<br>src/mat/order/hslmc64.c:332:28: warning: variable ‘warn2’ set but not used [-Wunused-but-set-variable]<br>src/mat/order/hslmc64.c:332:35: warning: variable ‘warn4’ set but not used [-Wunused-but-set-variable]<br>


gmake[2]: Leaving directory `/home/bkhanal/Documents/softwares/petsc'<br>gmake[1]: *** [gnumake] Error 2<br>gmake[1]: Leaving directory `/home/bkhanal/Documents/softwares/petsc'<br>**************************ERROR*************************************<br>


  Error during compile, check arch-linux2-cxx-debug/conf/make.log<br>  Send it and arch-linux2-cxx-debug/conf/configure.log to <a href="mailto:petsc-maint@mcs.anl.gov" target="_blank">petsc-maint@mcs.anl.gov</a><br>********************************************************************<br>


make: *** [all] Error 1</div><div><div><img src="https://mail.google.com/mail/images/cleardot.gif"></div></div></div><br> </div><div class="im"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">
<div><br></div><div>2) then we will need to create a PetscSection that puts unknowns where you want them</div><div><br></div><div>3) Setup the solver as usual</div><div><br></div><div>You can do 1) an 3) before we do 2).</div>

<div>
<div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">



<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> If not, just put the identity into</div>
<div>the rows you do not use on the full cube. It will not hurt scalability or convergence.</div></div></div></div></blockquote><div> </div>In the case of Poisson with Dirichlet condition this might be the case. But is it always true that having identity rows in the system matrix will not hurt convergence ? I thought otherwise for the following reasons:<br>



</div><div class="gmail_quote">1)  Having read Jed's answer here : <a href="http://scicomp.stackexchange.com/questions/3426/why-is-pinning-a-point-to-remove-a-null-space-bad/3427#3427" target="_blank">http://scicomp.stackexchange.com/questions/3426/why-is-pinning-a-point-to-remove-a-null-space-bad/3427#3427</a></div>


</div></div></blockquote><div><br></div></div><div>Jed is talking about a constraint on a the pressure at a point. This is just decoupling these unknowns from the rest</div><div>of the problem.</div><div><div>
 </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2) Some observation I am getting (but I am still doing more experiments to confirm) while solving my staggered-grid 3D stokes flow with schur complement and using -pc_type gamg for A00 matrix. Putting the identity rows for dirichlet boundaries and for ghost cells seemed to have effects on its convergence. I'm hoping once I know how to use PetscSection, I can get rid of using ghost cells method for the staggered grid and get rid of the identity rows too.<br>


</div></div></div></blockquote><div><br></div></div><div>It can change the exact iteration, but it does not make the matrix conditioning worse.</div><div><br></div><div>   Matt</div><div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">


<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">
</div><div class="gmail_quote">Anyway please provide me with some pointers so that I can start trying with petscsection on top of a dmda, in the beginning for non-staggered case.<br><br></div><div class="gmail_quote">Thanks,<br>



Bishesh<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">



<div><br></div><div>  Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr"><div></div>Thanks,<br>Bishesh<span><font color="#888888"><br></font></span></div><span><font color="#888888">
</font></span></blockquote></div><span><font color="#888888"><br><br clear="all"><span><font color="#888888"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>




-- Norbert Wiener
</font></span></font></span></div></div>
</blockquote></div><br></div></div>
</blockquote></div></div><div><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>


-- Norbert Wiener
</div></div></div>
</blockquote></div></div><br></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener
</div></div>