Skip to content

Commit

Permalink
zsal option for testing zsalinity code (#548)
Browse files Browse the repository at this point in the history
* zsal option for testing zsalinity code

* add zsal tests to base_suite

* fix history conditionals for fields outside main namelist; adjust zsal tests in base_suite
  • Loading branch information
eclare108213 authored Dec 23, 2020
1 parent 2b10c11 commit f5f487f
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 21 deletions.
46 changes: 30 additions & 16 deletions cicecore/cicedynB/analysis/ice_history_bgc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ module ice_history_bgc
subroutine init_hist_bgc_2D

use ice_broadcast, only: broadcast_scalar
use ice_calendar, only: nstreams
use ice_calendar, only: nstreams, histfreq
use ice_communicate, only: my_task, master_task
use ice_history_shared, only: tstr2D, tcstr, define_hist_field, &
f_fsalt, f_fsalt_ai, f_sice
Expand Down Expand Up @@ -781,6 +781,7 @@ subroutine init_hist_bgc_2D
if (tr_iso .or. tr_aero .or. tr_brine .or. solve_zsal .or. skl_bgc) then

do ns = 1, nstreams
if (histfreq(ns) /= 'x') then

if (f_iso(1:1) /= 'x') then
do n=1,n_iso
Expand Down Expand Up @@ -1780,6 +1781,7 @@ subroutine init_hist_bgc_2D
"distance from ice bottom to brine surface", c1, c0, &
ns, f_hbri)

endif ! histfreq(ns) /= 'x'
enddo ! nstreams

endif ! tr_aero, etc
Expand All @@ -1790,7 +1792,7 @@ end subroutine init_hist_bgc_2D

subroutine init_hist_bgc_3Dc

use ice_calendar, only: nstreams
use ice_calendar, only: nstreams, histfreq
use ice_history_shared, only: tstr3Dc, tcstr, define_hist_field

integer (kind=int_kind) :: ns
Expand All @@ -1802,26 +1804,27 @@ subroutine init_hist_bgc_3Dc
if (icepack_warnings_aborted()) call abort_ice(error_message=subname, &
file=__FILE__, line=__LINE__)

if (tr_brine) then
if (tr_brine) then

! 3D (category) variables must be looped separately
do ns = 1, nstreams
if (f_fbri(1:1) /= 'x') &
call define_hist_field(n_fbri,"fbrine","1",tstr3Dc, tcstr, &
if (histfreq(ns) /= 'x') then
if (f_fbri(1:1) /= 'x') &
call define_hist_field(n_fbri,"fbrine","1",tstr3Dc, tcstr, &
"brine tracer fraction of ice volume, cat", &
"none", c1, c0, &
ns, f_fbri)
"none", c1, c0, ns, f_fbri)
endif ! histfreq /= 'x'
enddo ! ns

endif
endif ! tr_brine

end subroutine init_hist_bgc_3Dc

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

subroutine init_hist_bgc_3Db

use ice_calendar, only: nstreams
use ice_calendar, only: nstreams,histfreq
use ice_history_shared, only: tstr3Db, tcstr, define_hist_field

integer (kind=int_kind) :: ns
Expand All @@ -1841,6 +1844,7 @@ subroutine init_hist_bgc_3Db
if (z_tracers .or. solve_zsal) then

do ns = 1, nstreams
if (histfreq(ns) /= 'x') then

if (f_bTin(1:1) /= 'x') &
call define_hist_field(n_bTin,"bTizn","C",tstr3Db, tcstr, &
Expand Down Expand Up @@ -1873,6 +1877,7 @@ subroutine init_hist_bgc_3Db
"internal ice PAR", "on bio interface grid", c1, c0, &
ns, f_zfswin)

endif ! histfreq(ns) /= 'x'
enddo ! ns

endif ! z_tracers or solve_zsal
Expand Down Expand Up @@ -2012,9 +2017,10 @@ subroutine accum_hist_bgc (iblk)
! increment field
!---------------------------------------------------------------

if (tr_iso .or. tr_aero .or. tr_brine .or. solve_zsal .or. skl_bgc) then
! 2d bgc fields
! 2d bgc fields
if (allocated(a2D)) then

if (tr_iso .or. tr_aero .or. tr_brine .or. solve_zsal .or. skl_bgc) then

! zsalinity
if (f_fzsal (1:1) /= 'x') &
Expand Down Expand Up @@ -2635,19 +2641,22 @@ subroutine accum_hist_bgc (iblk)
call accum_hist_field(n_hbri, iblk, &
hbri(:,:,iblk), a2D)

endif ! 2d bgc tracers, tr_aero, tr_brine, solve_zsal, skl_bgc

endif ! 2d bgc tracers, tr_aero, tr_brine, solve_zsal, skl_bgc
endif ! allocated(a2D)

