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

Update CICE to run with eclare108213/Icepack branch snicar #100

Merged
merged 6 commits into from
Sep 30, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "icepack"]
path = icepack
url = https://github.com/cice-consortium/Icepack
url = https://github.com/E3SM-Project/Icepack.git
branch = cice-consortium/E3SM-icepack-initial-integration
2 changes: 1 addition & 1 deletion cice.setup
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,7 @@ source ./cice.settings
set bldstat = 0
if (\${dobuild} == true) then
if (\${doreuse} == true) then
set ciceexe = "../ciceexe.\${ICE_TARGET}.\${ICE_ENVNAME}.\${ICE_COMMDIR}.\${ICE_BLDDEBUG}.\${ICE_THREADED}.\${ICE_IOTYPE}"
set ciceexe = "../ciceexe.\${ICE_TARGET}.\${ICE_ENVNAME}.\${ICE_COMMDIR}.\${ICE_BLDDEBUG}.\${ICE_THREADED}.\${ICE_IOTYPE}.\${ICE_SNICARHC}"
./cice.build --exe \${ciceexe}
set bldstat = \${status}
if !(-e \${ciceexe}) cp -p \${ICE_RUNDIR}/cice \${ciceexe}
Expand Down
167 changes: 3 additions & 164 deletions cicecore/cicedynB/general/ice_forcing_bgc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ module ice_forcing_bgc
use ice_calendar, only: dt, istep, msec, mday, mmonth
use ice_fileunits, only: nu_diag
use ice_arrays_column, only: restore_bgc, &
bgc_data_dir, fe_data_type, optics_file, optics_file_fieldname
bgc_data_dir, fe_data_type
use ice_constants, only: c0, p1
use ice_constants, only: field_loc_center, field_type_scalar
use ice_exit, only: abort_ice
use ice_forcing, only: bgc_data_type
use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted
use icepack_intfc, only: icepack_nspint, icepack_max_aero, &
use icepack_intfc, only: icepack_nspint_3bd, icepack_max_aero, &
icepack_max_algae, icepack_max_doc, icepack_max_dic
use icepack_intfc, only: icepack_query_tracer_flags, &
icepack_query_parameters, icepack_query_parameters, &
Expand All @@ -32,8 +32,7 @@ module ice_forcing_bgc
implicit none
private
public :: get_forcing_bgc, get_atm_bgc, fzaero_data, alloc_forcing_bgc, &
init_bgc_data, faero_data, faero_default, faero_optics, &
fiso_default
init_bgc_data, faero_data, faero_default, fiso_default

integer (kind=int_kind) :: &
bgcrecnum = 0 ! old record number (save between steps)
Expand Down Expand Up @@ -840,166 +839,6 @@ subroutine init_bgc_data (fed1,fep1)

end subroutine init_bgc_data

!=======================================================================
!
! Aerosol optical properties for bulk and modal aerosol formulation
! X_bc_tab properties are from snicar_optics_5bnd_mam_c140303 (Mark Flanner 2009)
! ==> "Mie optical parameters for CLM snowpack treatment" Includes
! ice (effective radii from 30-1500um), black carbon, organic carbon and dust
!
! authors: Elizabeth Hunke, LANL

subroutine faero_optics

use ice_broadcast, only: broadcast_array
use ice_read_write, only: ice_open_nc, ice_close_nc
use ice_communicate, only: my_task, master_task
use ice_arrays_column, only: &
kaer_tab, & ! aerosol mass extinction cross section (m2/kg)
waer_tab, & ! aerosol single scatter albedo (fraction)
gaer_tab, & ! aerosol asymmetry parameter (cos(theta))
kaer_bc_tab, & ! BC mass extinction cross section (m2/kg)
waer_bc_tab, & ! BC single scatter albedo (fraction)
gaer_bc_tab, & ! BC aerosol asymmetry parameter (cos(theta))
bcenh ! BC absorption enhancement factor

#ifdef USE_NETCDF
use netcdf
#endif

! local parameters

logical (kind=log_kind) :: modal_aero

integer (kind=int_kind) :: &
varid , & ! variable id
status , & ! status output from netcdf routines
n, k ! index

