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

Merge CICE-Consortium/Icepack main to E3SM-Project/Icepack main #35

Merged
merged 30 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
0aa2305
Add new picard nonconvergence messages (#464)
apcraig Oct 6, 2023
45da0b3
doc: mention code variables relating to 'calc_dragio' (#466)
phil-blain Oct 11, 2023
182030d
icepack_parameters: don't recompute constants in icepack_query_parame…
phil-blain Oct 12, 2023
aea58f3
Port to Perlmutter gnu, intel, cray. (#467)
apcraig Oct 13, 2023
f6989f1
Remove _old options for tfrz_option (#468)
apcraig Oct 13, 2023
0c54812
Change CPP USE_SNICARNC to NO_SNICARNC (#469)
apcraig Oct 16, 2023
863b19c
Update Derecho inputdata path, point to campaign (#471)
apcraig Oct 18, 2023
7a0d4e9
Clarify documentation associated with namelist inputs (#470)
apcraig Oct 18, 2023
6ad0f44
Update 5-band dEdd to support test data (#472)
apcraig Oct 27, 2023
71093e6
adjust denominator for flux limiting by -puny (fbot+fside<0) (#474)
eclare108213 Oct 27, 2023
84ff388
Update version, interface documentation, trailing blanks (#473)
apcraig Oct 27, 2023
d1a42fb
Fix icepack.launch.csh (#475)
apcraig Oct 28, 2023
b129416
correct ks units, clean up comments, bug fix for BL99 enthalpy calcul…
eclare108213 Nov 14, 2023
f6ff8f7
Update logical for optional argument wlat, caught with debug by gnu c…
apcraig Nov 17, 2023
3ffde67
Update pull request template, Update conda_macos debug flag (#484)
apcraig Mar 1, 2024
7e529b1
Add gnuplot to the conda environment (#483)
dabail10 Mar 1, 2024
74cc6f4
Add Tutorial to User Guide as Appendix (#485)
apcraig Apr 26, 2024
2fd2140
Update version to Icepack 1.4.1 (#486)
apcraig May 14, 2024
ae69b80
Update one more copyright date (#487)
apcraig May 14, 2024
083d6e3
Update gnuplot, improve titles and fonts (#490)
apcraig May 28, 2024
1a820b4
Update documentation for adding a tracer and the tutorial (#493)
apcraig Jul 29, 2024
92be122
Port to Casper (#496)
apcraig Aug 2, 2024
4c87095
Alternative congelation formulation following Plante et al. 2024 (#494)
eclare108213 Aug 7, 2024
05ac0ec
BGC update (#497)
apcraig Sep 15, 2024
ba0bc0b
Update Derecho Port (#501)
apcraig Sep 27, 2024
f5f03b9
Update Derecho Cray, rename subroutines, minor cleanup (#502)
apcraig Oct 17, 2024
6da5668
Add dorebin and docleanup optional arguments to icepack_step_ridge (#…
apcraig Oct 24, 2024
286630f
FSD fixes for conservation (#495)
dabail10 Oct 31, 2024
8c3f26a
Make dsnow and dsnown optional (#506)
dabail10 Nov 15, 2024
3792520
Update version number to 1.5.0 (#507)
apcraig Nov 15, 2024
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
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ please refer to: <https://github.com/CICE-Consortium/About-Us/wiki/Resource-Inde
- [ ] No, does the documentation need to be updated at a later time?
- [ ] Yes
- [ ] No
- [ ] Please provide any additional information or relevant details below:
- [ ] Please document the changes in detail, including _why_ the changes are made. This will become part of the PR commit log.
14 changes: 7 additions & 7 deletions columnphysics/icepack_itd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ subroutine rebin (ntrcr, trcr_depend, &

real (kind=dbl_kind), dimension(0:ncat), intent(in) :: &
hin_max ! category limits (m)

real (kind=dbl_kind), intent(in) :: &
Tf ! freezing temperature

Expand Down Expand Up @@ -785,11 +785,11 @@ subroutine cleanup_itd (dt, ntrcr, &
ntrcr , & ! number of tracers in use
nbtrcr, & ! number of bio tracers in use
n_aero ! number of aerosol tracers
real (kind=dbl_kind), intent(in) :: &
dt ! time step
real (kind=dbl_kind), intent(in) :: &

real (kind=dbl_kind), intent(in) :: &
dt ! time step

real (kind=dbl_kind), intent(in) :: &
Tf ! Freezing temperature

real (kind=dbl_kind), dimension(0:ncat), intent(in) :: &
Expand Down Expand Up @@ -1923,7 +1923,7 @@ subroutine icepack_aggregate (ncat, &
atrcr, aice, &
vice , vsno, &
trcr_base, n_trcr_strata, &
nt_strata, trcr, Tf)
nt_strata, trcr, Tf)
if (icepack_warnings_aborted(subname)) return

deallocate (atrcr)
Expand Down
3 changes: 1 addition & 2 deletions columnphysics/icepack_mechred.F90
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ module icepack_mechred
Gstar = p15 , & ! max value of G(h) that participates
! (krdg_partic = 0)
astar = p05 , & ! e-folding scale for G(h) participation
!echmod astar = p1 , & ! e-folding scale for G(h) participation
! (krdg_partic = 1)
maxraft= c1 , & ! max value of hrmin - hi = max thickness
! of ice that rafts (m)
Expand Down Expand Up @@ -401,7 +400,7 @@ subroutine ridge_ice (dt, ndtd, &
msnow_mlt, esnow_mlt, &
maero, miso, &
mpond, Tf, &
aredistn, vredistn)
aredistn, vredistn)
if (icepack_warnings_aborted(subname)) return

!-----------------------------------------------------------------
Expand Down
3 changes: 0 additions & 3 deletions columnphysics/icepack_parameters.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1799,9 +1799,6 @@ subroutine icepack_query_parameters( &
if (present(sw_frac_out) ) sw_frac_out = sw_frac
if (present(sw_dtemp_out) ) sw_dtemp_out = sw_dtemp

call icepack_recompute_constants()
if (icepack_warnings_aborted(subname)) return

end subroutine icepack_query_parameters

!=======================================================================
Expand Down
193 changes: 148 additions & 45 deletions columnphysics/icepack_shortwave.F90
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ module icepack_shortwave
use icepack_tracers, only: tr_zaero, nlt_chl_sw, nlt_zaero_sw
use icepack_tracers, only: n_algae, n_aero, n_zaero
use icepack_tracers, only: nmodal1, nmodal2, max_aero
use icepack_shortwave_data, only: nspint_3bd, nspint_5bd
use icepack_shortwave_data, only: nspint_3bd, nspint_5bd, rsnw_datatype
use icepack_zbgc_shared,only: R_chl2N, F_abs_chl
use icepack_zbgc_shared,only: remap_zbgc
use icepack_orbital, only: compute_coszen
Expand Down Expand Up @@ -101,9 +101,8 @@ module icepack_shortwave
gaer_5bd, kaer_5bd, waer_5bd
use icepack_shortwave_data, only: &
nmbrad_snicar , & ! number of snow grain radii in SNICAR SSP tables
rsnw_snicar_min, & ! minimum snow radius - integer value used for indexing
rsnw_snicar_max ! maximum snow radius - integer value used for indexing
use icepack_shortwave_data, only: &
rsnw_snicar_min, & ! minimum snow radius
rsnw_snicar_max, & ! maximum snow radius
ssp_snwextdr, ssp_snwalbdr, ssp_sasymmdr, &
ssp_snwextdf, ssp_snwalbdf, ssp_sasymmdf, &
rsnw_snicar_tab
Expand Down Expand Up @@ -1845,7 +1844,7 @@ subroutine compute_dEdd_3bd( &
delr , & ! snow grain radius interpolation parameter
! inherent optical properties (iop) for snow
Qs , & ! Snow extinction efficiency
ks , & ! Snow mass extinction coefficient (m^2/kg) ! echmod - CHECK units and usage
ks , & ! Snow mass extinction coefficient (1/m)
ws , & ! Snow single scattering albedo
gs ! Snow asymmetry parameter

Expand Down Expand Up @@ -2135,7 +2134,7 @@ subroutine compute_dEdd_3bd( &
! Cheng: note that aerosol IOPs are related to snow grain radius.
! CICE adjusted snow grain radius rsnw to frsnw in the original 3-band
! scheme, while for SNICAR the snow grain radius is used directly.
ksnow = k - min(k-1,0)
ksnow = max(k,1)
tmp_gs = frsnw(ksnow)

! grain size index
Expand Down Expand Up @@ -2268,7 +2267,7 @@ subroutine compute_dEdd_3bd( &

do k = 0, nslyr
! use top rsnw, rhosnw for snow ssl and rest of top layer
ksnow = k - min(k-1,0)
ksnow = max(k,1)
! find snow iops using input snow density and snow grain radius:
if (frsnw(ksnow) < rsnw_tab(1)) then
Qs = Qs_tab(ns,1)
Expand All @@ -2279,20 +2278,16 @@ subroutine compute_dEdd_3bd( &
ws = ws_tab(ns,nmbrad_snw)
gs = gs_tab(ns,nmbrad_snw)
else
! linear interpolation in rsnw
do nr = 2, nmbrad_snw
if (rsnw_tab(nr-1) <= frsnw(ksnow) .and. &
frsnw(ksnow) < rsnw_tab(nr)) then
delr = (frsnw(ksnow) - rsnw_tab(nr-1)) / &
(rsnw_tab(nr) - rsnw_tab(nr-1))
Qs = Qs_tab(ns,nr-1)*(c1-delr) + &
Qs_tab(ns,nr )* delr
ws = ws_tab(ns,nr-1)*(c1-delr) + &
ws_tab(ns,nr )* delr
gs = gs_tab(ns,nr-1)*(c1-delr) + &
gs_tab(ns,nr )* delr
endif
enddo ! nr
call shortwave_search(frsnw(ksnow),rsnw_tab,nr)
if (icepack_warnings_aborted(subname)) return
delr = (frsnw(ksnow) - rsnw_tab(nr-1)) / &
(rsnw_tab(nr) - rsnw_tab(nr-1))
Qs = Qs_tab(ns,nr-1)*(c1-delr) + &
Qs_tab(ns,nr )* delr
ws = ws_tab(ns,nr-1)*(c1-delr) + &
ws_tab(ns,nr )* delr
gs = gs_tab(ns,nr-1)*(c1-delr) + &
gs_tab(ns,nr )* delr
endif
ks = Qs*((rhosnw(ksnow)/rhoi)*3._dbl_kind / &
(4._dbl_kind*frsnw(ksnow)*1.0e-6_dbl_kind))
Expand Down Expand Up @@ -4513,7 +4508,7 @@ subroutine compute_dEdd_5bd( &
! copy/point to table data for local names
asm_prm_ice_drc => ssp_sasymmdr
asm_prm_ice_dfs => ssp_sasymmdf
ss_alb_ice_drc => ssp_snwalbdr
ss_alb_ice_drc => ssp_snwalbdr
ss_alb_ice_dfs => ssp_snwalbdf
ext_cff_mss_ice_drc => ssp_snwextdr
ext_cff_mss_ice_dfs => ssp_snwextdf
Expand Down Expand Up @@ -4677,7 +4672,7 @@ subroutine compute_dEdd_5bd( &
! CICE adjusted snow grain radius rsnw to frsnw, while for
! SNICAR there is no need, the tmp_gs is therefore calculated
! differently from code in subroutine compute_dEdd
ksnow = k - min(k-1,0)
ksnow = max(k,1)
tmp_gs = rsnw(ksnow) ! use rsnw not frsnw

! grain size index
Expand Down Expand Up @@ -4806,7 +4801,7 @@ subroutine compute_dEdd_5bd( &
if (nsky == 1) then ! direct incident
do k = 0, nslyr
! use top rsnw, rhosnw for snow ssl and rest of top layer
ksnow = k - min(k-1,0)
ksnow = max(k,1)
if (rsnw(ksnow) <= rsnw_snicar_min) then
ks = ext_cff_mss_ice_drc(ns,1)
ws = ss_alb_ice_drc (ns,1)
Expand All @@ -4815,16 +4810,18 @@ subroutine compute_dEdd_5bd( &
ks = ext_cff_mss_ice_drc(ns,nmbrad_snicar)
ws = ss_alb_ice_drc (ns,nmbrad_snicar)
gs = asm_prm_ice_drc (ns,nmbrad_snicar)
elseif (ceiling(rsnw(ksnow)) - rsnw(ksnow) < 1.0e-3_dbl_kind) then
! radius = 30 --> nr = 1 in SNICAR table ! NOTE
nr = ceiling(rsnw(ksnow)) - 30 + 1 ! hardwired min radius = 30
ks = ext_cff_mss_ice_drc(ns,nr)
ws = ss_alb_ice_drc (ns,nr)
gs = asm_prm_ice_drc (ns,nr)
else ! linear interpolation in rsnw
nr = ceiling(rsnw(ksnow)) - 30 + 1 ! hardwired min radius = 30
delr = (rsnw(ksnow) - floor(rsnw(ksnow))) & ! hardwired delta radius = 1 in table
/ (ceiling(rsnw(ksnow)) - floor(rsnw(ksnow))) ! denom always = 1
else
! linear interpolation
if (trim(rsnw_datatype) == 'sorted_idelta1') then
! NOTE: Assumes delta rsnw_snicar_tab is 1 and rsnw_snicar_tab are integers
! This is just for performance, could call shortwave_search
nr = ceiling(rsnw(ksnow)) - nint(rsnw_snicar_min) + 1
else
call shortwave_search(rsnw(ksnow),rsnw_snicar_tab,nr)
if (icepack_warnings_aborted(subname)) return
endif
delr = (rsnw(ksnow) - rsnw_snicar_tab(nr-1)) &
/ (rsnw_snicar_tab(nr) - rsnw_snicar_tab(nr-1))
ks = ext_cff_mss_ice_drc(ns,nr-1)*(c1-delr) &
+ ext_cff_mss_ice_drc(ns,nr )* delr
ws = ss_alb_ice_drc (ns,nr-1)*(c1-delr) &
Expand All @@ -4839,7 +4836,7 @@ subroutine compute_dEdd_5bd( &
elseif (nsky == 2) then ! diffuse incident
do k = 0, nslyr
! use top rsnw, rhosnw for snow ssl and rest of top layer
ksnow = k - min(k-1,0)
ksnow = max(k,1)
if (rsnw(ksnow) < rsnw_snicar_min) then
ks = ext_cff_mss_ice_dfs(ns,1)
ws = ss_alb_ice_dfs (ns,1)
Expand All @@ -4848,16 +4845,18 @@ subroutine compute_dEdd_5bd( &
ks = ext_cff_mss_ice_dfs(ns,nmbrad_snicar)
ws = ss_alb_ice_dfs (ns,nmbrad_snicar)
gs = asm_prm_ice_dfs (ns,nmbrad_snicar)
elseif (ceiling(rsnw(ksnow)) - rsnw(ksnow) < 1.0e-3_dbl_kind) then
! radius = 30 --> nr = 1 in SNICAR table ! NOTE
nr = ceiling(rsnw(ksnow)) - 30 + 1 ! hardwired min radius = 30
ks = ext_cff_mss_ice_dfs(ns,nr)
ws = ss_alb_ice_dfs (ns,nr)
gs = asm_prm_ice_dfs (ns,nr)
else ! linear interpolation in rsnw
nr = ceiling(rsnw(ksnow)) - 30 + 1 ! hardwired min radius = 30
delr = (rsnw(ksnow) - floor(rsnw(ksnow))) & ! hardwired delta radius = 1 in table
/ (ceiling(rsnw(ksnow)) - floor(rsnw(ksnow)))
else
! linear interpolation
if (trim(rsnw_datatype) == 'sorted_idelta1') then
! NOTE: delta rsnw_snicar_tab is 1 and rsnw_snicar_tab are integers
! This is just for performance, could call shortwave_search
nr = ceiling(rsnw(ksnow)) - nint(rsnw_snicar_min) + 1
else
call shortwave_search(rsnw(ksnow),rsnw_snicar_tab,nr)
if (icepack_warnings_aborted(subname)) return
endif
delr = (rsnw(ksnow) - rsnw_snicar_tab(nr-1)) &
/ (rsnw_snicar_tab(nr) - rsnw_snicar_tab(nr-1))
ks = ext_cff_mss_ice_dfs(ns,nr-1)*(c1-delr) &
+ ext_cff_mss_ice_dfs(ns,nr )* delr
ws = ss_alb_ice_dfs (ns,nr-1)*(c1-delr) &
Expand Down Expand Up @@ -5400,6 +5399,110 @@ subroutine compute_dEdd_5bd( &

end subroutine compute_dEdd_5bd

!=======================================================================
! This subroutine searches array for val and returns nr such that
! array(nr-1) < val <= array(nr)
! If nr cannot be found, an error is thrown
! This does NOT check that array is sorted because it would be too expensive,
! but it must be sorted to work properly.

subroutine shortwave_search(val,array,nr)

real (kind=dbl_kind), intent(in) :: &
val ! search value

real (kind=dbl_kind), dimension (:), intent(in) :: &
array ! sorted array

integer (kind=int_kind), intent(out) :: &
nr ! index in array >= val

! local variables

integer (kind=int_kind) :: &
nrcnt, & ! counter
nrp, & ! prior nr
nrl, nru, & ! lower and upper search indices
nrsize ! size of array

logical (kind=log_kind) :: &
found ! search flag

character (len=512) :: &
tmpstr ! temporary string

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


if (rsnw_datatype(1:6) /= 'sorted') then
call icepack_warnings_add(subname//' rsnw_datatype not valid: '//trim(rsnw_datatype))
call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
endif

nrsize = size(array)

!debug write(tmpstr,*) "val = ",val
! call icepack_warnings_add(subname//trim(tmpstr))
! write(tmpstr,*) "nrsize = ",nrsize
! call icepack_warnings_add(subname//trim(tmpstr))
! write(tmpstr,*) "array1 = ",array(1)
! call icepack_warnings_add(subname//trim(tmpstr))
! write(tmpstr,*) "arrayn = ",array(nrsize)
! call icepack_warnings_add(subname//trim(tmpstr))

if (nrsize > 10) then
! binary search
nrl = 1
nru = nrsize
nr = (nrl + nru) / 2
found = .false.
nrcnt = 0
do while (.not.found .and. nrcnt < nrsize)
nrcnt = nrcnt + 1
nrp = nr
if (val > array(nr)) then
if (val < array(nr+1)) then
found = .true.
nr = nr + 1
else
nrl = nr + 1
nr = (nrl + nru) / 2
endif
else
if (val > array(nr-1)) then
found = .true.
else
nru = nr - 1
nr = (nrl + nru) / 2
endif
endif
!debug write(tmpstr,*) "iter = ",nrcnt,nrp,nr
! call icepack_warnings_add(subname//trim(tmpstr))
! call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
enddo
if (.not. found) then
call icepack_warnings_add(subname//' ERROR: binary search failed')
call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
return
endif
else
! linear search
nr = -1
do nrcnt = 2,nrsize
if (val > array(nrcnt-1) .and. val < array(nrcnt)) then
nr = nrcnt
exit
endif
enddo
if (nr < 1) then
call icepack_warnings_add(subname//' ERROR: linear search failed')
call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
return
endif
endif

end subroutine shortwave_search

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

end module icepack_shortwave
Expand Down
Loading
Loading