! 3D category fields

if (allocated(a3Dc)) then
if (tr_brine) then
! 3Dc bgc category fields

if (f_fbri (1:1) /= 'x') &
call accum_hist_field(n_fbri-n2D, iblk, ncat_hist, &
trcrn(:,:,nt_fbri,1:ncat_hist,iblk), a3Dc)
endif
endif ! allocated(a3Dc)

if (allocated(a3Db)) then
if (z_tracers .or. solve_zsal) then
! 3Db category fields

Expand Down Expand Up @@ -2754,8 +2763,10 @@ subroutine accum_hist_bgc (iblk)
workz(:,:,1:nzblyr), a3Db)
endif

endif ! 3Db fields
endif ! 3Db fields
endif ! allocated(a3Db)

if (allocated(a3Da)) then
if (z_tracers) then
! 3Da category fields

Expand Down Expand Up @@ -3189,15 +3200,16 @@ subroutine accum_hist_bgc (iblk)
workz2(:,:,1:nzalyr), a3Da)
endif

endif ! z_tracers, 3Da tracers
endif ! z_tracers, 3Da tracers
endif ! allocated(a3Da)

end subroutine accum_hist_bgc

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

subroutine init_hist_bgc_3Da

use ice_calendar, only: nstreams
use ice_calendar, only: nstreams, histfreq
use ice_history_shared, only: tstr3Da, tcstr, define_hist_field

integer (kind=int_kind) :: ns, n
Expand All @@ -3216,6 +3228,7 @@ subroutine init_hist_bgc_3Da
if (z_tracers) then

do ns = 1, nstreams
if (histfreq(ns) /= 'x') then

!----------------------------------------------------------------------------
! snow+bio grid ==>
Expand Down Expand Up @@ -3439,6 +3452,7 @@ subroutine init_hist_bgc_3Da
"other bulk nitrogen pool in cat 1", "snow+bio grid", c1, c0, &
ns, f_bgc_PON_cat1)

endif ! histfreq(ns) /= 'x'
enddo !ns

endif ! z_tracers
Expand Down
13 changes: 11 additions & 2 deletions cicecore/cicedynB/analysis/ice_history_mechred.F90
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ module ice_history_mechred
subroutine init_hist_mechred_2D

use ice_broadcast, only: broadcast_scalar
use ice_calendar, only: nstreams
use ice_calendar, only: nstreams, histfreq
use ice_communicate, only: my_task, master_task
use ice_history_shared, only: tstr2D, tcstr, define_hist_field

Expand Down Expand Up @@ -157,6 +157,7 @@ subroutine init_hist_mechred_2D
! 2D variables

do ns = 1, nstreams
if (histfreq(ns) /= 'x') then

if (f_alvl(1:1) /= 'x') &
call define_hist_field(n_alvl,"alvl","1",tstr2D, tcstr, &
Expand Down Expand Up @@ -203,6 +204,7 @@ subroutine init_hist_mechred_2D
"none", secday*c100, c0, &
ns, f_opening)

endif ! histfreq(ns) /= 'x'
enddo ! nstreams

end subroutine init_hist_mechred_2D
Expand All @@ -211,7 +213,7 @@ end subroutine init_hist_mechred_2D

subroutine init_hist_mechred_3Dc

use ice_calendar, only: nstreams
use ice_calendar, only: nstreams, histfreq
use ice_history_shared, only: tstr3Dc, tcstr, define_hist_field

integer (kind=int_kind) :: ns
Expand All @@ -228,6 +230,7 @@ subroutine init_hist_mechred_3Dc
file=__FILE__, line=__LINE__)

do ns = 1, nstreams
if (histfreq(ns) /= 'x') then

if (f_ardgn(1:1) /= 'x') &
call define_hist_field(n_ardgn,"ardgn","1",tstr3Dc, tcstr, &
Expand Down Expand Up @@ -295,6 +298,7 @@ subroutine init_hist_mechred_3Dc
"none", c1, c0, &
ns, f_vraftn)

endif ! histfreq(ns) /= 'x'
enddo ! ns

end subroutine init_hist_mechred_3Dc
Expand Down Expand Up @@ -332,6 +336,7 @@ subroutine accum_hist_mechred (iblk)
!---------------------------------------------------------------

! 2D fields
if (allocated(a2D)) then

