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

Turn on snicar data table via USE_SNICARHC by default. Add cpl_frazil namelist. #881

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 8 additions & 0 deletions cice.setup
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,14 @@ setenv ICE_QUEUE ${queue}
setenv ICE_COVERAGE ${coverageflag}
EOF1

# for tests and suites set SNICARHC default is false to speed up build
# will be set to true if SNICARHC is needed
if (${docase} == 0) then
cat >> ${fsmods} << EOF1
setenv ICE_SNICARHC false
EOF1
endif

if (${sets} != "") then
set setsx = `echo ${sets} | sed 's/,/ /g'`
set setsxorig = "$setsx"
Expand Down
5 changes: 3 additions & 2 deletions cicecore/cicedyn/analysis/ice_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ subroutine runtime_diags (dt)
use ice_flux, only: alvdr, alidr, alvdf, alidf, evap, fsnow, frazil, &
fswabs, fswthru, flw, flwout, fsens, fsurf, flat, frzmlt_init, frain, fpond, &
fhocn_ai, fsalt_ai, fresh_ai, frazil_diag, &
update_ocn_f, Tair, Qa, fsw, fcondtop, meltt, meltb, meltl, snoice, &
update_ocn_f, cpl_frazil, Tair, Qa, fsw, fcondtop, meltt, meltb, meltl, snoice, &
dsnow, congel, sst, sss, Tf, fhocn, &
swvdr, swvdf, swidr, swidf, &
alvdr_init, alvdf_init, alidr_init, alidf_init
Expand Down Expand Up @@ -722,8 +722,9 @@ subroutine runtime_diags (dt)
! frazil ice growth !! should not be multiplied by aice
! m/step->kg/m^2/s
work1(:,:,:) = frazil(:,:,:)*rhoi/dt
if (ktherm == 2 .and. .not.update_ocn_f) &
if (.not. update_ocn_f .and. ktherm == 2 .and. cpl_frazil == 'fresh_ice_correction') then
work1(:,:,:) = (frazil(:,:,:)-frazil_diag(:,:,:))*rhoi/dt
endif
frzn = c0
frzs = c0
frzn = global_sum(work1, distrb_info, &
Expand Down
28 changes: 13 additions & 15 deletions cicecore/cicedyn/analysis/ice_history.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2134,11 +2134,10 @@ subroutine accum_hist (dt)
fcondtop, fcondbot, fsurfn, fcondtopn, flatn, fsensn, albcnt, snwcnt, &
stressp_1, stressm_1, stress12_1, &
stresspT, stressmT, stress12T, &
stressp_2, &
stressp_3, &
stressp_4, sig1, sig2, sigP, &
stressp_2, stressp_3, stressp_4, sig1, sig2, sigP, &
mlt_onset, frz_onset, dagedtt, dagedtd, fswint_ai, keffn_top, &
snowfrac, alvdr_ai, alvdf_ai, alidr_ai, alidf_ai, update_ocn_f
snowfrac, alvdr_ai, alvdf_ai, alidr_ai, alidf_ai, update_ocn_f, &
cpl_frazil
use ice_arrays_column, only: snowfracn, Cdn_atm
use ice_history_shared ! almost everything
use ice_history_write, only: ice_write_hist
Expand Down Expand Up @@ -3238,11 +3237,11 @@ subroutine accum_hist (dt)
if (aice(i,j,iblk) > puny) then
! Add in frazil flux
if (.not. update_ocn_f) then
if ( ktherm == 2) then
dfresh = -rhoi*(frazil(i,j,iblk)-frazil_diag(i,j,iblk))/dt
else
dfresh = -rhoi*frazil(i,j,iblk)/dt
endif
if ( ktherm == 2 .and. cpl_frazil == 'fresh_ice_correction') then
dfresh = -rhoi*(frazil(i,j,iblk)-frazil_diag(i,j,iblk))/dt
else
dfresh = -rhoi*frazil(i,j,iblk)/dt
endif
endif
if (saltflux_option == 'prognostic') then
sicen = c0
Expand All @@ -3266,14 +3265,13 @@ subroutine accum_hist (dt)
do j = jlo, jhi
do i = ilo, ihi
if (aice(i,j,iblk) > puny) then
! Add in frazil flux
! Add in frazil flux
if (.not. update_ocn_f) then
if ( ktherm == 2) then
dfresh = -rhoi*(frazil(i,j,iblk)-frazil_diag(i,j,iblk))/dt
else
dfresh = -rhoi*frazil(i,j,iblk)/dt
endif
if ( ktherm == 2 .and. cpl_frazil == 'fresh_ice_correction') then
dfresh = -rhoi*(frazil(i,j,iblk)-frazil_diag(i,j,iblk))/dt
else
dfresh = -rhoi*frazil(i,j,iblk)/dt
endif
endif
worka(i,j) = aice(i,j,iblk)*(fresh(i,j,iblk)+dfresh)
endif
Expand Down
6 changes: 4 additions & 2 deletions cicecore/cicedyn/general/ice_flux.F90
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,7 @@ module ice_flux
alvdf_init, & ! visible, diffuse (fraction)
alidf_init ! near-ir, diffuse (fraction)

real (kind=dbl_kind), &
dimension(:,:,:,:), allocatable, public :: &
real (kind=dbl_kind), dimension(:,:,:,:), allocatable, public :: &
albcnt ! counter for zenith angle

! out to ocean
Expand Down Expand Up @@ -270,6 +269,9 @@ module ice_flux
l_mpond_fresh ! if true, include freshwater feedback from meltponds
! when running in ice-ocean or coupled configuration

character (char_len), public :: &
cpl_frazil ! type of coupling for frazil ice, 'fresh_ice_correction','internal','external'

real (kind=dbl_kind), dimension (:,:,:,:), allocatable, public :: &
meltsn , & ! snow melt in category n (m)
melttn , & ! top melt in category n (m)
Expand Down
11 changes: 7 additions & 4 deletions cicecore/cicedyn/general/ice_init.F90
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ subroutine input_data
use ice_history_shared, only: hist_avg, history_dir, history_file, &
incond_dir, incond_file, version_name, &
history_precision, history_format, hist_time_axis
use ice_flux, only: update_ocn_f, l_mpond_fresh
use ice_flux, only: update_ocn_f, cpl_frazil, l_mpond_fresh
use ice_flux, only: default_season
use ice_flux_bgc, only: cpl_bgc
use ice_forcing, only: &
Expand Down Expand Up @@ -265,7 +265,7 @@ subroutine input_data
highfreq, natmiter, atmiter_conv, calc_dragio, &
ustar_min, emissivity, iceruf, iceruf_ocn, &
fbot_xfer_type, update_ocn_f, l_mpond_fresh, tfrz_option, &
saltflux_option,ice_ref_salinity, &
saltflux_option,ice_ref_salinity,cpl_frazil, &
oceanmixed_ice, restore_ice, restore_ocn, trestore, &
precip_units, default_season, wave_spec_type,nfreq, &
atm_data_type, ocn_data_type, bgc_data_type, fe_data_type, &
Expand Down Expand Up @@ -444,6 +444,7 @@ subroutine input_data
ktransport = 1 ! -1 = off, 1 = on
calc_Tsfc = .true. ! calculate surface temperature
update_ocn_f = .false. ! include fresh water and salt fluxes for frazil
cpl_frazil = 'fresh_ice_correction' ! type of coupling for frazil ice
ustar_min = 0.005 ! minimum friction velocity for ocean heat flux (m/s)
hi_min = p01 ! minimum ice thickness allowed (m)
iceruf = 0.0005_dbl_kind ! ice surface roughness at atmosphere interface (m)
Expand Down Expand Up @@ -1071,6 +1072,7 @@ subroutine input_data
call broadcast_scalar(natmiter, master_task)
call broadcast_scalar(atmiter_conv, master_task)
call broadcast_scalar(update_ocn_f, master_task)
call broadcast_scalar(cpl_frazil, master_task)
call broadcast_scalar(l_mpond_fresh, master_task)
call broadcast_scalar(ustar_min, master_task)
call broadcast_scalar(hi_min, master_task)
Expand Down Expand Up @@ -2125,6 +2127,7 @@ subroutine input_data
tmpstr2 = ' : frazil water/salt fluxes not included in ocean fluxes'
endif
write(nu_diag,1010) ' update_ocn_f = ', update_ocn_f,trim(tmpstr2)
write(nu_diag,1030) ' cpl_frazil = ', trim(cpl_frazil)
if (l_mpond_fresh .and. tr_pond_topo) then
tmpstr2 = ' : retain (topo) pond water until ponds drain'
else
Expand Down Expand Up @@ -2501,6 +2504,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, snw_ssp_table_in=snw_ssp_table, hi_min_in=hi_min, &
update_ocn_f_in=update_ocn_f, cpl_frazil_in=cpl_frazil, &
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 All @@ -2512,8 +2516,7 @@ subroutine input_data
floediam_in=floediam, hfrazilmin_in=hfrazilmin, Tliquidus_max_in=Tliquidus_max, &
aspect_rapid_mode_in=aspect_rapid_mode, dSdt_slow_mode_in=dSdt_slow_mode, &
phi_c_slow_mode_in=phi_c_slow_mode, phi_i_mushy_in=phi_i_mushy, conserv_check_in=conserv_check, &
wave_spec_type_in = wave_spec_type, &
wave_spec_in=wave_spec, nfreq_in=nfreq, &
wave_spec_type_in = wave_spec_type, wave_spec_in=wave_spec, nfreq_in=nfreq, &
tfrz_option_in=tfrz_option, kalg_in=kalg, fbot_xfer_type_in=fbot_xfer_type, &
saltflux_option_in=saltflux_option, ice_ref_salinity_in=ice_ref_salinity, &
Pstar_in=Pstar, Cstar_in=Cstar, iceruf_in=iceruf, iceruf_ocn_in=iceruf_ocn, calc_dragio_in=calc_dragio, &
Expand Down
3 changes: 1 addition & 2 deletions cicecore/cicedyn/general/ice_step_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ subroutine step_therm2 (dt, iblk)
use ice_calendar, only: yday
use ice_domain_size, only: ncat, nilyr, nslyr, nblyr, nfsd
use ice_flux, only: fresh, frain, fpond, frzmlt, frazil, frz_onset, &
update_ocn_f, fsalt, Tf, sss, salinz, fhocn, rside, fside, wlat, &
fsalt, Tf, sss, salinz, fhocn, rside, fside, wlat, &
meltl, frazil_diag
use ice_flux_bgc, only: flux_bio, faero_ocn, &
fiso_ocn, HDO_ocn, H2_16O_ocn, H2_18O_ocn
Expand Down Expand Up @@ -708,7 +708,6 @@ subroutine step_therm2 (dt, iblk)
fresh = fresh (i,j, iblk), &
fsalt = fsalt (i,j, iblk), &
fhocn = fhocn (i,j, iblk), &
update_ocn_f = update_ocn_f, &
bgrid = bgrid, &
cgrid = cgrid, &
igrid = igrid, &
Expand Down
2 changes: 1 addition & 1 deletion configuration/scripts/cice.settings
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ setenv ICE_COMMDIR mpi
if (${ICE_NTASKS} == 1) setenv ICE_COMMDIR serial

### Specialty code
setenv ICE_SNICARHC false # compile with big hardcoded snicar table
setenv ICE_SNICARHC true # compile with big hardcoded snicar table
Copy link
Contributor

Choose a reason for hiding this comment

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

What are the pros and cons of this change?
If users are not using dEdd and/or the snicar modifications, would they prefer that this be false? Would it make sense to leave it as false but document very clearly with snicar info that it is available?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The downside to turning this on is that it takes longer to build. I just did a quick test. With the big table on, it takes 6 minutes to build CICE vs 2 minutes with it off. Just one sample on cheyenne with intel.

We talked about this a while ago and thought we wanted the full table to be on by default for users in case they set dEdd_snicar_ad. But we could have it off by default, but well documented. Also, if it's off and a user picks the "snicar" settings, it will get turned on automatically. That's why happens in testing, it's off by default, but the snicar tests all turn it on and have it compiled in.

Another option would be to have it on by default and document that users can save time compiling by turning it off if they don't need it.

Don't have a strong feeling either way nor a good sense of how often the snicar option will be used.

Copy link
Contributor

Choose a reason for hiding this comment

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

if it's off and a user picks the "snicar" settings, it will get turned on automatically.

Then I guess I don't understand why we need to change it. Is it always turned on automatically, or is that feature particular to the testing scripts? Regardless, it ought to be clearly documented, if it isn't already so.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If a user sets up a case, then manually sets dEdd_snicar_ad in the namelist, then the run will abort at run time. It does provide a nice message, ' ERROR: USE_SNICARHC CPP required'. Again, I'm happy to have it off by default, but a while back, @eclare108213 requested that it be on by default. I've just been waiting for a chance to update it. :)

