-
Notifications
You must be signed in to change notification settings - Fork 0
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 implementation of g(k), w0(k) in icepack_shortwave #13
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,7 +54,7 @@ module icepack_shortwave | |
use icepack_parameters, only: z_tracers, skl_bgc, calc_tsfc, shortwave, kalg | ||
use icepack_parameters, only: R_ice, R_pnd, R_snw, dT_mlt, rsnw_mlt, hs0, hs1, hp1 | ||
use icepack_parameters, only: pndaspect, albedo_type, albicev, albicei, albsnowv, albsnowi, ahmax | ||
use icepack_parameters, only: snw_ssp_table, use_snicar, modal_aero | ||
use icepack_parameters, only: snw_ssp_table, modal_aero | ||
use icepack_parameters, only: dEdd_algae | ||
|
||
use icepack_tracers, only: ncat, nilyr, nslyr, nblyr | ||
|
@@ -173,7 +173,7 @@ subroutine icepack_init_radiation() | |
if (icepack_warnings_aborted(subname)) return | ||
endif | ||
|
||
if (use_snicar) then | ||
if (trim(shortwave) == 'dEdd_snicar_ad') then | ||
call icepack_shortwave_init_dEdd5band() | ||
if (icepack_warnings_aborted(subname)) return | ||
|
||
|
@@ -1507,7 +1507,7 @@ subroutine shortwave_dEdd (coszen, & | |
! calculate snow covered sea ice | ||
|
||
srftyp = 1 | ||
if (use_snicar) then | ||
if (trim(shortwave) == 'dEdd_snicar_ad') then | ||
call compute_dEdd_5bd(klev, klevp, & | ||
zbio, & | ||
fnidr, coszen, & | ||
|
@@ -2362,12 +2362,10 @@ subroutine compute_dEdd_3bd( & | |
! aerosol in snow | ||
if (tr_zaero .and. dEdd_algae) then | ||
do k = 0,nslyr | ||
gzaer(ns,k) = gzaer(ns,k)/(wzaer(ns,k)+puny) | ||
wzaer(ns,k) = wzaer(ns,k)/(tzaer(ns,k)+puny) | ||
g (k) = (g (k)*w0(k)*tau(k) + gzaer(ns,k)*wzaer(ns,k)*tzaer(ns,k)) & | ||
/ (w0(k)*tau(k) + wzaer(ns,k)*tzaer(ns,k)) | ||
w0 (k) = ( w0(k)*tau(k) + wzaer(ns,k)*tzaer(ns,k)) & | ||
/ ( tau(k) + tzaer(ns,k)) | ||
g(k) = (g(k)*w0(k)*tau(k) + gzaer(ns,k)) / & | ||
(w0(k)*tau(k) + wzaer(ns,k)) | ||
w0(k) = (w0(k)*tau(k) + wzaer(ns,k)) / & | ||
(tau(k) + tzaer(ns,k)) | ||
tau(k) = tau(k) + tzaer(ns,k) | ||
enddo | ||
elseif (tr_aero) then | ||
|
@@ -2413,6 +2411,8 @@ subroutine compute_dEdd_3bd( & | |
gaer = gaer/(waer+puny) | ||
waer = waer/(taer+puny) | ||
|
||
! tcraig, why does the above section exist if taer=waer=gaer=0 below | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good question! It's possible that this code is left over from my trying to combine the 3-band and 5-band routines. If this module is diff'ed with the original icepack_shortwave.F90 in the latest release, does one of the duplicate code sections show up as an addition? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same coding does seem to also be in the Icepack main. See https://github.com/CICE-Consortium/Icepack/blob/main/columnphysics/icepack_shortwave.F90#L2657 which has exactly the same situation. So I think it's also in the current code. One thing to remember is that I don't think we've been testing the modal aerosols at all because they don't work in CICE and the Icepack driver doesn't seem to have all the required options to do those tests either. So we have no baseline to test against and haven't been exercising that part of the code. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It also appears in MPAS-SI in both compute_dEdd (3-band) and compute_dEdd_5bd: https://github.com/E3SM-Project/E3SM/blob/851fbfbbbdc13915de772519944bc44b4644dfb7/components/mpas-seaice/src/column/ice_shortwave.F90#L4854 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Apparently this issue entered the code in 2015, in https://github.com/E3SM-Project/CICE-archive/commit/6e8e276fce7eb35338d21d708397cad62ae59d1d# (or maybe another branch feeding this one). !mgf seems to be Mark Flanner; Hailong Wang is also referenced in the commit message -- this code seems to have come via HiLAT. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, it looks like setting of g(k), w0(k), and tau(k) is missing after that code block. But I don't really know for sure. As we move forward, we should take extra time to add test cases and validate the varied combination of options associated with aerosols, snicar, and bgc. Especially as we add an updated implementation of bgc. |
||
|
||
do k=1,nslyr | ||
taer = c0 | ||
waer = c0 | ||
|
@@ -2462,12 +2462,10 @@ subroutine compute_dEdd_3bd( & | |
waer_3bd(ns,(1+(na-1)/4))*gaer_3bd(ns,(1+(na-1)/4)) | ||
endif ! modal_aero | ||
enddo ! na | ||
gaer = gaer/(waer+puny) | ||
waer = waer/(taer+puny) | ||
g(k) = (g(k)*w0(k)*tau(k) + gaer*waer*taer) / & | ||
(w0(k)*tau(k) + waer*taer) | ||
w0(k) = (w0(k)*tau(k) + waer*taer) / & | ||
(tau(k) + taer) | ||
g(k) = (g(k)*w0(k)*tau(k) + gaer) / & | ||
(w0(k)*tau(k) + waer) | ||
w0(k) = (w0(k)*tau(k) + waer) / & | ||
(tau(k) + taer) | ||
tau(k) = tau(k) + taer | ||
enddo ! k | ||
endif ! tr_aero | ||
|
@@ -2523,12 +2521,10 @@ subroutine compute_dEdd_3bd( & | |
! aerosol in sea ice | ||
if (tr_zaero .and. dEdd_algae) then | ||
do k = kii, klev | ||
gzaer(ns,k) = gzaer(ns,k)/(wzaer(ns,k)+puny) | ||
wzaer(ns,k) = wzaer(ns,k)/(tzaer(ns,k)+puny) | ||
g(k) = (g(k)*w0(k)*tau(k) + gzaer(ns,k)*wzaer(ns,k)*tzaer(ns,k)) & | ||
/ (w0(k)*tau(k) + wzaer(ns,k)*tzaer(ns,k)) | ||
w0(k) = (w0(k)*tau(k) + wzaer(ns,k)*tzaer(ns,k)) & | ||
/ (tau(k) + tzaer(ns,k)) | ||
g(k) = (g(k)*w0(k)*tau(k) + gzaer(ns,k)) / & | ||
(w0(k)*tau(k) + wzaer(ns,k)) | ||
w0(k) = (w0(k)*tau(k) + wzaer(ns,k)) / & | ||
(tau(k) + tzaer(ns,k)) | ||
tau(k) = tau(k) + tzaer(ns,k) | ||
enddo | ||
elseif (tr_aero) then | ||
|
@@ -2579,12 +2575,10 @@ subroutine compute_dEdd_3bd( & | |
endif ! modal_aero | ||
enddo ! na | ||
|
||
gaer = gaer/(waer+puny) | ||
waer = waer/(taer+puny) | ||
g(k) = (g(k)*w0(k)*tau(k) + gaer*waer*taer) / & | ||
(w0(k)*tau(k) + waer*taer) | ||
w0(k) = (w0(k)*tau(k) + waer*taer) / & | ||
(tau(k) + taer) | ||
g(k) = (g(k)*w0(k)*tau(k) + gaer) / & | ||
(w0(k)*tau(k) + waer) | ||
w0(k) = (w0(k)*tau(k) + waer) / & | ||
(tau(k) + taer) | ||
tau(k) = tau(k) + taer | ||
do k = kii+1, klev | ||
taer = c0 | ||
|
@@ -2632,12 +2626,10 @@ subroutine compute_dEdd_3bd( & | |
waer_3bd(ns,(1+(na-1)/4))*gaer_3bd(ns,(1+(na-1)/4)) | ||
endif ! modal_aero | ||
enddo ! na | ||
gaer = gaer/(waer+puny) | ||
waer = waer/(taer+puny) | ||
g(k) = (g(k)*w0(k)*tau(k) + gaer*waer*taer) / & | ||
(w0(k)*tau(k) + waer*taer) | ||
w0(k) = (w0(k)*tau(k) + waer*taer) / & | ||
(tau(k) + taer) | ||
g(k) = (g(k)*w0(k)*tau(k) + gaer) / & | ||
(w0(k)*tau(k) + waer) | ||
w0(k) = (w0(k)*tau(k) + waer) / & | ||
(tau(k) + taer) | ||
tau(k) = tau(k) + taer | ||
enddo ! k | ||
endif ! tr_aero | ||
|
@@ -4969,9 +4961,9 @@ subroutine compute_dEdd_5bd (klev, klevp, & | |
if (tr_zaero .and. dEdd_algae) then | ||
do k = 0,nslyr | ||
g(k) = (g(k)*w0(k)*tau(k) + gzaer_5bd(ns,k)) / & | ||
(w0(k)*tau(k) + wzaer_5bd(ns,k)) | ||
w0(k) = (w0(k)*tau(k) + wzaer_5bd(ns,k)) / & | ||
(tau(k) + tzaer_5bd(ns,k)) | ||
(w0(k)*tau(k) + wzaer_5bd(ns,k)) | ||
w0(k) = (w0(k)*tau(k) + wzaer_5bd(ns,k)) / & | ||
(tau(k) + tzaer_5bd(ns,k)) | ||
tau(k) = tau(k) + tzaer_5bd(ns,k) | ||
enddo | ||
elseif (tr_aero) then | ||
|
@@ -5030,6 +5022,8 @@ subroutine compute_dEdd_5bd (klev, klevp, & | |
gaer = gaer/(waer+puny) | ||
waer = waer/(taer+puny) | ||
|
||
! tcraig, again why does the above exist if taer=waer=gaer=0 below | ||
|
||
do k=1,nslyr | ||
taer = c0 | ||
waer = c0 | ||
|
@@ -5083,12 +5077,10 @@ subroutine compute_dEdd_5bd (klev, klevp, & | |
endif ! modal_aero | ||
!mgf-- | ||
enddo ! na | ||
gaer = gaer/(waer+puny) | ||
waer = waer/(taer+puny) | ||
g(k) = (g(k)*w0(k)*tau(k) + gaer*waer*taer) / & | ||
(w0(k)*tau(k) + waer*taer) | ||
w0(k) = (w0(k)*tau(k) + waer*taer) / & | ||
(tau(k) + taer) | ||
g(k) = (g(k)*w0(k)*tau(k) + gaer) / & | ||
(w0(k)*tau(k) + waer) | ||
w0(k) = (w0(k)*tau(k) + waer) / & | ||
(tau(k) + taer) | ||
tau(k) = tau(k) + taer | ||
enddo ! k | ||
endif ! tr_aero | ||
|
@@ -5134,9 +5126,9 @@ subroutine compute_dEdd_5bd (klev, klevp, & | |
if (tr_zaero .and. dEdd_algae) then | ||
do k = kii, klev | ||
g(k) = (g(k)*w0(k)*tau(k) + gzaer_5bd(ns,k)) / & | ||
(w0(k)*tau(k) + wzaer_5bd(ns,k)) | ||
w0(k) = (w0(k)*tau(k) + wzaer_5bd(ns,k)) / & | ||
(tau(k) + tzaer_5bd(ns,k)) | ||
(w0(k)*tau(k) + wzaer_5bd(ns,k)) | ||
w0(k) = (w0(k)*tau(k) + wzaer_5bd(ns,k)) / & | ||
(tau(k) + tzaer_5bd(ns,k)) | ||
tau(k) = tau(k) + tzaer_5bd(ns,k) | ||
enddo | ||
elseif (tr_aero) then | ||
|
@@ -5192,12 +5184,10 @@ subroutine compute_dEdd_5bd (klev, klevp, & | |
!mgf-- | ||
enddo ! na | ||
|
||
gaer = gaer/(waer+puny) | ||
waer = waer/(taer+puny) | ||
g(k) = (g(k)*w0(k)*tau(k) + gaer*waer*taer) / & | ||
(w0(k)*tau(k) + waer*taer) | ||
w0(k) = (w0(k)*tau(k) + waer*taer) / & | ||
(tau(k) + taer) | ||
g(k) = (g(k)*w0(k)*tau(k) + gaer) / & | ||
(w0(k)*tau(k) + waer) | ||
w0(k) = (w0(k)*tau(k) + waer) / & | ||
(tau(k) + taer) | ||
tau(k) = tau(k) + taer | ||
do k = kii+1, klev | ||
taer = c0 | ||
|
@@ -5252,12 +5242,10 @@ subroutine compute_dEdd_5bd (klev, klevp, & | |
endif ! modal_aero | ||
!mgf-- | ||
enddo ! na | ||
gaer = gaer/(waer+puny) | ||
waer = waer/(taer+puny) | ||
g(k) = (g(k)*w0(k)*tau(k) + gaer*waer*taer) / & | ||
(w0(k)*tau(k) + waer*taer) | ||
w0(k) = (w0(k)*tau(k) + waer*taer) / & | ||
(tau(k) + taer) | ||
g(k) = (g(k)*w0(k)*tau(k) + gaer) / & | ||
(w0(k)*tau(k) + waer) | ||
w0(k) = (w0(k)*tau(k) + waer) / & | ||
(tau(k) + taer) | ||
tau(k) = tau(k) + taer | ||
enddo ! k | ||
endif ! tr_aero | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
shortwave = 'dEdd_snicar' | ||
shortwave = 'dEdd_snicar_ad' | ||
snw_ssp_table = 'snicar' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
shortwave = 'dEdd_snicar' | ||
shortwave = 'dEdd_snicar_ad' | ||
snw_ssp_table = 'test' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it possible for the denominators to be zero?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@njeffery
We are reducing the calculations here (and several other places) as was done in MPAS-SI -- it's much cleaner. The original has a bunch of puny's in the (unnecessary) denominators. My question is whether it's possible for the denominators to ever be zero in the new code, as long as tr_zaero is turned on?