Skip to content

Commit

Permalink
Merge E3SM Icepack cice-consortium/E3SM-icepack-initial-integration t…
Browse files Browse the repository at this point in the history
…o Consortium (CICE-Consortium#460)

* initial implementation of SNICAR-AD in Icepack, not tested but BFB in standard dEdd config

* adding use_snicar flag (true if shortwave=dEdd_snicar)

* initializing use_snicar based on shortwave namelist value

* adding a few more arguments to the calling tree

* remove repeat ridging warnings for niter=1

* use 5-band wghtns for snicar

* basic initialization for snicar tables

* clean up trailing blanks

* interim commit with some snicar initialization, unconnected and not tested

* Add data_dEdd_3band to icepack_init_radiation
Add calls to icepack_init_radiation to icepack driver

* Add ability to set SNICAR SSP data via icepack_parameters
Add some SNICAR SSP table checks, aborts, etc

* Add reading of SNICAR SSP file in Icepack driver including
new namelist variables and options.

Add new namelist to icepack_in.  Add snicar and snicartest
options.

Minor updates to namelist output

* rebase, update, and test

* Update ssp output

* Reorder SNICAR SSP test data arrays to be consistent with source code

* move 5band data to subroutine; enable snicar testing on 1 no-ice grid cell

* move more data to 3- and 5-band initialization routines, use module data for use_snicar

* change snicar coefficient names and use module data for them

* cleaning up argument lists

* Add additional SNICAR SSP fields

* set tmask=0 only for land cell

* interim compute_dEdd_5bd subroutine (runs)

* separate 3-band and 5-band compute_dEdd routines

* Fix errors in calls to compute_dEdd. Some cleanup.

* Remove duplicate Iabs calculation. More cleanup.

* - Add icepack_shortwave_data
- Move shortwave data from icepack_parameters and icepack_shortwave
  to icepack_shortwave_data, icepack_shortwave_data is lower
  in file hierarchy than icepack_parameters.
- Add 3band and 5band dEdd table initialization to icepack_shortwave_data
- snw_ssp_table options now test, snicar, snicarfile, file.
  snicarfile should be identical to snicar, one reads file
  and passes data in, other hardcodes snicar table in icepack

* - Add USE_SNICARHC (snicar ssp hard coded tables) to reduce compile time
when they're not needed
- Add ability to reuse icepack binary in test suites to reduce time to test.
Uses mp5sum of modified icepack.settings file to establish same binary.

* - Remove ssp_bcerad, ssp_bcgrerad from implementation
- Add snicar_suite

* remove trailing blanks

* Cleanup icepack_shortwave_data

- Rename variables to gaer/kaer/waer/bcenh for 3 and 5 band
- Add 3 band gaer/kaer/waer/bcenh data
- Eliminate ability to pass SSP SNICAR data in thru icepack_parameters
- Remove nmodal1, nmodal2, max_aero redundant definitions, use values in icepack_tracers
- Change module hierarchy, icepack_parameters now "under" icepack_shortwave_data
- Rename nmbrad in icepack_shortwave_data to nmbrad_snw

* update test suite and icepack_in

* update scripts if md5sum not available

* Clean up shortwave data variable names

* Clean up icepack_shortwave

- Remove modal_aero, dEdd_algae, and heat_capacity from icepack_shortwave arguments,
  use directly from icepack_parameters
- Modify fswthrun_ optional argument implementation
- Modify rsnow optional argument implementation
- Change days_per_year, nextsw_cday, and calendar_type to optional arguments in
  icepack_step_radiation and down the calling tree
- Fix some indentation

* - Remove ncat, nilyr, nslyr, nblyr from interface arguments
- More indentation adjustments

* Update implementation of g(k), w0(k) in icepack_shortwave

- consistent with MPAS-Dev/MPAS-Model@b76b6830
- Rename the dEdd_snicar option to dEdd_snicar_ad

* Get rid of use_snicar flag, redundant with shortwave setting

* update documentation

* updating documentation

* use module data rather than hardcoded rhoi

* cleanup

* update namelist and settings documentation

* make icepack_warnings_getall public, snw_ssp_table=unknown, update user guide

* add icepack_warnings_getall to interface module

* Major cleanup of dEdd module, mainly white space and standard alignments. Also changes in precision for several constants in compute_dEdd_5bd and compute_dEdd_3bd, which might change answers in some configurations.  Added new fswthru diagnostics for 5bd (not tested).  Flagged rnilyr reciprocal bug and another bug in the 5-band interpolation, to be fixed separately.

* bug fixes for ice/snow layer reciprocal, missing lines as in consortium icepack PR#400; bug fix for 5-band interpolation weights

* mpassi options files

* remove namelist entries that are the same as the defaults to avoid potential ambiguity later

* Minor updates consistent with E3SM columnphysics modifications

- Migrate hi_min to namelist+parameters and refactor implementation
- Reduce CESMCOUPLED CPP use, now just for orbital stuff, punch list 23
- Modify initialization of hin_max, punch list 28
- Fix possible divide by zero, punch list 65
- Rename icepack shr_orb_params and shr_orb_decl to icepack_orb_params, icepack_orb_decl
- Cleanup argument list for compute_ponds_lvl, compute_ponds_cesm

* Update spacing and documentation

* First step in adding Tf

* Fix some spacing and logic

* Fix some documentation

* Fix documentation formatting

* namelist parameter to set maximum liquidus temperature

* Modifications for bit-for-bit with current main in CICE

- Add "_old" tfrz_options to recover bit-for-bit for some cases
- Move hi_min namelist from forcing_nml to tracer_nml

* Remove redundancy in public declaration

* recover main bit-for-bit

* update tfrz_option

* clean up merge

* bring some mushy functions into icepack interface

* elevate snow/mush enthalpy and salinity profile to interface

* Update documentation

* Update documentation

---------

Co-authored-by: Elizabeth Hunke <[email protected]>
Co-authored-by: David Bailey <[email protected]>
  • Loading branch information
3 people authored Oct 4, 2023
1 parent 390fb55 commit 8fad768
Show file tree
Hide file tree
Showing 51 changed files with 12,681 additions and 1,732 deletions.
70 changes: 35 additions & 35 deletions columnphysics/icepack_brine.F90
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ subroutine preflushing_changes (aicen, vicen, vsnon, &
hbr_old, hin,hsn, firstice )

real (kind=dbl_kind), intent(in) :: &
aicen , & ! concentration of ice
vicen , & ! volume per unit area of ice (m)
vsnon , & ! volume per unit area of snow (m)
meltb , & ! bottom ice melt (m)
meltt , & ! top ice melt (m)
congel , & ! bottom ice growth (m)
snoice ! top ice growth from flooding (m)
aicen , & ! concentration of ice
vicen , & ! volume per unit area of ice (m)
vsnon , & ! volume per unit area of snow (m)
meltb , & ! bottom ice melt (m)
meltt , & ! top ice melt (m)
congel , & ! bottom ice growth (m)
snoice ! top ice growth from flooding (m)

real (kind=dbl_kind), intent(out) :: &
hbr_old ! old brine height (m)
Expand Down Expand Up @@ -150,13 +150,13 @@ subroutine compute_microS_mushy (nilyr, nblyr, &
nblyr ! number of bio layers

real (kind=dbl_kind), dimension (nblyr+2), intent(in) :: &
bgrid ! biology nondimensional vertical grid points
bgrid ! biology nondimensional vertical grid points

real (kind=dbl_kind), dimension (nblyr+1), intent(in) :: &
igrid ! biology vertical interface points
igrid ! biology vertical interface points

real (kind=dbl_kind), dimension (nilyr+1), intent(in) :: &
cgrid ! CICE vertical coordinate
cgrid ! CICE vertical coordinate

real (kind=dbl_kind), intent(in) :: &
hice_old , & ! previous timestep ice height (m)
Expand All @@ -171,10 +171,10 @@ subroutine compute_microS_mushy (nilyr, nblyr, &
bphi_min ! surface porosity

real (kind=dbl_kind), intent(inout) :: &
hbr_old ! previous timestep brine height (m)
hbr_old ! previous timestep brine height (m)

real (kind=dbl_kind), dimension (nblyr+1), intent(inout) :: &
iDin ! tracer diffusivity/h^2 (1/s) includes gravity drainage/molecular
iDin ! tracer diffusivity/h^2 (1/s) includes gravity drainage/molecular

real (kind=dbl_kind), dimension (nblyr+1), intent(inout) :: &
iphin , & ! porosity on the igrid
Expand All @@ -183,7 +183,7 @@ subroutine compute_microS_mushy (nilyr, nblyr, &
iTin ! Temperature on the igrid (oC)

real (kind=dbl_kind), dimension (nblyr+2), intent(inout) :: &
bSin , & ! bulk salinity (ppt) on bgrid
bSin , & ! bulk salinity (ppt) on bgrid
brine_sal , & ! equilibrium brine salinity (ppt)
brine_rho ! internal brine density (kg/m^3)

Expand Down Expand Up @@ -285,7 +285,7 @@ subroutine compute_microS_mushy (nilyr, nblyr, &

do k= 2, nblyr+1
ikin(k) = k_o*iphin(k)**exp_h
iDin(k) = iphin(k)*Dm/hbr_old**2
if (hbr_old .GT. puny) iDin(k) = iphin(k)*Dm/hbr_old**2
if (hbr_old .GE. Ra_c) &
iDin(k) = iDin(k) &
+ l_sk*ikin(k)*gravit/viscos_dynamic*drho(k)/hbr_old**2
Expand All @@ -304,12 +304,12 @@ subroutine prepare_hbrine (nblyr, &
i_grid, sss)

integer (kind=int_kind), intent(in) :: &
nblyr ! number of bio layers
nblyr ! number of bio layers

real (kind=dbl_kind), dimension (:), intent(in) :: &
bSin , & ! salinity of ice layers on bio grid (ppt)
bTin , & ! temperature of ice layers on bio grid for history (C)
i_grid ! biology grid interface points
bSin , & ! salinity of ice layers on bio grid (ppt)
bTin , & ! temperature of ice layers on bio grid for history (C)
i_grid ! biology grid interface points

real (kind=dbl_kind), dimension (:), intent(inout) :: &
brine_sal , & ! equilibrium brine salinity (ppt)
Expand All @@ -333,14 +333,14 @@ subroutine prepare_hbrine (nblyr, &
! local variables

real (kind=dbl_kind), dimension(nblyr+1) :: &
kin ! permeability
kin ! permeability

real (kind=dbl_kind) :: &
k_min, ktemp, &
igrp, igrm, rigr ! grid finite differences

integer (kind=int_kind) :: &
k ! layer index
k ! layer index

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

Expand Down Expand Up @@ -470,7 +470,7 @@ subroutine update_hbrine (meltt, &
! local variables

real (kind=dbl_kind) :: &
hbrmin , & ! thinS or hin
hbrmin , & ! thinS or hin
dhbr_hin , & ! hbr-hin
hbrocn , & ! brine height above sea level (m) hbr-h_ocn
dhbr , & ! change in brine surface
Expand Down Expand Up @@ -565,22 +565,22 @@ subroutine calculate_drho (nblyr, i_grid, b_grid, &
brine_rho, ibrine_rho, drho)

integer (kind=int_kind), intent(in) :: &
nblyr ! number of bio layers
nblyr ! number of bio layers

real (kind=dbl_kind), dimension (nblyr+2), intent(in) :: &
b_grid ! biology nondimensional grid layer points
b_grid ! biology nondimensional grid layer points

real (kind=dbl_kind), dimension (nblyr+1), intent(in) :: &
i_grid ! biology grid interface points
i_grid ! biology grid interface points

real (kind=dbl_kind), dimension (nblyr+2), intent(in) :: &
brine_rho ! Internal brine density (kg/m^3)
brine_rho ! Internal brine density (kg/m^3)

real (kind=dbl_kind), dimension (nblyr + 1), intent(in) :: &
ibrine_rho ! Internal brine density (kg/m^3)
ibrine_rho ! Internal brine density (kg/m^3)

real (kind=dbl_kind), dimension (nblyr+1), intent(out) :: &
drho ! brine difference about grid point (kg/m^3)
drho ! brine difference about grid point (kg/m^3)

! local variables

Expand Down Expand Up @@ -679,7 +679,7 @@ subroutine icepack_init_hbrine(bgrid, igrid, cgrid, &
nblyr ! number of bio layers

real (kind=dbl_kind), intent(inout) :: &
phi_snow !porosity at the ice-snow interface
phi_snow ! porosity at the ice-snow interface

real (kind=dbl_kind), dimension (nblyr+2), intent(out) :: &
bgrid ! biology nondimensional vertical grid points
Expand All @@ -688,9 +688,9 @@ subroutine icepack_init_hbrine(bgrid, igrid, cgrid, &
igrid ! biology vertical interface points

real (kind=dbl_kind), dimension (nilyr+1), intent(out) :: &
cgrid , & ! CICE vertical coordinate
icgrid , & ! interface grid for CICE (shortwave variable)
swgrid ! grid for ice tracers used in dEdd scheme
cgrid , & ! CICE vertical coordinate
icgrid , & ! interface grid for CICE (shortwave variable)
swgrid ! grid for ice tracers used in dEdd scheme

!autodocument_end

Expand Down Expand Up @@ -772,10 +772,10 @@ subroutine icepack_init_zsalinity(nblyr,ntrcr_o, Rayleigh_criteria, &
Rayleigh_real, trcrn_bgc, nt_bgc_S, ncat, sss)

integer (kind=int_kind), intent(in) :: &
nblyr, & ! number of biolayers
nblyr , & ! number of biolayers
ntrcr_o, & ! number of non bio tracers
ncat , & ! number of categories
nt_bgc_S ! zsalinity index
ncat , & ! number of categories
nt_bgc_S ! zsalinity index

logical (kind=log_kind), intent(inout) :: &
Rayleigh_criteria
Expand All @@ -787,7 +787,7 @@ subroutine icepack_init_zsalinity(nblyr,ntrcr_o, Rayleigh_criteria, &
sss

real (kind=dbl_kind), dimension(:,:), intent(inout):: &
trcrn_bgc ! bgc subset of trcrn
trcrn_bgc ! bgc subset of trcrn

!autodocument_end

Expand Down
12 changes: 9 additions & 3 deletions columnphysics/icepack_intfc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@ module icepack_intfc
use icepack_tracers, only: icepack_max_iso => max_iso
use icepack_tracers, only: icepack_nmodal1 => nmodal1
use icepack_tracers, only: icepack_nmodal2 => nmodal2
use icepack_parameters, only: icepack_nspint => nspint

use icepack_shortwave_data, only: icepack_nspint_3bd => nspint_3bd
use icepack_shortwave_data, only: icepack_nspint_5bd => nspint_5bd

use icepack_parameters, only: icepack_init_parameters
use icepack_parameters, only: icepack_query_parameters
use icepack_parameters, only: icepack_write_parameters
use icepack_parameters, only: icepack_recompute_constants
use icepack_parameters, only: nspint, secday, spval_const
use icepack_parameters, only: secday, spval_const
use icepack_parameters, only: c0, c1, c1p5, c2, c3, c4, c5, c6, c8
use icepack_parameters, only: c10, c15, c16, c20, c25, c100, c1000
use icepack_parameters, only: p001, p01, p1, p2, p4, p5, p6, p05
Expand Down Expand Up @@ -85,6 +87,7 @@ module icepack_intfc
use icepack_snow, only: icepack_init_snow
use icepack_snow, only: icepack_step_snow

use icepack_shortwave, only: icepack_init_radiation
use icepack_shortwave, only: icepack_prep_radiation
use icepack_shortwave, only: icepack_step_radiation

Expand All @@ -109,10 +112,12 @@ module icepack_intfc
use icepack_therm_shared , only: icepack_snow_temperature
use icepack_therm_shared , only: icepack_liquidus_temperature
use icepack_therm_shared , only: icepack_sea_freezing_temperature
use icepack_therm_shared , only: icepack_enthalpy_snow
use icepack_therm_shared , only: icepack_init_thermo
use icepack_therm_shared , only: icepack_salinity_profile
use icepack_therm_shared , only: icepack_init_trcr

use icepack_mushy_physics , only: icepack_enthalpy_snow
use icepack_mushy_physics , only: icepack_enthalpy_mush
use icepack_mushy_physics , only: icepack_mushy_density_brine
use icepack_mushy_physics , only: icepack_mushy_liquid_fraction
use icepack_mushy_physics , only: icepack_mushy_temperature_mush
Expand All @@ -121,6 +126,7 @@ module icepack_intfc
use icepack_warnings, only: icepack_warnings_print
use icepack_warnings, only: icepack_warnings_flush
use icepack_warnings, only: icepack_warnings_aborted
use icepack_warnings, only: icepack_warnings_getall

!autodocument_end icepack_intfc.F90

Expand Down
Loading

0 comments on commit 8fad768

Please sign in to comment.