As currently implemented in this PR, it's ON by default. The scripts will turn if OFF if running a test or suite (not for a case). Then the snicar option turns it back ON. So, the behavior will be that a case will always have it on. Tests and suites will have it off except when it needs to be on for the snicar test (to speed up overall testing).

Prior to this implementation, default was OFF. It got turned on when running with -s snicar.

Users can also manually change ICE_SNICARHC in cice.settings to true/false to turn it ON/OFF.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe I'm going about this the wrong way. In Icepack, we need the "USE_SNICARNC" CPP to build the big table. Maybe what we need to do is have a CPP that turns off SNICARHC in Icepack? So the default in Icepack (without any CPPs) is that it's built. And a unique CPP turns that off. The point would be that users get the big table build unless they set a CPP to turn it off. Maybe that's what we need and how the default should be ON. Then we would keep the CICE behavior the same, off by default, on only if we need it. We would have to change the E3SM cpps though too. Thoughts?

setenv ICE_BLDDEBUG false # build debug flags
setenv ICE_COVERAGE false # build coverage flags

1 change: 1 addition & 0 deletions configuration/scripts/ice_in
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@
emissivity = 0.985
fbot_xfer_type = 'constant'
update_ocn_f = .false.
cpl_frazil = 'fresh_ice_correction'
l_mpond_fresh = .false.
tfrz_option = 'mushy'
saltflux_option = 'constant'
Expand Down
4 changes: 4 additions & 0 deletions configuration/scripts/tests/base_suite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ restart gx3 4x4 alt04
restart gx3 4x4 alt05
restart gx3 8x2 alt06
restart gx3 8x3 alt07
restart gx3 8x4 snicar
restart gx3 6x2 e3sm
restart gx3 8x3 saltflux
restart gx3 18x2 debug,maskhalo
restart gx3 6x2 alt01,debug,short
Expand All @@ -33,6 +35,8 @@ smoke gx3 4x4 alt04,debug,short
smoke gx3 4x4 alt05,debug,short
smoke gx3 8x2 alt06,debug,short
smoke gx3 8x3 alt07,debug,short
smoke gx3 8x4 snicar,debug,short
smoke gx3 6x2 e3sm,debug,short
smoke gx3 10x2 debug,diag1,run5day,gx3sep2
smoke gx3 7x2x5x29x12 diag1,bigdiag,run1day,debug
restart gbox128 4x2 short
Expand Down
Loading