Skip to content

Commit

Permalink
Fix some initialization of CD variables. (CICE-Consortium#27)
Browse files Browse the repository at this point in the history
* Fix some variables initialization on CD variables.

* Combine iblk loops

* Fix some arrangement and alignment

* Need to add grid_system

* add wtmp to OMP PRIVATE
  • Loading branch information
dabail10 authored Nov 19, 2021
1 parent 028037d commit f91adf0
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 29 deletions.
14 changes: 1 addition & 13 deletions cicecore/cicedynB/dynamics/ice_dyn_evp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ subroutine evp (dt)
call grid_average_X2Y('T2EF',tmass,emass)
call grid_average_X2Y('T2EF',aice_init, aie)
call grid_average_X2Y('T2NF',tmass,nmass)
call grid_average_X2Y('T2NF',aice_init, aie)
call grid_average_X2Y('T2NF',aice_init, ain)
endif
!----------------------------------------------------------------
! Set wind stress to values supplied via NEMO or other forcing
Expand Down Expand Up @@ -420,22 +420,10 @@ subroutine evp (dt)
uvelN (:,:,iblk), vvelN (:,:,iblk), &
TbN (:,:,iblk))

enddo ! iblk
!$TCXOMP END PARALLEL DO

!$TCXOMP PARALLEL DO PRIVATE(iblk,ilo,ihi,jlo,jhi,this_block)
do iblk = 1, nblocks

!-----------------------------------------------------------------
! more preparation for dynamics on E grid
!-----------------------------------------------------------------

this_block = get_block(blocks_ice(iblk),iblk)
ilo = this_block%ilo
ihi = this_block%ihi
jlo = this_block%jlo
jhi = this_block%jhi

call dyn_prep2 (nx_block, ny_block, &
ilo, ihi, jlo, jhi, &
icellt(iblk), icelle(iblk), &
Expand Down
27 changes: 19 additions & 8 deletions cicecore/cicedynB/general/ice_flux.F90
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ subroutine init_coupler_flux
use ice_flux_bgc, only: flux_bio_atm, flux_bio, faero_atm, fiso_atm, &
fnit, famm, fsil, fdmsp, fdms, fhum, fdust, falgalN, &
fdoc, fdon, fdic, ffed, ffep
use ice_grid, only: bathymetry
use ice_grid, only: bathymetry, grid_system

integer (kind=int_kind) :: n

Expand Down Expand Up @@ -738,13 +738,24 @@ subroutine init_coupler_flux
! fluxes received from ocean
!-----------------------------------------------------------------

ss_tltx(:,:,:)= c0 ! sea surface tilt (m/m)
ss_tlty(:,:,:)= c0
uocn (:,:,:) = c0 ! surface ocean currents (m/s)
vocn (:,:,:) = c0
frzmlt(:,:,:) = c0 ! freezing/melting potential (W/m^2)
frzmlt_init(:,:,:) = c0 ! freezing/melting potential (W/m^2)
sss (:,:,:) = 34.0_dbl_kind ! sea surface salinity (ppt)
ss_tltx (:,:,:) = c0 ! sea surface tilt (m/m)
ss_tlty (:,:,:) = c0
uocn (:,:,:) = c0 ! surface ocean currents (m/s)
vocn (:,:,:) = c0
frzmlt (:,:,:) = c0 ! freezing/melting potential (W/m^2)
frzmlt_init(:,:,:) = c0 ! freezing/melting potential (W/m^2)
sss (:,:,:) = 34.0_dbl_kind ! sea surface salinity (ppt)

if (grid_system == 'CD') then
ss_tltxN(:,:,:) = c0 ! sea surface tilt (m/m)
ss_tltyN(:,:,:) = c0
ss_tltxE(:,:,:) = c0 ! sea surface tilt (m/m)
ss_tltyE(:,:,:) = c0
uocnN (:,:,:) = c0 ! surface ocean currents (m/s)
vocnN (:,:,:) = c0
uocnE (:,:,:) = c0 ! surface ocean currents (m/s)
vocnE (:,:,:) = c0
endif

do iblk = 1, size(Tf,3)
do j = 1, size(Tf,2)
Expand Down
16 changes: 8 additions & 8 deletions cicecore/cicedynB/infrastructure/ice_grid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2441,7 +2441,7 @@ subroutine grid_average_X2YS(dir,work1,area1,mask1,work2)
select case (trim(dir))

case('NE')
!$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block)
!$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block,wtmp)
do iblk = 1, nblocks
this_block = get_block(blocks_ice(iblk),iblk)
ilo = this_block%ilo
Expand All @@ -2466,7 +2466,7 @@ subroutine grid_average_X2YS(dir,work1,area1,mask1,work2)
!$OMP END PARALLEL DO

case('SW')
!$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block)
!$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block,wtmp)
do iblk = 1, nblocks
this_block = get_block(blocks_ice(iblk),iblk)
ilo = this_block%ilo
Expand All @@ -2491,7 +2491,7 @@ subroutine grid_average_X2YS(dir,work1,area1,mask1,work2)
!$OMP END PARALLEL DO

case('NW')
!$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block)
!$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block,wtmp)
do iblk = 1, nblocks
this_block = get_block(blocks_ice(iblk),iblk)
ilo = this_block%ilo
Expand All @@ -2516,7 +2516,7 @@ subroutine grid_average_X2YS(dir,work1,area1,mask1,work2)
!$OMP END PARALLEL DO

case('SE')
!$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block)
!$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block,wtmp)
do iblk = 1, nblocks
this_block = get_block(blocks_ice(iblk),iblk)
ilo = this_block%ilo
Expand All @@ -2541,7 +2541,7 @@ subroutine grid_average_X2YS(dir,work1,area1,mask1,work2)
!$OMP END PARALLEL DO

case('E')
!$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block)
!$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block,wtmp)
do iblk = 1, nblocks
this_block = get_block(blocks_ice(iblk),iblk)
ilo = this_block%ilo
Expand All @@ -2562,7 +2562,7 @@ subroutine grid_average_X2YS(dir,work1,area1,mask1,work2)
!$OMP END PARALLEL DO

case('W')
!$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block)
!$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block,wtmp)
do iblk = 1, nblocks
this_block = get_block(blocks_ice(iblk),iblk)
ilo = this_block%ilo
Expand All @@ -2583,7 +2583,7 @@ subroutine grid_average_X2YS(dir,work1,area1,mask1,work2)
!$OMP END PARALLEL DO

case('N')
!$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block)
!$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block,wtmp)
do iblk = 1, nblocks
this_block = get_block(blocks_ice(iblk),iblk)
ilo = this_block%ilo
Expand All @@ -2604,7 +2604,7 @@ subroutine grid_average_X2YS(dir,work1,area1,mask1,work2)
!$OMP END PARALLEL DO

case('S')
!$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block)
!$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block,wtmp)
do iblk = 1, nblocks
this_block = get_block(blocks_ice(iblk),iblk)
ilo = this_block%ilo
Expand Down

0 comments on commit f91adf0

Please sign in to comment.