Skip to content

Commit

Permalink
fix calculation of dof3d for large meshes
Browse files Browse the repository at this point in the history
  • Loading branch information
DeniseWorthen committed Oct 10, 2024
1 parent cc7e41c commit bd26c2a
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions model/src/wav_pio_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,8 @@ subroutine wav_pio_initdecomp_2d(iodesc, use_int)
! local variables
integer :: n, isea, jsea, ix, iy, nseal_cpl
logical :: luse_int
integer(kind=8), allocatable :: dof2d(:)
integer(kind=PIO_OFFSET_KIND) :: lnx,lny
integer(kind=PIO_OFFSET_KIND), allocatable :: dof2d(:)
#ifdef W3_PDLIB
nseal_cpl = nseal - ng
#else
Expand All @@ -324,13 +325,16 @@ subroutine wav_pio_initdecomp_2d(iodesc, use_int)

allocate(dof2d(nseal_cpl))
dof2d = 0
lnx = int(nx,PIO_OFFSET_KIND)
lny = int(ny,PIO_OFFSET_KIND)

n = 0
do jsea = 1,nseal_cpl
call init_get_isea(isea, jsea)
ix = mapsf(isea,1) ! global ix
iy = mapsf(isea,2) ! global iy
n = n+1
dof2d(n) = (iy-1)*nx + ix ! local index : global index
dof2d(n) = (iy-1)*lnx + ix ! local index : global index
end do

if (luse_int) then
Expand All @@ -357,7 +361,8 @@ subroutine wav_pio_initdecomp_3d(nz, iodesc)

! local variables
integer :: n, k, isea, jsea, ix, iy, nseal_cpl
integer(kind=8), allocatable :: dof3d(:)
integer(kind=PIO_OFFSET_KIND) :: lnx,lny
integer(kind=PIO_OFFSET_KIND), allocatable :: dof3d(:)
#ifdef W3_PDLIB
nseal_cpl = nseal - ng
#else
Expand All @@ -366,14 +371,17 @@ subroutine wav_pio_initdecomp_3d(nz, iodesc)
allocate(dof3d(nz*nseal_cpl))

dof3d = 0
lnx = int(nx,PIO_OFFSET_KIND)
lny = int(ny,PIO_OFFSET_KIND)

n = 0
do k = 1,nz
do jsea = 1,nseal_cpl
call init_get_isea(isea, jsea)
ix = mapsf(isea,1) ! global ix
iy = mapsf(isea,2) ! global iy
ix = mapsf(isea,1) ! global ix
iy = mapsf(isea,2) ! global iy
n = n+1
dof3d(n) = ((iy-1)*nx + ix) + (k-1)*nx*ny ! local index : global index
dof3d(n) = ((iy-1)*lnx + ix) + (k-1)*lnx*lny ! local index : global index
end do
end do

Expand Down

0 comments on commit bd26c2a

Please sign in to comment.