<div class="gmail_quote">On Sun, Oct 9, 2011 at 05:23, Aron Ahmadia <span dir="ltr"><<a href="mailto:aron.ahmadia@kaust.edu.sa">aron.ahmadia@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">Jed pointed out that I should be demo-ing ex50, not ex19, so I tried to port my stuff over.  Oddly enough, if I am using 2^n grid spacing, everything falls over. 2^n+1 works, though, which seems non-obvious to me.<div>

<br></div><div><div>--- petsc-ex50/ex50 ‹master*➔ M⁇› » mpirun -n 4 ./ex50 -da_grid_x 65 -da_grid_y 65 -pc_type mg -pc_mg_levels 3</div><div>lid velocity = 0.000236686, prandtl # = 1, grashof # = 1</div><div>Number of Newton iterations = 6</div>

<div><div><br></div><div>./ex50 -da_grid_x 64 -da_grid_y 64 -pc_type mg -pc_mg_levels 2</div><div><br></div><div><div>lid velocity = 0.000244141, prandtl # = 1, grashof # = 1</div><div>[0]PETSC ERROR: --------------------- Error Message ------------------------------------</div>

<div>[0]PETSC ERROR: Arguments are incompatible!</div><div>[0]PETSC ERROR: Ratio between levels: (mx - 1)/(Mx - 1) must be integer: mx 64 Mx 32!</div></div></div></div></div></blockquote><div><br></div><div>DMMG always started with a coarse problem and refined a given number of times regardless of whether linear or nonlinear multigrid is being used.</div>
<div><br></div><div>Now we have</div><div><br></div><div>-snes_grid_sequence NLEVELS</div><div><br></div><div>which starts with whatever grid you give it and refines. If you use -snes_grid_sequence N -pc_type mg, then the number of levels in PCMG will be automatically changed inside the grid sequencing so that it references the same coarse level.</div>
<div><br></div><div>If instead, you only do linear multigrid, then you pass</div><div><br></div><div>-pc_type mg -pc_mg_levels N</div><div><br></div><div>and your specified problem is _coarsened_ to produce the number of levels. That coarsening requires some divisbility in the grid size. The reason it is 2^n+1 instead of 2^n is because this example uses a vertex-centered instead cell-centered discretization. This is natural for finite differences instead of finite volumes, but either method could be used with either centering strategy.</div>
</div>