Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix box2001 forcing, restart fields on land, bathymetry default value, omp_suite #65

Merged
merged 6 commits into from
Mar 10, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 39 additions & 17 deletions cicecore/cicedynB/general/ice_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ subroutine get_forcing_atmo
!$OMP PARALLEL DO PRIVATE(iblk,ilo,ihi,jlo,jhi,this_block)
do iblk = 1, nblocks

this_block = get_block(blocks_ice(iblk),iblk)
this_block = get_block(blocks_ice(iblk),iblk)
ilo = this_block%ilo
ihi = this_block%ihi
jlo = this_block%jlo
Expand Down Expand Up @@ -2438,7 +2438,7 @@ subroutine LY_data
enddo

! AOMIP
this_block = get_block(blocks_ice(iblk),iblk)
this_block = get_block(blocks_ice(iblk),iblk)
ilo = this_block%ilo
ihi = this_block%ihi
jlo = this_block%jlo
Expand Down Expand Up @@ -3480,7 +3480,7 @@ subroutine monthly_data
enddo

! AOMIP
this_block = get_block(blocks_ice(iblk),iblk)
this_block = get_block(blocks_ice(iblk),iblk)
ilo = this_block%ilo
ihi = this_block%ihi
jlo = this_block%jlo
Expand Down Expand Up @@ -5313,10 +5313,10 @@ subroutine box2001_data_atm
! these are defined at the u point
! authors: Elizabeth Hunke, LANL

use ice_domain, only: nblocks
use ice_domain, only: nblocks, blocks_ice
use ice_domain_size, only: max_blocks
use ice_calendar, only: timesecs
use ice_blocks, only: nx_block, ny_block, nghost
use ice_blocks, only: block, get_block, nx_block, ny_block, nghost
use ice_flux, only: uatm, vatm, wind, rhoa, strax, stray
use ice_state, only: aice

Expand All @@ -5325,8 +5325,15 @@ subroutine box2001_data_atm
integer (kind=int_kind) :: &
iblk, i,j ! loop indices

integer (kind=int_kind) :: &
iglob(nx_block), & ! global indices
jglob(ny_block) ! global indices

type (block) :: &
this_block ! block information for current block

real (kind=dbl_kind) :: &
secday, pi , puny, period, pi2, tau
secday, pi , puny, period, pi2, tau

character(len=*), parameter :: subname = '(box2001_data_atm)'

Expand All @@ -5341,6 +5348,10 @@ subroutine box2001_data_atm
do j = 1, ny_block
do i = 1, nx_block

this_block = get_block(blocks_ice(iblk),iblk)
iglob = this_block%i_glob
jglob = this_block%j_glob

!tcraig, move to box2001_data_ocn
! ! ocean current
! ! constant in time, could be initialized in ice_flux.F90
Expand All @@ -5354,14 +5365,14 @@ subroutine box2001_data_atm

