Skip to content

Commit

Permalink
Add symmetry test and gridsys_suite (#11)
Browse files Browse the repository at this point in the history
* Add ice_data_type = uniform to set uniform initial conditions in ice_init.F90 set_state_var

* add uniform atm_data_type options

* add box sym tests, gridsys testsuites

Co-authored-by: daveh150 <[email protected]>
  • Loading branch information
apcraig and daveh150 authored Nov 16, 2021
1 parent e9aa132 commit 1b4c03e
Show file tree
Hide file tree
Showing 8 changed files with 308 additions and 35 deletions.
72 changes: 72 additions & 0 deletions cicecore/cicedynB/general/ice_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,12 @@ subroutine init_forcing_atmo
call ISPOL_files
elseif (trim(atm_data_type) == 'box2001') then
call box2001_data
elseif (trim(atm_data_type) == 'uniform_northeast') then
call uniform_data('NE')
elseif (trim(atm_data_type) == 'uniform_east') then
call uniform_data('E')
elseif (trim(atm_data_type) == 'uniform_north') then
call uniform_data('N')
elseif (trim(atm_data_type) == 'hycom') then
call hycom_atm_files
endif
Expand Down Expand Up @@ -626,6 +632,12 @@ subroutine get_forcing_atmo
call oned_data
elseif (trim(atm_data_type) == 'box2001') then
call box2001_data
elseif (trim(atm_data_type) == 'uniform_northeast') then
call uniform_data('NE')
elseif (trim(atm_data_type) == 'uniform_east') then
call uniform_data('E')
elseif (trim(atm_data_type) == 'uniform_north') then
call uniform_data('N')
elseif (trim(atm_data_type) == 'hycom') then
call hycom_atm_data
else ! default values set in init_flux
Expand Down Expand Up @@ -5343,6 +5355,66 @@ subroutine box2001_data

end subroutine box2001_data

!=======================================================================
!
subroutine uniform_data(dir)

! uniform wind fields in some direction

use ice_domain, only: nblocks
use ice_domain_size, only: max_blocks
use ice_blocks, only: nx_block, ny_block, nghost
use ice_flux, only: uocn, vocn, uatm, vatm, wind, rhoa, strax, stray
use ice_grid, only: uvm, grid_average_X2Y

character(len=*), intent(in) :: dir

! local parameters

integer (kind=int_kind) :: &
iblk, i,j ! loop indices

real (kind=dbl_kind) :: &
tau

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

if (local_debug .and. my_task == master_task) write(nu_diag,*) subname,'fdbg start'

! ocean currents
uocn = c0
vocn = c0
! wind components
if (dir == 'NE') then
uatm = c5
vatm = c5
elseif (dir == 'N') then
uatm = c0
vatm = c5
elseif (dir == 'E') then
uatm = c5
vatm = c0
else
call abort_ice (subname//'ERROR: dir unknown, dir = '//trim(dir), &
file=__FILE__, line=__LINE__)
endif

do iblk = 1, nblocks
do j = 1, ny_block
do i = 1, nx_block

! wind stress
wind(i,j,iblk) = sqrt(uatm(i,j,iblk)**2 + vatm(i,j,iblk)**2)
tau = rhoa(i,j,iblk) * 0.0012_dbl_kind * wind(i,j,iblk)
strax(i,j,iblk) = tau * uatm(i,j,iblk)
stray(i,j,iblk) = tau * vatm(i,j,iblk)

enddo
enddo
enddo ! nblocks

end subroutine uniform_data

!=======================================================================

subroutine get_wave_spec
Expand Down
89 changes: 54 additions & 35 deletions cicecore/cicedynB/general/ice_init.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2632,42 +2632,56 @@ subroutine set_state_var (nx_block, ny_block, &

endif ! ice_data_type

if (trim(grid_type) == 'rectangular') then

! place ice on left side of domain
icells = 0
do j = jlo, jhi
do i = ilo, ihi
if (tmask(i,j)) then
if (ULON(i,j) < -50./rad_to_deg) then
icells = icells + 1
indxi(icells) = i
indxj(icells) = j
endif ! ULON
endif ! tmask
enddo ! i
enddo ! j

else

! place ice at high latitudes where ocean sfc is cold
icells = 0
do j = jlo, jhi
do i = ilo, ihi
if (tmask(i,j)) then
! place ice in high latitudes where ocean sfc is cold
if ( (sst (i,j) <= Tf(i,j)+p2) .and. &
(TLAT(i,j) < edge_init_sh/rad_to_deg .or. &
TLAT(i,j) > edge_init_nh/rad_to_deg) ) then
if ((trim(ice_data_type) == 'box2001') .or. &
(trim(ice_data_type) == 'boxslotcyl')) then

! place ice on left side of domain
icells = 0
do j = jlo, jhi
do i = ilo, ihi
if (tmask(i,j)) then
if (ULON(i,j) < -50./rad_to_deg) then
icells = icells + 1
indxi(icells) = i
indxj(icells) = j
endif ! ULON
endif ! tmask
enddo ! i
enddo ! j

else if (trim(ice_data_type) == 'uniform') then
! all cells not land mask are ice
icells = 0
do j = jlo, jhi
do i = ilo, ihi
if (tmask(i,j)) then
icells = icells + 1
indxi(icells) = i
indxj(icells) = j
endif ! cold surface
endif ! tmask
enddo ! i
enddo ! j

endif ! rectgrid
endif
enddo
enddo

else ! default behavior

! place ice at high latitudes where ocean sfc is cold
icells = 0
do j = jlo, jhi
do i = ilo, ihi
if (tmask(i,j)) then
! place ice in high latitudes where ocean sfc is cold
if ( (sst (i,j) <= Tf(i,j)+p2) .and. &
(TLAT(i,j) < edge_init_sh/rad_to_deg .or. &
TLAT(i,j) > edge_init_nh/rad_to_deg) ) then
icells = icells + 1
indxi(icells) = i
indxj(icells) = j
endif ! cold surface
endif ! tmask
enddo ! i
enddo ! j

endif ! ice_data_type

do n = 1, ncat

Expand Down Expand Up @@ -2699,7 +2713,9 @@ subroutine set_state_var (nx_block, ny_block, &
! / (real(ny_global,kind=dbl_kind)) * p5)
endif
vicen(i,j,n) = hinit(n) * aicen(i,j,n) ! m

elseif (trim(ice_data_type) == 'boxslotcyl') then

if (hinit(n) > c0) then
! slotted cylinder
call boxslotcyl_data_aice(aicen, i, j, &
Expand All @@ -2708,9 +2724,12 @@ subroutine set_state_var (nx_block, ny_block, &
iglob, jglob)
endif
vicen(i,j,n) = hinit(n) * aicen(i,j,n) ! m
else

else ! default case. ice_data_type = uniform

vicen(i,j,n) = hinit(n) * ainit(n) ! m
endif
endif ! ice_data_type

vsnon(i,j,n) = min(aicen(i,j,n)*hsno_init,p2*vicen(i,j,n))

call icepack_init_trcr(Tair = Tair(i,j), Tf = Tf(i,j), &
Expand Down
54 changes: 54 additions & 0 deletions configuration/scripts/options/set_nml.boxsyme
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
days_per_year = 360
use_leap_years = .false.
npt_unit = 'd'
npt = 5
ice_ic = 'default'
restart_ext = .true.
histfreq = 'd','1','x','x','x'
grid_type = 'rectangular'
dxrect = 16.e5
dyrect = 16.e5
close_boundaries = .true.
ew_boundary_type = 'open'
ns_boundary_type = 'open'
tr_iage = .false.
tr_FY = .false.
tr_lvl = .false.
tr_pond_lvl = .false.
ktherm = -1
kstrength = 0
kdyn = 1
kridge = -1
ktransport = -1
coriolis = 'constant'
atmbndy = 'constant'
atm_data_type = 'uniform_east'
ice_data_type = 'uniform'
calc_strair = .false.
rotate_wind = .false.
restore_ice = .true.
f_aice = 'd1'
f_hi = 'd1'
f_hs = 'd'
f_Tsfc = 'd'
f_uvel = 'd1'
f_vvel = 'd1'
f_uatm = 'd'
f_vatm = 'd'
f_uocn = 'd'
f_vocn = 'd'
f_strairx = 'd1'
f_strairy = 'd1'
f_strtltx = 'd1'
f_strtlty = 'd1'
f_strcorx = 'd1'
f_strcory = 'd1'
f_strocnx = 'd1'
f_strocny = 'd1'
f_strintx = 'd1'
f_strinty = 'd1'
f_taubx = 'd1'
f_tauby = 'd1'
f_divu = 'd1'
f_sig1 = 'd1'
f_sig2 = 'd1'
54 changes: 54 additions & 0 deletions configuration/scripts/options/set_nml.boxsymn
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
days_per_year = 360
use_leap_years = .false.
npt_unit = 'd'
npt = 5
ice_ic = 'default'
restart_ext = .true.
histfreq = 'd','1','x','x','x'
grid_type = 'rectangular'
dxrect = 16.e5
dyrect = 16.e5
close_boundaries = .true.
ew_boundary_type = 'open'
ns_boundary_type = 'open'
tr_iage = .false.
tr_FY = .false.
tr_lvl = .false.
tr_pond_lvl = .false.
ktherm = -1
kstrength = 0
kdyn = 1
kridge = -1
ktransport = -1
coriolis = 'constant'
atmbndy = 'constant'
atm_data_type = 'uniform_north'
ice_data_type = 'uniform'
calc_strair = .false.
rotate_wind = .false.
restore_ice = .true.
f_aice = 'd1'
f_hi = 'd1'
f_hs = 'd'
f_Tsfc = 'd'
f_uvel = 'd1'
f_vvel = 'd1'
f_uatm = 'd'
f_vatm = 'd'
f_uocn = 'd'
f_vocn = 'd'
f_strairx = 'd1'
f_strairy = 'd1'
f_strtltx = 'd1'
f_strtlty = 'd1'
f_strcorx = 'd1'
f_strcory = 'd1'
f_strocnx = 'd1'
f_strocny = 'd1'
f_strintx = 'd1'
f_strinty = 'd1'
f_taubx = 'd1'
f_tauby = 'd1'
f_divu = 'd1'
f_sig1 = 'd1'
f_sig2 = 'd1'
54 changes: 54 additions & 0 deletions configuration/scripts/options/set_nml.boxsymne
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
days_per_year = 360
use_leap_years = .false.
npt_unit = 'd'
npt = 5
ice_ic = 'default'
restart_ext = .true.
histfreq = 'd','1','x','x','x'
grid_type = 'rectangular'
dxrect = 16.e5
dyrect = 16.e5
close_boundaries = .true.
ew_boundary_type = 'open'
ns_boundary_type = 'open'
tr_iage = .false.
tr_FY = .false.
tr_lvl = .false.
tr_pond_lvl = .false.
ktherm = -1
kstrength = 0
kdyn = 1
kridge = -1
ktransport = -1
coriolis = 'constant'
atmbndy = 'constant'
atm_data_type = 'uniform_northeast'
ice_data_type = 'uniform'
calc_strair = .false.
rotate_wind = .false.
restore_ice = .true.
f_aice = 'd1'
f_hi = 'd1'
f_hs = 'd'
f_Tsfc = 'd'
f_uvel = 'd1'
f_vvel = 'd1'
f_uatm = 'd'
f_vatm = 'd'
f_uocn = 'd'
f_vocn = 'd'
f_strairx = 'd1'
f_strairy = 'd1'
f_strtltx = 'd1'
f_strtlty = 'd1'
f_strcorx = 'd1'
f_strcory = 'd1'
f_strocnx = 'd1'
f_strocny = 'd1'
f_strintx = 'd1'
f_strinty = 'd1'
f_taubx = 'd1'
f_tauby = 'd1'
f_divu = 'd1'
f_sig1 = 'd1'
f_sig2 = 'd1'
2 changes: 2 additions & 0 deletions configuration/scripts/options/set_nml.gridb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
grid_system = 'B'

2 changes: 2 additions & 0 deletions configuration/scripts/options/set_nml.gridcd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
grid_system = 'CD'

16 changes: 16 additions & 0 deletions configuration/scripts/tests/gridsys_suite.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Test Grid PEs Sets BFB-compare
smoke gx3 8x2 diag1,run5day
restart gx3 4x2 debug,diag1
smoke gbox80 1x1 box2001
smoke gbox80 1x1 boxslotcyl
smoke gbox80 1x1 boxsymn
smoke gbox80 1x1 boxsyme
smoke gbox80 1x1 boxsymne

smoke gx3 8x2 diag1,run5day,gridcd
restart gx3 4x2 debug,diag1,gridcd
smoke gbox80 1x1 box2001,gridcd
smoke gbox80 1x1 boxslotcyl,gridcd
smoke gbox80 1x1 boxsymn,gridcd
smoke gbox80 1x1 boxsyme,gridcd
smoke gbox80 1x1 boxsymne,gridcd

0 comments on commit 1b4c03e

Please sign in to comment.