Hi Wee-Beng,<div>See the reply below,<br><br><div class="gmail_quote">On Wed, Dec 16, 2009 at 3:07 AM, Wee-Beng Tay <span dir="ltr"><<a href="mailto:zonexo@gmail.com">zonexo@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi Ryan,<br><br>Thanks alot.<br><br>There's still some parts I don't understand. It'll be great if someone can help:<br><br>In ex22f.f90, there's a :<br><br>MatStencil row(4),col(4,7)<br><br></blockquote>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I understand that the 7 is due to the 7-pt stencil. However, why is there a "4"? </blockquote><div><br></div>
<div></div><div><span class="Apple-style-span" style="font-family: Simsun; font-size: 16px; "><pre><span class="Apple-style-span" style="font-family: Simsun; white-space: normal; ">You may want to check example 28.c, on line 107, to see why there is a 4. From my understanding, row() is an indicator of the global location of the current grid point that you are looking at. I think the 4th entry of row() is reserved for time dependent problem. </span></pre>
</span></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">In that eg., coarsest grid has dimension 3 with 3 lvl. it seems that in eg. ex29.c, it is only given as "row", not array<br>
</blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">As for Neumann B.C.s, it's mentioned there's null space of the coefficient matrix A. looking at ex29,<br>
<br><pre width="80"><font color="#4169e1">if</font> (user->bcType == NEUMANN) {<br><a name="12596893f0218676_line129"></a><a href="http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-3.0.0/docs/manualpages/Mat/MatNullSpace.html#MatNullSpace" target="_blank">MatNullSpace</a> nullspace;<br>
<br><a name="12596893f0218676_line131"></a><a href="http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-3.0.0/docs/manualpages/KSP/KSPGetNullSpace.html#KSPGetNullSpace" target="_blank">KSPGetNullSpace</a>(dmmg->ksp,&nullspace);<br>
<a name="12596893f0218676_line132"></a><a href="http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-3.0.0/docs/manualpages/Mat/MatNullSpaceRemove.html#MatNullSpaceRemove" target="_blank">MatNullSpaceRemove</a>(nullspace,b,<a href="http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-3.0.0/docs/manualpages/Sys/PETSC_NULL.html#PETSC_NULL" target="_blank">PETSC_NULL</a>);<br>
<a name="12596893f0218676_line133"></a>}<br></pre>I don't really understand what it is trying to do. My BC has du/dx=0 and du/dy = 0 and I believe it's the same as that of ex29.c<br><br>if I do it in Fortran, is it the same?<br>
<br>
Thanks again!<div><div></div><div class="h5"><br><br><br><br><div class="gmail_quote">On Sat, Dec 12, 2009 at 12:25 AM, Ryan Yan <span dir="ltr"><<a href="mailto:vyan2000@gmail.com" target="_blank">vyan2000@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
<br><br><div class="gmail_quote"><div>On Fri, Dec 11, 2009 at 1:44 AM, Wee-Beng Tay <span dir="ltr"><<a href="mailto:zonexo@gmail.com" target="_blank">zonexo@gmail.com</a>></span> wrote:<br></div><div>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
Hi,<br><br>I'm also looking at the fortran version of ex22. I have some questions:<br><br>1. M,N,P are global dimension in each direction of the array. I'm abit confused. Do you mean the no. of grid pts at the coarse level? Hence, if my problem has 27x27 grid pts, do I use M=N=9 with 3 multigrid levels or M=N=3 with 9 lvls? What is the guideline in choosing the number of multigrid levels?<br>
<br>2. What is stencil width (s)? Seems to be 1 in both ex22 and ex29.<br><br>3. What are arrays containing the number of nodes in each cell along
the x/y/z coordinates? Is it ok to just use the default PETSC_NULL_INTEGER?<br><br>4. There's a subroutine ComputeJacobian which computes the jacobian. However, what is it actually calculating? Is it simply calculating the coefficient arising from the discretization of the matrix?<br>
<br></blockquote></div><div><br>I just realized that you are looking at Fortran version ex22f.F for this question. <br>In fact, my answer still applies. <br>You may want to make a comparison between:<br><a href="http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/DMMG/DMMGSetSNES.html" target="_blank">http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/DMMG/DMMGSetSNES.html</a><br>
<a href="http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/DMMG/DMMGSetKSP.html" target="_blank">http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/DMMG/DMMGSetKSP.html</a><br>
<br>
</div><div><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">5. My objective is to solve for the poisson equation arising from the Navier Stokes equations. ie div grad P = F, which F can be calculated separately. The boundary conditions are Neumann which is dp/dx, dp/dy=0. Is this a good example to follow? Or is ex29 a better example, although I need time to digest the C syntax.<br>
<br>thanks alot!<div><div></div><div><br><br><div class="gmail_quote">On Fri, Dec 11, 2009 at 4:14 AM, Ryan Yan <span dir="ltr"><<a href="mailto:vyan2000@gmail.com" target="_blank">vyan2000@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
Hi Barry, <br>Thank you very much for the confirm.<br><font color="#888888"><br>Yan</font><div><div></div><div><br><br><div class="gmail_quote">On Thu, Dec 10, 2009 at 3:12 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex"><div><div></div><div><br>
On Dec 10, 2009, at 2:09 PM, Ryan Yan wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
Hi all,<br>
I was looking at the ex22 of ksp.<br>
<br>
If I call:<br>
...<br>
ierr = DMMGCreate(PETSC_COMM_WORLD,3,PETSC_NULL,&dmmg);CHKERRQ(ierr);<br>
ierr = DACreate3d(PETSC_COMM_WORLD,DA_NONPERIODIC,DA_STENCIL_STAR,-3,-3,-3,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,0,&da);CHKERRQ(ierr);<br>
...<br>
<br>
How many grid pts should I have on the finest level? Is it 27, considering I am set 3 as the global dimension in each direction of the array?<br>
<br>
When I run ex22 with -ksp_view, I saw that on the finest level there are 9 pts on each direction.<br>
<br>
Is that because I have 3 level?<br>
</blockquote>
<br></div></div>
Yes. The DA you create initially is for the coarsest grid, finer ones are automatically created by the DMMG.<br>
<br>
Barry<br>
<br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
<br>
Yan<br>
<br>
</blockquote>
<br>
</blockquote></div><br>
</div></div></blockquote></div><br>
</div></div></blockquote></div></div><br>
</blockquote></div><br>
</div></div></blockquote></div><br></div>