real (kind=dbl_kind) :: &
amin, amax, asum ! min, max values and sum of input array

integer (kind=int_kind) :: &
fid ! file id for netCDF file

character (char_len_long) :: &
fieldname ! field name in netcdf file

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

! this data is used in bulk aerosol treatment in dEdd radiation
kaer_tab = reshape((/ & ! aerosol mass extinction cross section (m2/kg)
11580.61872, 5535.41835, 2793.79690, &
25798.96479, 11536.03871, 4688.24207, &
196.49772, 204.14078, 214.42287, &
2665.85867, 2256.71027, 820.36024, &
840.78295, 1028.24656, 1163.03298, &
387.51211, 414.68808, 450.29814/), &
(/icepack_nspint,icepack_max_aero/))
waer_tab = reshape((/ & ! aerosol single scatter albedo (fraction)
0.29003, 0.17349, 0.06613, &
0.51731, 0.41609, 0.21324, &
0.84467, 0.94216, 0.95666, &
0.97764, 0.99402, 0.98552, &
0.94146, 0.98527, 0.99093, &
0.90034, 0.96543, 0.97678/), &
(/icepack_nspint,icepack_max_aero/))
gaer_tab = reshape((/ & ! aerosol asymmetry parameter (cos(theta))
0.35445, 0.19838, 0.08857, &
0.52581, 0.32384, 0.14970, &
0.83162, 0.78306, 0.74375, &
0.68861, 0.70836, 0.54171, &
0.70239, 0.66115, 0.71983, &
0.78734, 0.73580, 0.64411/), &
(/icepack_nspint,icepack_max_aero/))

! this data is used in MODAL AEROSOL treatment in dEdd radiation
kaer_bc_tab = reshape((/ & ! aerosol mass extinction cross section (m2/kg)
12955.44732, 5946.89461, 2772.33366, &
12085.30664, 7438.83131, 3657.13084, &
9753.99698, 7342.87139, 4187.79304, &
7815.74879, 6659.65096, 4337.98863, &
6381.28194, 5876.78408, 4254.65054, &
5326.93163, 5156.74532, 4053.66581, &
4538.09763, 4538.60875, 3804.10884, &
3934.17604, 4020.20799, 3543.27199, &
3461.20656, 3587.80962, 3289.98060, &
3083.03396, 3226.27231, 3052.91441/), &
(/icepack_nspint,10/))

waer_bc_tab = reshape((/ & ! aerosol single scatter albedo (fraction)
0.26107, 0.15861, 0.06535, &
0.37559, 0.30318, 0.19483, &
0.42224, 0.36913, 0.27875, &
0.44777, 0.40503, 0.33026, &
0.46444, 0.42744, 0.36426, &
0.47667, 0.44285, 0.38827, &
0.48635, 0.45428, 0.40617, &
0.49440, 0.46328, 0.42008, &
0.50131, 0.47070, 0.43128, &
0.50736, 0.47704, 0.44056/), &
(/icepack_nspint,10/))

gaer_bc_tab = reshape((/ & ! aerosol asymmetry parameter (cos(theta))
0.28328, 0.19644, 0.10498, &
0.44488, 0.32615, 0.19612, &
0.54724, 0.41611, 0.26390, &
0.61711, 0.48475, 0.31922, &
0.66673, 0.53923, 0.36632, &
0.70296, 0.58337, 0.40732, &
0.73002, 0.61960, 0.44344, &
0.75064, 0.64959, 0.47551, &
0.76663, 0.67461, 0.50415, &
0.77926, 0.69561, 0.52981/),&
(/icepack_nspint,10/))

bcenh(:,:,:) = c0

call icepack_query_parameters(modal_aero_out=modal_aero)
call icepack_warnings_flush(nu_diag)
if (icepack_warnings_aborted()) call abort_ice(error_message=subname, &
file=__FILE__, line=__LINE__)

if (modal_aero) then
#ifdef USE_NETCDF
if (my_task == master_task) then
write (nu_diag,*) ' '
write (nu_diag,*) 'Read optics for modal aerosol treament in'
write (nu_diag,*) trim(optics_file)
write (nu_diag,*) 'Read optics file field name = ',trim(optics_file_fieldname)
call ice_open_nc(optics_file,fid)

