Hi Barry,
Another question is about DMDAGetLocalBoundingBox in fortran.
PetscErrorCode DMDAGetLocalBoundingBox(DM da,PetscReal lmin[],PetscReal
lmax[])
The first value of lmin and lmax (lmin(0)) are always zero, and
lmin(1), lmin(2), and lmin(3) are for x, y, and z dimension,
respectively. And the returned value is index (local node index in x,
y, z dim), not the coordinate. Correct?
Thanks and regards,
Danyang
On 25/04/2014 10:06 AM, Barry Smith wrote:
On Apr 25, 2014, at 11:41 AM, Danyang Su <[email protected]> wrote:
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?
Failed in compiling is not very useful. Much better to send the ENTIRE
compiler error message.
There is no DMDACoor2d or 3d in Fortran. You should use
PetscScalar, pointer :: coords2d(:,:,:)
note there is three indices, the first index is 0 or 1 for the x or y coordinate
Similar for 3d.
Satish,
Please see about adding a DMDACoor2d and 3d for Fortran.
Request-assigned: Satish, add a DMDACoor2d and 3d for Fortran.
Barry
-->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