From 532912be2b053b140c156edbdd3123b8c34fd5c1 Mon Sep 17 00:00:00 2001 From: ESCOBAR Juan <escj@nuwa> Date: Mon, 14 Mar 2022 19:36:42 +0100 Subject: [PATCH] Juan 14/03/2022:tensor/multigrid.f90, revert to allocate in place of zt1d_discretisation_allocate3d --- .../multigrid.f90 | 47 ++++++++----------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/ZSOLVER/tensorproductmultigrid_Source/multigrid.f90 b/src/ZSOLVER/tensorproductmultigrid_Source/multigrid.f90 index a4a066c22..0b2444808 100644 --- a/src/ZSOLVER/tensorproductmultigrid_Source/multigrid.f90 +++ b/src/ZSOLVER/tensorproductmultigrid_Source/multigrid.f90 @@ -172,8 +172,6 @@ contains real , dimension(:,:,:) , pointer , contiguous :: zxu_mg_st,zxb_mg_st,zxr_mg_st - integer :: iindex - if (i_am_master_mpi) & write(STDOUT,*) '*** Initialising multigrid ***' ! Check that cell counts are valid @@ -281,34 +279,22 @@ contains endif if (LUseT) then -!!$ allocate(zxu_mg_st(1-halo_size:nlocal+halo_size, & -!!$ 1-halo_size:nlocal+halo_size, & -!!$ 0:nz+1)) -!!$ !$acc enter data create (zxu_mg_st) - iindex = zt1d_discretisation_allocate3d(zxu_mg_st,& - 1-halo_size,nlocal+halo_size, & - 1-halo_size,nlocal+halo_size, & - 0,nz+1) + allocate(zxu_mg_st(1-halo_size:nlocal+halo_size, & + 1-halo_size:nlocal+halo_size, & + 0:nz+1)) + !$acc enter data create (zxu_mg_st) xu_mg(level,m)%st => zxu_mg_st -!!$ allocate(zxb_mg_st(1-halo_size:nlocal+halo_size, & -!!$ 1-halo_size:nlocal+halo_size, & -!!$ 0:nz+1)) -!!$ !$acc enter data create (zxb_mg_st) - iindex = zt1d_discretisation_allocate3d(zxb_mg_st,& - 1-halo_size,nlocal+halo_size, & - 1-halo_size,nlocal+halo_size, & - 0,nz+1) + allocate(zxb_mg_st(1-halo_size:nlocal+halo_size, & + 1-halo_size:nlocal+halo_size, & + 0:nz+1)) + !$acc enter data create (zxb_mg_st) xb_mg(level,m)%st => zxb_mg_st -!!$ allocate(zxr_mg_st(1-halo_size:nlocal+halo_size, & -!!$ 1-halo_size:nlocal+halo_size, & -!!$ 0:nz+1)) -!!$ !$acc enter data create (zxr_mg_st) - iindex = zt1d_discretisation_allocate3d(zxr_mg_st,& - 1-halo_size,nlocal+halo_size, & - 1-halo_size,nlocal+halo_size, & - 0,nz+1) + allocate(zxr_mg_st(1-halo_size:nlocal+halo_size, & + 1-halo_size:nlocal+halo_size, & + 0:nz+1)) + !$acc enter data create (zxr_mg_st) xr_mg(level,m)%st => zxr_mg_st !$acc kernels @@ -825,8 +811,13 @@ contains real , dimension(:,:,:) , pointer , contiguous :: zphifine_st , zphicoarse_st integer :: nz + integer :: ix_min, ix_max, iy_min, iy_max nz = phicoarse%grid_param%nz + ix_min = ixmin(iblock) + ix_max = ixmax(iblock) + iy_min = iymin(iblock) + iy_max = iymax(iblock) ! optimisation for newman MNH case : all coef constant rhox = 0.25_rl @@ -862,8 +853,8 @@ contains do iz=1,nz do diy = -1,0 do dix = -1,0 - do iy=iymin(iblock),iymax(iblock) - do ix=ixmin(iblock),ixmax(iblock) + do iy=iy_min,iy_max + do ix=ix_min,ix_max zphifine_st(2*ix+dix,2*iy+diy,iz) = & zphicoarse_st(ix,iy,iz) + & rhox*(zphicoarse_st(ix+(2*dix+1),iy,iz) & -- GitLab