[petsc-users] DMDACoor2d and DMDACoor3d in Fortran
Danyang Su
danyang.su at gmail.com
Fri Apr 25 11:41:40 CDT 2014
Hi All,
I tried to set the simulation domain using DMDA coordinates, following
the example dm/examples/tutorials/ex3.c. The 1D problem worked fine but
the 2D and 3D failed because of the definition in coors2d and coords3d.
What should I use to define the variable coords2d and coords3d?
-->Codes section:
PetscScalar, pointer :: coords1d(:)
DMDACoor2d, pointer :: coords2d(:,:) !Failed in compiling
DMDACoor3d, pointer :: coords3d(:,:,:) !Failed in compiling
Vec :: gc
!1D domain
call DMGetGlobalVector(dmda_flow%da,gc,ierr)
call DMDAVecGetArrayF90(dmda_flow%da,gc,coords1d,ierr)
do ivx = nvxls,nvxle
coords1d(ivx-ibase) = xglat(ivx)
end do
call DMDAVecRestoreArrayF90(dmda_flow%da,gc,coords1d,ierr)
call DMSetCoordinates(dmda_flow%da,gc,ierr)
call DMRestoreGlobalVector(dmda_flow%da,gc,ierr)
!2D domain
call DMGetGlobalVector(dmda_flow%da,gc,ierr)
call DMDAVecGetArrayF90(dmda_flow%da,gc,coords2d,ierr)
do ivx = nvxls,nvxle
coords2d(ivx-ibase,ivy-ibase)%x = xglat(ivx)
coords2d(ivx-ibase,ivy-ibase)%y = yglat(ivy)
end do
call DMDAVecRestoreArrayF90(dmda_flow%da,gc,coords2d,ierr)
call DMSetCoordinates(dmda_flow%da,gc,ierr)
call DMRestoreGlobalVector(dmda_flow%da,gc,ierr)
Thanks and regards,
Danyang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140425/92d5b939/attachment.html>
More information about the petsc-users
mailing list