if (f_alvl(1:1)/= 'x') &
call accum_hist_field(n_alvl, iblk, &
Expand All @@ -354,7 +359,10 @@ subroutine accum_hist_mechred (iblk)
if (f_opening(1:1) /= 'x') &
call accum_hist_field(n_opening, iblk, opening(:,:,iblk), a2D)

endif ! allocated(a2D)

! 3D category fields
if (allocated(a3Dc)) then

if (f_ardgn(1:1)/= 'x') &
call accum_hist_field(n_ardgn-n2D, iblk, ncat_hist, &
Expand Down Expand Up @@ -391,6 +399,7 @@ subroutine accum_hist_mechred (iblk)
if (f_vraftn(1:1)/= 'x') &
call accum_hist_field(n_vraftn-n2D, iblk, ncat_hist, &
vraftn(:,:,1:ncat_hist,iblk), a3Dc)
endif ! allocated(a3Dc)

end subroutine accum_hist_mechred

Expand Down
13 changes: 11 additions & 2 deletions cicecore/cicedynB/analysis/ice_history_pond.F90
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ module ice_history_pond
subroutine init_hist_pond_2D

use ice_broadcast, only: broadcast_scalar
use ice_calendar, only: nstreams
use ice_calendar, only: nstreams, histfreq
use ice_communicate, only: my_task, master_task
use ice_history_shared, only: tstr2D, tcstr, define_hist_field

Expand Down Expand Up @@ -135,6 +135,7 @@ subroutine init_hist_pond_2D

! 2D variables
do ns = 1, nstreams
if (histfreq(ns) /= 'x') then

if (f_apond(1:1) /= 'x') &
call define_hist_field(n_apond,"apond","1",tstr2D, tcstr, &
Expand Down Expand Up @@ -184,6 +185,7 @@ subroutine init_hist_pond_2D
"weighted by ice area", c1, c0, &
ns, f_apeff_ai)

endif ! histfreq(ns) /= 'x'
enddo ! nstreams

endif ! tr_pond
Expand All @@ -194,7 +196,7 @@ end subroutine init_hist_pond_2D

subroutine init_hist_pond_3Dc

use ice_calendar, only: nstreams
use ice_calendar, only: nstreams, histfreq
use ice_history_shared, only: tstr3Dc, tcstr, define_hist_field

integer (kind=int_kind) :: ns
Expand All @@ -210,6 +212,7 @@ subroutine init_hist_pond_3Dc

! 3D (category) variables must be looped separately
do ns = 1, nstreams
if (histfreq(ns) /= 'x') then

if (f_apondn(1:1) /= 'x') &
call define_hist_field(n_apondn,"apondn","1",tstr3Dc, tcstr, &
Expand All @@ -227,6 +230,7 @@ subroutine init_hist_pond_3Dc
"none", c1, c0, &
ns, f_apeffn)

endif ! histfreq(ns) /= 'x'
enddo ! ns

endif ! tr_pond
Expand Down Expand Up @@ -286,6 +290,7 @@ subroutine accum_hist_pond (iblk)
if (icepack_warnings_aborted()) call abort_ice(error_message=subname, &
file=__FILE__, line=__LINE__)

if (allocated(a2D)) then
if (tr_pond_cesm) then
if (f_apond(1:1)/= 'x') &
call accum_hist_field(n_apond, iblk, &
Expand Down Expand Up @@ -374,7 +379,10 @@ subroutine accum_hist_pond (iblk)
if (f_apeff_ai(1:1) /= 'x') &
call accum_hist_field(n_apeff_ai, iblk, apeff_ai(:,:,iblk), a2D)

endif ! allocated(a2D)

! 3D category fields
if (allocated(a3Dc)) then
if (f_apondn (1:1) /= 'x') &
call accum_hist_field(n_apondn-n2D, iblk, ncat_hist, &
trcrn(:,:,nt_apnd,1:ncat_hist,iblk), a3Dc)
Expand All @@ -385,6 +393,7 @@ subroutine accum_hist_pond (iblk)
call accum_hist_field(n_hpondn-n2D, iblk, ncat_hist, &
trcrn(:,:,nt_apnd,1:ncat_hist,iblk) &
* trcrn(:,:,nt_hpnd,1:ncat_hist,iblk), a3Dc)
endif ! allocated(a3Dc)

end subroutine accum_hist_pond

Expand Down
9 changes: 9 additions & 0 deletions configuration/scripts/options/set_nml.zsal
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ktherm = 1
sw_redist = .true.
tfrz_option = 'linear_salt'
tr_brine = .true.
solve_zsal = .true.
z_tracers = .true.
ice_ic = 'default'
restart = .false.

3 changes: 2 additions & 1 deletion configuration/scripts/tests/base_suite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ restart gx3 4x4 histall,precision8,cdf64
smoke gx3 30x1 bgcz,histall
smoke gx3 14x2 fsd12,histall
smoke gx3 4x1 dynpicard,medium

smoke gx3 8x2 diag24,run5day,zsal,debug
restart gx3 8x2 zsal
restart gx3 8x2 gx3ncarbulk,debug
restart gx3 4x4 gx3ncarbulk,diag1
restart gx1 24x1 gx1coreii,short

0 comments on commit f5f487f

Please sign in to comment.