Skip to content

Commit

Permalink
Update CICE from Consortium/main, add run-time and history-write logg…
Browse files Browse the repository at this point in the history
…ing (NOAA-EMC#65)
  • Loading branch information
DeniseWorthen committed Sep 22, 2023
1 parent 69ce14b commit f86c770
Show file tree
Hide file tree
Showing 32 changed files with 681 additions and 448 deletions.
7 changes: 7 additions & 0 deletions cicecore/cicedyn/analysis/ice_diagnostics_bgc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -846,15 +846,20 @@ subroutine bgc_diags
802 format (f24.17,2x,f24.17)
803 format (a25,2x,a25)
900 format (a25,2x,f24.17,2x,f24.17)
<<<<<<< HEAD
<<<<<<< HEAD:cicecore/cicedyn/analysis/ice_diagnostics_bgc.F90
901 format (a25,2x,g24.17,2x,g24.17)
=======
>>>>>>> 968a0edc (Add wave-cice coupling; update to Consortium main (#51)):cicecore/cicedynB/analysis/ice_diagnostics_bgc.F90
=======
901 format (a25,2x,g24.17,2x,g24.17)
>>>>>>> 2ed3c05c (Update CICE from Consortium/main, add run-time and history-write logging (#65))
1020 format (a30,2x,i6) ! integer

end subroutine bgc_diags

!=======================================================================
<<<<<<< HEAD
<<<<<<< HEAD:cicecore/cicedyn/analysis/ice_diagnostics_bgc.F90
=======
!
Expand Down Expand Up @@ -1078,6 +1083,8 @@ end subroutine zsal_diags

!=======================================================================
>>>>>>> 25406956 (Update CICE for latest Consortium master (#38)):cicecore/cicedynB/analysis/ice_diagnostics_bgc.F90
=======
>>>>>>> 2ed3c05c (Update CICE from Consortium/main, add run-time and history-write logging (#65))

end module ice_diagnostics_bgc

Expand Down
4 changes: 4 additions & 0 deletions cicecore/cicedyn/analysis/ice_history.F90
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,15 @@ subroutine init_hist (dt)
logical (kind=log_kind) :: formdrag
logical (kind=log_kind) :: tr_iage, tr_FY, tr_lvl, tr_pond, tr_aero, tr_brine
logical (kind=log_kind) :: tr_fsd, tr_snow
<<<<<<< HEAD
<<<<<<< HEAD:cicecore/cicedyn/analysis/ice_history.F90
logical (kind=log_kind) :: skl_bgc, solve_zbgc, z_tracers
=======
logical (kind=log_kind) :: skl_bgc, solve_zsal, solve_zbgc, z_tracers
>>>>>>> 25406956 (Update CICE for latest Consortium master (#38)):cicecore/cicedynB/analysis/ice_history.F90
=======
logical (kind=log_kind) :: skl_bgc, solve_zbgc, z_tracers
>>>>>>> 2ed3c05c (Update CICE from Consortium/main, add run-time and history-write logging (#65))
integer (kind=int_kind) :: n, ns, ns1, ns2
integer (kind=int_kind), dimension(max_nstrm) :: &
ntmp
Expand Down
132 changes: 37 additions & 95 deletions cicecore/cicedyn/analysis/ice_history_bgc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ module ice_history_bgc
f_iso = 'x', &
f_faero_atm = 'x', f_faero_ocn = 'x', &
f_aero = 'x', &
f_fzsal = 'm', f_fzsal_ai = 'm', &
f_fzsal_g = 'm', f_fzsal_g_ai = 'm', &
f_zsal = 'x', &
f_fbio = 'x', f_fbio_ai = 'x', &
f_zaero = 'x', f_bgc_S = 'x', &
f_bgc_N = 'x', f_bgc_C = 'x', &
Expand Down Expand Up @@ -153,11 +150,6 @@ module ice_history_bgc
! field indices
!---------------------------------------------------------------

integer (kind=int_kind), dimension(max_nstrm), public :: &
n_fzsal , n_fzsal_ai , &
n_fzsal_g , n_fzsal_g_ai , &
n_zsal

integer(kind=int_kind), dimension(icepack_max_iso,max_nstrm) :: &
n_fiso_atm , &
n_fiso_ocn , &
Expand Down Expand Up @@ -216,7 +208,6 @@ module ice_history_bgc
n_bgc_Fed_cat1, n_bgc_Fep_cat1

integer(kind=int_kind), dimension(max_nstrm) :: &
n_bgc_S , &
n_fNit , n_fNit_ai , &
n_fAm , n_fAm_ai , &
n_fSil , n_fSil_ai , &
Expand Down Expand Up @@ -282,15 +273,15 @@ subroutine init_hist_bgc_2D
tr_bgc_DMS, tr_bgc_PON, &
tr_bgc_N, tr_bgc_C, tr_bgc_chl, &
tr_bgc_DON, tr_bgc_Fe, tr_bgc_hum, &
skl_bgc, solve_zsal, z_tracers
skl_bgc, z_tracers

character(len=char_len) :: nml_name ! for namelist check
character(len=char_len_long) :: tmpstr2 ! for namelist check

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

call icepack_query_parameters(skl_bgc_out=skl_bgc, &
solve_zsal_out=solve_zsal, z_tracers_out=z_tracers)
z_tracers_out=z_tracers)
call icepack_query_tracer_flags( &
tr_iso_out =tr_iso, tr_zaero_out =tr_zaero, &
tr_aero_out =tr_aero, tr_brine_out =tr_brine, &
Expand Down Expand Up @@ -629,25 +620,6 @@ subroutine init_hist_bgc_2D
f_bgc_DMS_cat1 = f_bgc_DMS
f_bgc_PON_cat1 = f_bgc_PON

if (solve_zsal) then
f_fzsal = f_fsalt
f_fzsal_g = f_fsalt
f_fzsal_ai = f_fsalt_ai
f_fzsal_g_ai = f_fsalt_ai
f_zsal = f_sice
f_fsalt = 'x'
f_fsalt_ai = 'x'
f_sice = 'x'
else
f_fzsal = 'x'
f_fzsal_g = 'x'
f_fzsal_ai = 'x'
f_fzsal_g_ai = 'x'
f_zsal = 'x'
f_bgc_S = 'x'
f_iki = 'x'
endif

call broadcast_scalar (f_fiso_atm, master_task)
call broadcast_scalar (f_fiso_ocn, master_task)
call broadcast_scalar (f_iso, master_task)
Expand All @@ -656,11 +628,6 @@ subroutine init_hist_bgc_2D
call broadcast_scalar (f_aero, master_task)
call broadcast_scalar (f_fbri, master_task)
call broadcast_scalar (f_hbri, master_task)
call broadcast_scalar (f_fzsal, master_task)
call broadcast_scalar (f_fzsal_ai, master_task)
call broadcast_scalar (f_fzsal_g, master_task)
call broadcast_scalar (f_fzsal_g_ai, master_task)
call broadcast_scalar (f_zsal, master_task)
call broadcast_scalar (f_fNit, master_task)
call broadcast_scalar (f_fNit_ai, master_task)
call broadcast_scalar (f_fDOC, master_task)
Expand Down Expand Up @@ -740,7 +707,6 @@ subroutine init_hist_bgc_2D
call broadcast_scalar (f_bphi, master_task)
call broadcast_scalar (f_iDi, master_task)
call broadcast_scalar (f_iki, master_task)
call broadcast_scalar (f_bgc_S, master_task)
call broadcast_scalar (f_zfswin, master_task)
call broadcast_scalar (f_PPnet, master_task)
call broadcast_scalar (f_algalpeak, master_task)
Expand Down Expand Up @@ -800,7 +766,11 @@ subroutine init_hist_bgc_2D

! 2D variables

<<<<<<< HEAD
if (tr_iso .or. tr_aero .or. tr_brine .or. solve_zsal .or. skl_bgc) then
=======
if (tr_iso .or. tr_aero .or. tr_brine .or. skl_bgc) then
>>>>>>> 2ed3c05c (Update CICE from Consortium/main, add run-time and history-write logging (#65))

do ns = 1, nstreams

Expand Down Expand Up @@ -838,33 +808,6 @@ subroutine init_hist_bgc_2D
enddo
endif

! zsalinity

call define_hist_field(n_fzsal,"fzsal","kg/m^2/s",tstr2D, tcstr, &
"prognostic salt flux ice to ocn (cpl)", &
"if positive, ocean gains salt", c1, c0, &
ns, f_fzsal)

call define_hist_field(n_fzsal_ai,"fzsal_ai","kg/m^2/s",tstr2D, tcstr, &
"prognostic salt flux ice to ocean", &
"weighted by ice area", c1, c0, &
ns, f_fzsal_ai)

call define_hist_field(n_fzsal_g,"fzsal_g","kg/m^2/s",tstr2D, tcstr, &
"Gravity drainage salt flux ice to ocn (cpl)", &
"if positive, ocean gains salt", c1, c0, &
ns, f_fzsal_g)

call define_hist_field(n_fzsal_g_ai,"fzsal_g_ai","kg/m^2/s",tstr2D, tcstr, &
"Gravity drainage salt flux ice to ocean", &
"weighted by ice area", c1, c0, &
ns, f_fzsal_g_ai)

call define_hist_field(n_zsal,"zsal_tot","g/m^2",tstr2D, tcstr, &
"Total Salt content", &
"In ice volume*fbri", c1, c0, &
ns, f_zsal)

! Aerosols
if (f_aero(1:1) /= 'x') then
do n=1,n_aero
Expand Down Expand Up @@ -1853,19 +1796,22 @@ subroutine init_hist_bgc_3Db

integer (kind=int_kind) :: ns
real (kind=dbl_kind) :: secday
logical (kind=log_kind) :: solve_zsal, z_tracers
logical (kind=log_kind) :: z_tracers
character(len=*), parameter :: subname = '(init_hist_bgc_3Db)'

! biology vertical grid

call icepack_query_parameters(secday_out=secday)
call icepack_query_parameters( &
solve_zsal_out=solve_zsal, z_tracers_out=z_tracers)
call icepack_query_parameters(z_tracers_out=z_tracers)
call icepack_warnings_flush(nu_diag)
if (icepack_warnings_aborted()) call abort_ice(error_message=subname, &
file=__FILE__, line=__LINE__)

<<<<<<< HEAD
if (z_tracers .or. solve_zsal) then
=======
if (z_tracers) then
>>>>>>> 2ed3c05c (Update CICE from Consortium/main, add run-time and history-write logging (#65))

do ns = 1, nstreams
<<<<<<< HEAD:cicecore/cicedyn/analysis/ice_history_bgc.F90
Expand Down Expand Up @@ -1895,11 +1841,6 @@ subroutine init_hist_bgc_3Db
"permeability", "on bio interface grid", 1.0e6_dbl_kind, c0, &
ns, f_iki)

if (f_bgc_S(1:1) /= 'x') &
call define_hist_field(n_bgc_S,"bgc_S","ppt",tstr3Db, tcstr, &
"bulk salinity", "on bio grid", c1, c0, &
ns, f_bgc_S)

if (f_zfswin(1:1) /= 'x') &
call define_hist_field(n_zfswin,"zfswin","W/m^2",tstr3Db, tcstr, &
"internal ice PAR", "on bio interface grid", c1, c0, &
Expand All @@ -1912,7 +1853,11 @@ subroutine init_hist_bgc_3Db
>>>>>>> 968a0edc (Add wave-cice coupling; update to Consortium main (#51)):cicecore/cicedynB/analysis/ice_history_bgc.F90
enddo ! ns

<<<<<<< HEAD
endif ! z_tracers or solve_zsal
=======
endif ! z_tracers
>>>>>>> 2ed3c05c (Update CICE from Consortium/main, add run-time and history-write logging (#65))

end subroutine init_hist_bgc_3Db

Expand All @@ -1924,14 +1869,14 @@ subroutine accum_hist_bgc (iblk)

use ice_arrays_column, only: ocean_bio, &
grow_net, PP_net, upNO, upNH, ice_bio_net, snow_bio_net, &
hbri, bTiz, bphi, zfswin, iDi, iki, zsal_tot, fzsal, fzsal_g, &
hbri, bTiz, bphi, zfswin, iDi, iki, &
R_C2N, R_chl2N
use ice_blocks, only: block, get_block, nx_block, ny_block
use ice_domain, only: blocks_ice
use ice_domain_size, only: nblyr
use ice_flux, only: sss
use ice_flux_bgc, only: fiso_atm, fiso_ocn, faero_atm, faero_ocn, &
flux_bio, flux_bio_ai, fzsal_ai, fzsal_g_ai
flux_bio, flux_bio_ai
use ice_history_shared, only: n2D, a2D, a3Dc, &
n3Dzcum, n3Dbcum, a3Db, a3Da, &
ncat_hist, accum_hist_field, nzblyr, nzalyr
Expand Down Expand Up @@ -1964,12 +1909,12 @@ subroutine accum_hist_bgc (iblk)
workii

logical (kind=log_kind) :: &
skl_bgc, z_tracers, tr_iso, tr_aero, tr_brine, solve_zsal
skl_bgc, z_tracers, tr_iso, tr_aero, tr_brine

integer(kind=int_kind) :: &
nt_isosno, nt_isoice, nt_aero, nt_fbri, &
nt_bgc_Nit, nt_bgc_Am, nt_bgc_Sil, nt_bgc_DMSPp, &
nt_bgc_DMSPd, nt_bgc_DMS, nt_bgc_PON, nt_bgc_S, &
nt_bgc_DMSPd, nt_bgc_DMS, nt_bgc_PON, &
nt_zbgc_frac, nlt_chl_sw, &
nlt_bgc_Nit, nlt_bgc_Am, nlt_bgc_Sil, &
nlt_bgc_DMS, nlt_bgc_PON, &
Expand Down Expand Up @@ -2010,7 +1955,7 @@ subroutine accum_hist_bgc (iblk)
call icepack_query_tracer_flags(tr_iso_out=tr_iso, &
tr_aero_out=tr_aero, tr_brine_out=tr_brine)
call icepack_query_parameters(skl_bgc_out=skl_bgc, &
solve_zsal_out=solve_zsal, z_tracers_out=z_tracers)
z_tracers_out=z_tracers)
call icepack_query_tracer_indices( &
nt_isosno_out=nt_isosno, nt_isoice_out=nt_isoice, &
nt_aero_out=nt_aero, &
Expand All @@ -2022,7 +1967,7 @@ subroutine accum_hist_bgc (iblk)
nt_bgc_Sil_out=nt_bgc_Sil, nt_bgc_DMSPp_out=nt_bgc_DMSPp, &
nt_bgc_DMSPd_out=nt_bgc_DMSPd, nt_bgc_DMS_out=nt_bgc_DMS, &
nt_bgc_PON_out=nt_bgc_PON, &
nt_bgc_S_out=nt_bgc_S, nt_bgc_Fed_out=nt_bgc_Fed, &
nt_bgc_Fed_out=nt_bgc_Fed, &
nt_bgc_Fep_out=nt_bgc_Fep, nt_zbgc_frac_out=nt_zbgc_frac, &
nlt_zaero_sw_out=nlt_zaero_sw, nlt_chl_sw_out=nlt_chl_sw, &
nlt_bgc_Nit_out=nlt_bgc_Nit, nlt_bgc_Am_out=nlt_bgc_Am, &
Expand Down Expand Up @@ -2052,6 +1997,7 @@ subroutine accum_hist_bgc (iblk)
if (tr_iso .or. tr_aero .or. tr_brine .or. solve_zsal .or. skl_bgc) then
! 2d bgc fields

<<<<<<< HEAD

! zsalinity
if (f_fzsal (1:1) /= 'x') &
Expand All @@ -2064,6 +2010,9 @@ subroutine accum_hist_bgc (iblk)
call accum_hist_field(n_fzsal_g_ai,iblk, fzsal_g_ai(:,:,iblk), a2D)
if (f_zsal (1:1) /= 'x') &
call accum_hist_field(n_zsal, iblk, zsal_tot(:,:,iblk), a2D)
=======
if (tr_iso .or. tr_aero .or. tr_brine .or. skl_bgc) then
>>>>>>> 2ed3c05c (Update CICE from Consortium/main, add run-time and history-write logging (#65))

! isotopes
if (f_fiso_atm(1:1) /= 'x') then
Expand Down Expand Up @@ -2676,8 +2625,13 @@ subroutine accum_hist_bgc (iblk)
call accum_hist_field(n_hbri, iblk, &
hbri(:,:,iblk), a2D)

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

=======
endif ! 2d bgc tracers, tr_aero, tr_brine, skl_bgc
endif ! allocated(a2D)
>>>>>>> 2ed3c05c (Update CICE from Consortium/main, add run-time and history-write logging (#65))

! 3D category fields

Expand All @@ -2689,7 +2643,12 @@ subroutine accum_hist_bgc (iblk)
trcrn(:,:,nt_fbri,1:ncat_hist,iblk), a3Dc)
endif

<<<<<<< HEAD
if (z_tracers .or. solve_zsal) then
=======
if (allocated(a3Db)) then
if (z_tracers) then
>>>>>>> 2ed3c05c (Update CICE from Consortium/main, add run-time and history-write logging (#65))
! 3Db category fields

if (f_bTin (1:1) /= 'x') then
Expand Down Expand Up @@ -2724,21 +2683,6 @@ subroutine accum_hist_bgc (iblk)
workz(:,:,1:nzblyr), a3Db)
endif

if (f_bgc_S (1:1) /= 'x') then
workz(:,:,:) = c0
do j = jlo, jhi
do i = ilo, ihi
if (aice(i,j,iblk) > c0) then
workz(i,j,1) = trcr(i,j,nt_bgc_S,iblk)
workz(i,j,2:nblyr+1) = trcr(i,j,nt_bgc_S:nt_bgc_S+nblyr-1,iblk)
workz(i,j,nblyr+2) = sss(i,j,iblk)
endif
enddo ! i
enddo ! j
call accum_hist_field(n_bgc_S-n3Dzcum, iblk, nzblyr, &
workz(:,:,1:nzblyr), a3Db)
endif

if (f_zfswin (1:1) /= 'x') then
workz(:,:,:) = c0
do n = 1, ncat_hist
Expand Down Expand Up @@ -3512,7 +3456,7 @@ subroutine init_history_bgc

use ice_arrays_column, only: PP_net, grow_net, hbri, &
ice_bio_net, snow_bio_net, fbio_snoice, fbio_atmice, &
fzsal, fzsal_g, zfswin
zfswin
use ice_flux_bgc, only: flux_bio, flux_bio_ai, fnit, fsil, &
famm, fdmsp, fdms, fhum, fdust, falgalN, fdoc, fdic, &
fdon, ffep, ffed
Expand All @@ -3528,8 +3472,6 @@ subroutine init_history_bgc
snow_bio_net(:,:,:,:) = c0
fbio_snoice (:,:,:,:) = c0
fbio_atmice (:,:,:,:) = c0
fzsal (:,:,:) = c0
fzsal_g (:,:,:) = c0
zfswin (:,:,:,:,:) = c0
fnit (:,:,:) = c0
fsil (:,:,:) = c0
Expand Down
Loading

0 comments on commit f86c770

Please sign in to comment.