From cfca1a8b196b10c0e02dfb09284ed5551f2478a3 Mon Sep 17 00:00:00 2001 From: TRasmussen <33480590+TillRasmussen@users.noreply.github.com> Date: Wed, 26 Aug 2020 17:55:54 +0200 Subject: [PATCH] Moved calculation of sicen and trcrn_bgc to the loop where they are used. The current construction did not use the calculated values as they were defined private and overwritten at each i/j (#507) --- cicecore/shared/ice_init_column.F90 | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/cicecore/shared/ice_init_column.F90 b/cicecore/shared/ice_init_column.F90 index 0370a0d7e..b3937c0cd 100644 --- a/cicecore/shared/ice_init_column.F90 +++ b/cicecore/shared/ice_init_column.F90 @@ -877,7 +877,7 @@ subroutine init_bgc() endif ! .not. restart - !$OMP PARALLEL DO PRIVATE(iblk,i,j,k,n,ilo,ihi,jlo,jhi,this_block,sicen,trcrn_bgc) + !$OMP PARALLEL DO PRIVATE(iblk,i,j,n,ilo,ihi,jlo,jhi,this_block) do iblk = 1, nblocks this_block = get_block(blocks_ice(iblk),iblk) @@ -889,15 +889,6 @@ subroutine init_bgc() do j = jlo, jhi do i = ilo, ihi - do n = 1, ncat - do k = 1, nilyr - sicen(k,n) = trcrn(i,j,nt_sice+k-1,n,iblk) - enddo - do k = ntrcr_o+1, ntrcr - trcrn_bgc(k-ntrcr_o,n) = trcrn(i,j,k,n,iblk) - enddo - enddo - call icepack_load_ocean_bio_array(max_nbtrcr=icepack_max_nbtrcr, & max_algae=icepack_max_algae, max_don=icepack_max_don, & max_doc=icepack_max_doc, max_fe=icepack_max_fe, & @@ -919,7 +910,7 @@ subroutine init_bgc() file=__FILE__, line=__LINE__) if (.not. restart_bgc) then - !$OMP PARALLEL DO PRIVATE(iblk,i,j,n,ilo,ihi,jlo,jhi,this_block) + !$OMP PARALLEL DO PRIVATE(iblk,i,j,k,n,ilo,ihi,jlo,jhi,this_block,sicen,trcrn_bgc) do iblk = 1, nblocks this_block = get_block(blocks_ice(iblk),iblk) @@ -930,7 +921,14 @@ subroutine init_bgc() do j = jlo, jhi do i = ilo, ihi - + do n = 1, ncat + do k = 1, nilyr + sicen(k,n) = trcrn(i,j,nt_sice+k-1,n,iblk) + enddo + do k = ntrcr_o+1, ntrcr + trcrn_bgc(k-ntrcr_o,n) = trcrn(i,j,k,n,iblk) + enddo + enddo call icepack_init_bgc(ncat=ncat, nblyr=nblyr, nilyr=nilyr, ntrcr_o=ntrcr_o, & cgrid=cgrid, igrid=igrid, ntrcr=ntrcr, nbtrcr=nbtrcr, & sicen=sicen(:,:), trcrn=trcrn_bgc(:,:), sss=sss(i,j, iblk), &