[petsc-users] local row calculation in 3D

Matthew Knepley knepley at gmail.com
Mon Apr 18 08:40:17 CDT 2011


On Mon, Apr 18, 2011 at 8:34 AM, ilyas ilyas <ilyascfd at gmail.com> wrote:

> Hi,
>
> In ex14f.F in KSP, "row" variable is calculated either
>

These are very old. I suggest you use the FormFunctionLocal() approach in
ex5f.F which
does not calculate global row numbers when using a DA.

   Matt


> 349: do 30 j=ys,ys+ym-1
> 350: ...
> 351: do 40 i=xs,xs+xm-1
> 352:          row = i - gxs + (j - gys)*gxm + 1
>
> or
>
> 442: do 50 j=ys,ys+ym-1
> 443: ...
> 444: row = (j - gys)*gxm + xs - gxs
> 445: do 60 i=xs,xs+xm-1
> 446:          row = row + 1
>
> How can I calculate "row" in 3D ?
>
> I tried this;
>
> do k=zs,zs+zm-1
>    do j=ys,ys+ym-1
>       do i=xs,xs+xm-1
>
>            row = i - gxs + (j - gys)*gxm + (k - gzs)*gxm*gym + 1
>
> It does not work for certain number of processors.
>
>
> Thanks,
>
> Ilyas
>



-- 
What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110418/61b4daa9/attachment.htm>


More information about the petsc-users mailing list