! wind components
uatm(i,j,iblk) = c5 + (sin(pi2*timesecs/period)-c3) &
* sin(pi2*real(i-nghost, kind=dbl_kind) &
* sin(pi2*real(iglob(i), kind=dbl_kind) &
/real(nx_global,kind=dbl_kind)) &
* sin(pi *real(j-nghost, kind=dbl_kind) &
* sin(pi *real(jglob(j), kind=dbl_kind) &
/real(ny_global,kind=dbl_kind))
vatm(i,j,iblk) = c5 + (sin(pi2*timesecs/period)-c3) &
* sin(pi *real(i-nghost, kind=dbl_kind) &
* sin(pi *real(iglob(i), kind=dbl_kind) &
/real(nx_global,kind=dbl_kind)) &
* sin(pi2*real(j-nghost, kind=dbl_kind) &
* sin(pi2*real(jglob(j), kind=dbl_kind) &
/real(ny_global,kind=dbl_kind))
! wind stress
wind(i,j,iblk) = sqrt(uatm(i,j,iblk)**2 + vatm(i,j,iblk)**2)
Expand Down Expand Up @@ -5408,10 +5419,10 @@ subroutine box2001_data_ocn
! these are defined at the u point
! authors: Elizabeth Hunke, LANL

use ice_domain, only: nblocks
use ice_domain, only: nblocks, blocks_ice
use ice_domain_size, only: max_blocks
use ice_calendar, only: timesecs
use ice_blocks, only: nx_block, ny_block, nghost
use ice_blocks, only: block, get_block, nx_block, ny_block, nghost
use ice_flux, only: uocn, vocn
use ice_grid, only: uvm

Expand All @@ -5420,8 +5431,15 @@ subroutine box2001_data_ocn
integer (kind=int_kind) :: &
iblk, i,j ! loop indices

integer (kind=int_kind) :: &
iglob(nx_block), & ! global indices
jglob(ny_block) ! global indices

type (block) :: &
this_block ! block information for current block

real (kind=dbl_kind) :: &
secday, pi , puny, period, pi2, tau
secday, pi , puny, period, pi2, tau

character(len=*), parameter :: subname = '(box2001_data_ocn)'

Expand All @@ -5431,12 +5449,16 @@ subroutine box2001_data_ocn
do j = 1, ny_block
do i = 1, nx_block

this_block = get_block(blocks_ice(iblk),iblk)
iglob = this_block%i_glob
jglob = this_block%j_glob

! ocean current
! constant in time, could be initialized in ice_flux.F90
uocn(i,j,iblk) = p2*real(j-nghost, kind=dbl_kind) &
/ real(nx_global,kind=dbl_kind) - p1
vocn(i,j,iblk) = -p2*real(i-nghost, kind=dbl_kind) &
/ real(ny_global,kind=dbl_kind) + p1
uocn(i,j,iblk) = p2*real(jglob(j), kind=dbl_kind) &
/ real(ny_global,kind=dbl_kind) - p1
vocn(i,j,iblk) = -p2*real(iglob(i), kind=dbl_kind) &
/ real(nx_global,kind=dbl_kind) + p1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is BFB on square domains -- but definitely fixing a bug in the denominators, thanks for catching it.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I also noticed the bug in the forcing, not just when I was reviewing the paper. So it wasn't working on multiple blocks and the forcing was incorrect.


uocn(i,j,iblk) = uocn(i,j,iblk) * uvm(i,j,iblk)
vocn(i,j,iblk) = vocn(i,j,iblk) * uvm(i,j,iblk)
Expand Down
1 change: 1 addition & 0 deletions cicecore/cicedynB/infrastructure/ice_grid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -4228,6 +4228,7 @@ subroutine get_bathymetry
depth(k) = depth(k-1) + thick(k)
enddo

bathymetry = 0._dbl_kind
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use c0 here?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brain freeze, I'll fix it.

do iblk = 1, nblocks
do j = 1, ny_block
do i = 1, nx_block
Expand Down
16 changes: 15 additions & 1 deletion cicecore/cicedynB/infrastructure/ice_restart_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ subroutine dumpfile(filename_spec)
stresspT, stressmT, stress12T, &
stresspU, stressmU, stress12U
use ice_flux, only: coszen
use ice_grid, only: grid_ice
use ice_grid, only: grid_ice, tmask
use ice_state, only: aicen, vicen, vsnon, trcrn, uvel, vvel, &
uvelE, vvelE, uvelN, vvelN

Expand Down Expand Up @@ -97,6 +97,20 @@ subroutine dumpfile(filename_spec)

diag = .true.

!-----------------------------------------------------------------
! Zero out tracers over land
!-----------------------------------------------------------------

!$OMP PARALLEL DO PRIVATE(iblk,i,j)
do iblk = 1, nblocks
do j = 1, ny_block
do i = 1, nx_block
if (.not. tmask(i,j,iblk)) trcrn(i,j,:,:,iblk) = c0
enddo
enddo
enddo
!$OMP END PARALLEL DO

!-----------------------------------------------------------------
! state variables
! Tsfc is the only tracer written to binary files. All other
Expand Down
38 changes: 37 additions & 1 deletion cicecore/shared/ice_restart_column.F90
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,7 @@ subroutine write_restart_hbrine()
use ice_blocks, only: block, get_block
use ice_domain, only: nblocks, blocks_ice
use ice_fileunits, only: nu_dump_hbrine
use ice_grid, only: tmask
use ice_state, only: trcrn
use ice_restart,only: write_restart_field

Expand Down Expand Up @@ -949,7 +950,8 @@ subroutine write_restart_hbrine()
do j = jlo, jhi
do i = ilo, ihi
do n = 1, ncat
if (first_ice (i,j,n,iblk)) then
! zero out first_ice over land
if (tmask(i,j,iblk) .and. first_ice (i,j,n,iblk)) then
first_ice_real(i,j,n,iblk) = c1
else
first_ice_real(i,j,n,iblk) = c0
Expand Down Expand Up @@ -983,6 +985,7 @@ subroutine write_restart_bgc()
use ice_fileunits, only: nu_dump_bgc
use ice_flux_bgc, only: nit, amm, sil, dmsp, dms, algalN, &
doc, don, dic, fed, fep, zaeros, hum
use ice_grid, only: tmask
use ice_state, only: trcrn
use ice_flux, only: sss
use ice_restart, only: write_restart_field
Expand Down Expand Up @@ -1058,6 +1061,39 @@ subroutine write_restart_bgc()

diag = .true.

!-----------------------------------------------------------------
! Zero out tracers over land
!-----------------------------------------------------------------

!$OMP PARALLEL DO PRIVATE(iblk,i,j)
do iblk = 1, nblocks
this_block = get_block(blocks_ice(iblk),iblk)
ilo = this_block%ilo
ihi = this_block%ihi
jlo = this_block%jlo
jhi = this_block%jhi
do j = jlo, jhi
do i = ilo, ihi
if (.not. tmask(i,j,iblk)) then
if (tr_bgc_N ) algalN(i,j,:,iblk) = c0
if (tr_bgc_C ) doc (i,j,:,iblk) = c0
if (tr_bgc_C ) dic (i,j,:,iblk) = c0
if (tr_bgc_Nit) nit (i,j ,iblk) = c0
if (tr_bgc_Am ) amm (i,j ,iblk) = c0
if (tr_bgc_Sil) sil (i,j ,iblk) = c0
if (tr_bgc_hum) hum (i,j ,iblk) = c0
if (tr_bgc_DMS) dms (i,j ,iblk) = c0
if (tr_bgc_DMS) dmsp (i,j ,iblk) = c0
if (tr_bgc_DON) don (i,j,:,iblk) = c0
if (tr_bgc_Fe ) fed (i,j,:,iblk) = c0
if (tr_bgc_Fe ) fep (i,j,:,iblk) = c0
if (solve_zsal) sss (i,j ,iblk) = c0
endif
enddo
enddo
enddo
!$OMP END PARALLEL DO

!-----------------------------------------------------------------
! Salinity and extras
!-----------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions configuration/scripts/tests/comparelog.csh
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ if (${filearg} == 1) then
touch ${test_out}

if (${cicefile} == 1) then
cat ${base_data} | grep -A 99999999 "total ice area (km^2)" | grep -e istep1: -e = | grep -iv "min, max, sum" >&! ${base_out}
cat ${test_data} | grep -A 99999999 "total ice area (km^2)" | grep -e istep1: -e = | grep -iv "min, max, sum" >&! ${test_out}
cat ${base_data} | grep -A 99999999 "total ice area (km^2)" | grep -e istep1: -e = | grep -iv "min, max, sum" | grep -iv "init_vert" | grep -iv "ridge_ice" >&! ${base_out}
cat ${test_data} | grep -A 99999999 "total ice area (km^2)" | grep -e istep1: -e = | grep -iv "min, max, sum" | grep -iv "init_vert" | grep -iv "ridge_ice" >&! ${test_out}
else
sed -n '/RunningUnitTest/,$p' ${base_data} >! ${base_out}
sed -n '/RunningUnitTest/,$p' ${test_data} >! ${test_out}
Expand Down
Loading