[petsc-users] DMDA objects while distributing 3d arrays

Manuel Valera mvalera at mail.sdsu.edu
Thu Jan 19 18:56:30 CST 2017


I've read some more and from the ex13f90aux from the dm examples, it seems
is very similar what im looking for, it says:

  !
  ! The following 4 subroutines handle the mapping of coordinates. I'll
explain
  ! this in detail:
  !    PETSc gives you local arrays which are indexed using the global
indices.
  ! This is probably handy in some cases, but when you are re-writing an
  ! existing serial code and want to use DMDAs, you have tons of loops going
  ! from 1 to imax etc. that you don't want to change.
  !    These subroutines re-map the arrays so that all the local arrays go
from
  ! 1 to the (local) imax.
  !

Could someone explain a little bit more about these functions?
petsc_to_local(), local_to_petsc(), and specially why are used
transform_petsc_us() and transform_us_petsc() ?

Thanks,

Manuel

On Thu, Jan 19, 2017 at 2:01 PM, Manuel Valera <mvalera at mail.sdsu.edu>
wrote:

> Hello all,
>
> I'm currently pushing forward on the parallelization of my model, next
> step would be to parallelize all the grids (pressure, temperature,
> velocities, and such), and they are stored as 3d arrays in fortran.
>
> I'm following ex11f90.f and is a good start, i have a couple questions
> from it:
>
>    1. in the example a dummy vector g is made and the array values are
>    loaded into it, the dimensions of this vector are variable? the same dummy
>    vector is used for 1d,2d,3d so i guess it is. i was planning to use matrix
>    objects for 3d arrays but i guess a vector of this kind would be better
>    suited?
>    2. I notice also that a stride is used from the corners of the DMDA,
>    im looking for a way to operate over the global indices of the array
>    instead, can this be done? any good example to follow on this? this would
>    save us lots of effort if we can just extend the actual operations from
>    global indices into the DMDA objects.
>    3. next, im concerned about the degrees of freedom, how can i know how
>    many dof my model has? we are following an arakawa c-type grid. Same for
>    the type of stencil which i guess is star type in my case, we use a 9 point
>    stencil.
>
>
> that is it for now, thanks for your time,
>
> Manuel Valera
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170119/93a2f5ba/attachment.html>


More information about the petsc-users mailing list