fieldname=optics_file_fieldname

status = nf90_inq_varid(fid, trim(fieldname), varid)

if (status /= nf90_noerr) then
call abort_ice (subname//'ERROR: Cannot find variable '//trim(fieldname))
endif
status = nf90_get_var( fid, varid, bcenh, &
start=(/1,1,1,1/), &
count=(/3,10,8,1/) )
do n=1,10
amin = minval(bcenh(:,n,:))
amax = maxval(bcenh(:,n,:))
asum = sum (bcenh(:,n,:))
write(nu_diag,*) ' min, max, sum =', amin, amax, asum
enddo
call ice_close_nc(fid)
endif !master_task
do n=1,3
do k=1,8
call broadcast_array(bcenh(n,:,k), master_task)
enddo
enddo
#else
call abort_ice(subname//'ERROR: USE_NETCDF cpp not defined', &
file=__FILE__, line=__LINE__)
#endif
endif ! modal_aero

end subroutine faero_optics

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

end module ice_forcing_bgc
Expand Down
36 changes: 22 additions & 14 deletions cicecore/cicedynB/general/ice_init.F90
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ subroutine input_data

character (len=char_len) :: shortwave, albedo_type, conduct, fbot_xfer_type, &
tfrz_option, frzpnd, atmbndy, wave_spec_type, snwredist, snw_aging_table, &
capping_method
capping_method, snw_ssp_table

logical (kind=log_kind) :: calc_Tsfc, formdrag, highfreq, calc_strair, wave_spec, &
sw_redist, calc_dragio, use_smliq_pnd, snwgrain
Expand Down Expand Up @@ -255,7 +255,7 @@ subroutine input_data
Cf, Pstar, Cstar, Ktens

namelist /shortwave_nml/ &
shortwave, albedo_type, &
shortwave, albedo_type, snw_ssp_table, &
albicev, albicei, albsnowv, albsnowi, &
ahmax, R_ice, R_pnd, R_snw, &
sw_redist, sw_frac, sw_dtemp, &
Expand Down Expand Up @@ -437,6 +437,7 @@ subroutine input_data
advection = 'remap' ! incremental remapping transport scheme
conserv_check = .false. ! tracer conservation check
shortwave = 'ccsm3' ! 'ccsm3' or 'dEdd' (delta-Eddington)
snw_ssp_table = 'test' ! 'test' or 'snicar' dEdd_snicar_ad table data
albedo_type = 'ccsm3' ! 'ccsm3' or 'constant'
#ifdef UNDEPRECATE_0LAYER
ktherm = 1 ! -1 = OFF, 0 = 0-layer, 1 = BL99, 2 = mushy thermo
Expand Down Expand Up @@ -902,6 +903,7 @@ subroutine input_data
call broadcast_scalar(advection, master_task)
call broadcast_scalar(conserv_check, master_task)
call broadcast_scalar(shortwave, master_task)
call broadcast_scalar(snw_ssp_table, master_task)
call broadcast_scalar(albedo_type, master_task)
call broadcast_scalar(ktherm, master_task)
call broadcast_scalar(coriolis, master_task)
Expand Down Expand Up @@ -1188,7 +1190,7 @@ subroutine input_data
write(nu_diag,*) subname//' ERROR: invalid seabed stress method'
write(nu_diag,*) subname//' ERROR: seabed_stress_method should be LKD or probabilistic'
endif
abort_list = trim(abort_list)//":34"
abort_list = trim(abort_list)//":48"
endif
endif

Expand Down Expand Up @@ -1283,10 +1285,10 @@ subroutine input_data
abort_list = trim(abort_list)//":7"
endif

if (trim(shortwave) /= 'dEdd' .and. tr_pond .and. calc_tsfc) then
if (shortwave(1:4) /= 'dEdd' .and. tr_pond .and. calc_tsfc) then
if (my_task == master_task) then
write(nu_diag,*) subname//' ERROR: tr_pond=T, calc_tsfc=T, invalid shortwave'
write(nu_diag,*) subname//' ERROR: Must use shortwave=dEdd'
write(nu_diag,*) subname//' ERROR: Must use shortwave=dEdd or dEdd_snicar_ad'
endif
abort_list = trim(abort_list)//":8"
endif
Expand Down Expand Up @@ -1399,19 +1401,20 @@ subroutine input_data
abort_list = trim(abort_list)//":36"
endif

if (trim(shortwave) /= 'dEdd' .and. tr_aero) then
if (shortwave(1:4) /= 'dEdd' .and. tr_aero) then
if (my_task == master_task) then
write(nu_diag,*) subname//' ERROR: tr_aero=T, invalid shortwave'
write(nu_diag,*) subname//' ERROR: Must use shortwave=dEdd'
write(nu_diag,*) subname//' ERROR: Must use shortwave=dEdd or dEdd_snicar_ad'
endif
abort_list = trim(abort_list)//":10"
endif

if (trim(shortwave) /= 'dEdd' .and. snwgrain) then
if (shortwave(1:4) /= 'dEdd' .and. snwgrain) then
if (my_task == master_task) then
write (nu_diag,*) 'WARNING: snow grain radius activated but'
write (nu_diag,*) 'WARNING: dEdd shortwave is not.'
write (nu_diag,*) subname//' ERROR: snow grain radius is activated'
write (nu_diag,*) subname//' ERROR: Must use shortwave=dEdd or dEdd_snicar_ad'
endif
abort_list = trim(abort_list)//":29"
endif

if ((rfracmin < -puny .or. rfracmin > c1+puny) .or. &
Expand Down Expand Up @@ -1689,7 +1692,7 @@ subroutine input_data
write(nu_diag,1020) ' nilyr = ', nilyr, ' : number of ice layers (equal thickness)'
write(nu_diag,1020) ' nslyr = ', nslyr, ' : number of snow layers (equal thickness)'
write(nu_diag,1020) ' nblyr = ', nblyr, ' : number of bio layers (equal thickness)'
if (trim(shortwave) == 'dEdd') &
if (shortwave(1:4) == 'dEdd') &
write(nu_diag,*) 'dEdd interior and sfc scattering layers are used in both ice, snow (unequal)'
write(nu_diag,1020) ' ncat = ', ncat, ' : number of ice categories'
if (kcatbound == 0) then
Expand Down Expand Up @@ -1937,19 +1940,24 @@ subroutine input_data
write(nu_diag,*) '--------------------------------'
if (trim(shortwave) == 'dEdd') then
tmpstr2 = ' : delta-Eddington multiple-scattering method'
elseif (trim(shortwave) == 'dEdd_snicar_ad') then
tmpstr2 = ' : delta-Eddington multiple-scattering method with SNICAR AD'
elseif (trim(shortwave) == 'ccsm3') then
tmpstr2 = ' : NCAR CCSM3 distribution method'
else
tmpstr2 = ' : unknown value'
endif
write(nu_diag,1030) ' shortwave = ', trim(shortwave),trim(tmpstr2)
if (trim(shortwave) == 'dEdd') then
if (shortwave(1:4) == 'dEdd') then
write(nu_diag,1002) ' R_ice = ', R_ice,' : tuning parameter for sea ice albedo'
write(nu_diag,1002) ' R_pnd = ', R_pnd,' : tuning parameter for ponded sea ice albedo'
write(nu_diag,1002) ' R_snw = ', R_snw,' : tuning parameter for snow broadband albedo'
write(nu_diag,1002) ' dT_mlt = ', dT_mlt,' : change in temperature per change in snow grain radius'
write(nu_diag,1002) ' rsnw_mlt = ', rsnw_mlt,' : maximum melting snow grain radius'
write(nu_diag,1002) ' kalg = ', kalg,' : absorption coefficient for algae'
if (trim(shortwave) == 'dEdd_snicar_ad') then
write(nu_diag,1030) ' snw_ssp_table = ', trim(snw_ssp_table)
endif
else
if (trim(albedo_type) == 'ccsm3') then
tmpstr2 = ' : NCAR CCSM3 albedos'
Expand Down Expand Up @@ -2120,7 +2128,7 @@ subroutine input_data
write(nu_diag,*) 'Using default dEdd melt pond scheme for testing only'
endif

if (trim(shortwave) == 'dEdd') then
if (shortwave(1:4) == 'dEdd') then
write(nu_diag,1002) ' hs0 = ', hs0,' : snow depth of transition to bare sea ice'
endif

Expand Down Expand Up @@ -2415,7 +2423,7 @@ subroutine input_data

call icepack_init_parameters(ustar_min_in=ustar_min, albicev_in=albicev, albicei_in=albicei, &
albsnowv_in=albsnowv, albsnowi_in=albsnowi, natmiter_in=natmiter, atmiter_conv_in=atmiter_conv, &
emissivity_in=emissivity, &
emissivity_in=emissivity, snw_ssp_table_in=snw_ssp_table, &
ahmax_in=ahmax, shortwave_in=shortwave, albedo_type_in=albedo_type, R_ice_in=R_ice, R_pnd_in=R_pnd, &
R_snw_in=R_snw, dT_mlt_in=dT_mlt, rsnw_mlt_in=rsnw_mlt, &
kstrength_in=kstrength, krdg_partic_in=krdg_partic, krdg_redist_in=krdg_redist, mu_rdg_in=mu_rdg, &
Expand Down
15 changes: 3 additions & 12 deletions cicecore/cicedynB/general/ice_step_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,7 @@ subroutine prep_radiation (iblk)
alidr_init(i,j,iblk) = alidr_ai(i,j,iblk)
alidf_init(i,j,iblk) = alidf_ai(i,j,iblk)

call icepack_prep_radiation (ncat=ncat, nilyr=nilyr, nslyr=nslyr, &
scale_factor=scale_factor(i,j,iblk), &
call icepack_prep_radiation (scale_factor=scale_factor(i,j,iblk), &
aice = aice (i,j, iblk), aicen = aicen (i,j, :,iblk), &
swvdr = swvdr (i,j, iblk), swvdf = swvdf (i,j, iblk), &
swidr = swidr (i,j, iblk), swidf = swidf (i,j, iblk), &
Expand Down Expand Up @@ -1223,8 +1222,7 @@ subroutine step_radiation (dt, iblk)
fswthrun, fswthrun_vdr, fswthrun_vdf, fswthrun_idr, fswthrun_idf, &
albicen, albsnon, albpndn, &
alvdrn, alidrn, alvdfn, alidfn, apeffn, trcrn_sw, snowfracn, &
kaer_tab, waer_tab, gaer_tab, kaer_bc_tab, waer_bc_tab, &
gaer_bc_tab, bcenh, swgrid, igrid
swgrid, igrid
use ice_blocks, only: block, get_block
use ice_calendar, only: calendar_type, days_per_year, nextsw_cday, yday, msec
use ice_domain, only: blocks_ice
Expand Down Expand Up @@ -1333,9 +1331,7 @@ subroutine step_radiation (dt, iblk)

if (tmask(i,j,iblk)) then

call icepack_step_radiation (dt=dt, ncat=ncat, &
nblyr=nblyr, nilyr=nilyr, nslyr=nslyr, &
dEdd_algae=dEdd_algae, &
call icepack_step_radiation (dt=dt, &
swgrid=swgrid(:), igrid=igrid(:), &
fbri=fbri(:), &
aicen=aicen(i,j, :,iblk), &
Expand All @@ -1355,11 +1351,6 @@ subroutine step_radiation (dt, iblk)
days_per_year=days_per_year, &
nextsw_cday=nextsw_cday, yday=yday, &
sec=msec, &
kaer_tab=kaer_tab, kaer_bc_tab=kaer_bc_tab(:,:), &
waer_tab=waer_tab, waer_bc_tab=waer_bc_tab(:,:), &
gaer_tab=gaer_tab, gaer_bc_tab=gaer_bc_tab(:,:), &
bcenh=bcenh(:,:,:), &
modal_aero=modal_aero, &
swvdr =swvdr (i,j ,iblk), swvdf =swvdf (i,j ,iblk), &
swidr =swidr (i,j ,iblk), swidf =swidf (i,j ,iblk), &
coszen =coszen (i,j ,iblk), fsnow =fsnow (i,j ,iblk), &
Expand Down
Loading