-
Notifications
You must be signed in to change notification settings - Fork 0
Flux coupling edits #8
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
Changes from 23 commits
bc088ac
ea4cde3
d4b4a31
a15fc03
65259a0
e3b9746
2cf33b1
af43525
d1ff164
e6e429c
07352ba
e8ef69f
9bd1b3f
140e8cb
bf0995b
5d2160d
6782499
ed20c15
7036d9c
10faac6
789f982
d2c2a09
1fb991d
8516838
594f9ff
6ad9e4c
e92ca42
bfd3c4c
7e86b82
9b8a3ff
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 |
|---|---|---|
|
|
@@ -75,6 +75,49 @@ module icepack_therm_vertical | |
| contains | ||
|
|
||
| !======================================================================= | ||
|
|
||
| function cap_conductive_flux(nilyr, nslyr, fcondtopn, hin, zTsn, zTin, hslyr) result(fcondtopn_solve) | ||
|
Collaborator
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. should this be a subroutine? is there a particular reason to have a function ?
Author
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. this just returns a single float, so a function felt cleaner to me here. |
||
|
|
||
|
Collaborator
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. This will need a description of some form |
||
| integer (kind=int_kind), intent(in) :: & | ||
| nilyr , & ! number of ice layers | ||
| nslyr ! number of snow layers | ||
| real (kind=dbl_kind), intent(in) :: fcondtopn | ||
| real (kind=dbl_kind), intent(in) :: hin | ||
| real (kind=dbl_kind), intent(in) :: zTin(nilyr) | ||
| real (kind=dbl_kind), intent(in) :: zTsn(nslyr) | ||
| real (kind=dbl_kind), intent(in) :: hslyr | ||
|
|
||
| real (kind=dbl_kind) :: fcondtopn_solve | ||
|
|
||
| real (kind=dbl_kind), parameter :: ratio_Wm2_m = 1000.0, cold_temp_flag = c0 - 60.0 | ||
|
||
|
|
||
| ! AEW: New variables for cold-ice flux capping | ||
| real (kind=dbl_kind) :: top_layer_temp, & | ||
| reduce_ratio, & | ||
| reduce_amount | ||
|
|
||
|
|
||
| if (abs(fcondtopn) > ratio_Wm2_m * hin) then | ||
| fcondtopn_solve = sign(ratio_Wm2_m * hin,fcondtopn) | ||
|
|
||
| else | ||
| fcondtopn_solve = fcondtopn | ||
| endif | ||
|
|
||
| if (hslyr>hs_min) then | ||
| top_layer_temp = zTsn(1) | ||
| else | ||
| top_layer_temp = zTin(1) | ||
| endif | ||
|
|
||
| if ((top_layer_temp < cold_temp_flag) .and. (fcondtopn_solve < c0)) then | ||
| reduce_ratio = (cold_temp_flag - top_layer_temp) / (100.0 + cold_temp_flag) | ||
kieranricardo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| reduce_amount = reduce_ratio * fcondtopn_solve | ||
| fcondtopn_solve = fcondtopn_solve - reduce_amount | ||
| endif | ||
|
|
||
| end function cap_conductive_flux | ||
|
|
||
| ! | ||
| ! Driver for updating ice and snow internal temperatures and | ||
| ! computing thermodynamic growth rates and atmospheric fluxes. | ||
|
|
@@ -246,6 +289,9 @@ subroutine thermo_vertical (dt, aicen, & | |
| real (kind=dbl_kind) :: & | ||
| fadvocn, saltvol, dfsalt ! advective heat flux to ocean | ||
|
|
||
| real (kind=dbl_kind) :: & | ||
| fcondtopn_solve, fcondtopn_extra, e_num | ||
|
|
||
| character(len=*),parameter :: subname='(thermo_vertical)' | ||
|
|
||
| !----------------------------------------------------------------- | ||
|
|
@@ -272,6 +318,8 @@ subroutine thermo_vertical (dt, aicen, & | |
| meltsliq= c0 | ||
| massice(:) = c0 | ||
| massliq(:) = c0 | ||
| e_num = c0 | ||
| fcondtopn_extra = c0 | ||
| if (tr_pond) then | ||
| dpnd_flush = c0 | ||
| dpnd_expon = c0 | ||
|
|
@@ -284,6 +332,8 @@ subroutine thermo_vertical (dt, aicen, & | |
| fcondtopn = c0 | ||
| endif | ||
|
|
||
| fcondtopn_solve = fcondtopn | ||
|
|
||
| !----------------------------------------------------------------- | ||
| ! Compute variables needed for vertical thermo calculation | ||
| !----------------------------------------------------------------- | ||
|
|
@@ -339,6 +389,12 @@ subroutine thermo_vertical (dt, aicen, & | |
| if (icepack_warnings_aborted(subname)) return | ||
|
|
||
| else ! ktherm | ||
| fcondtopn_solve = cap_conductive_flux(nilyr, nslyr, fcondtopn, hin, zTsn, zTin, hslyr) | ||
| fcondtopn_extra = fcondtopn - fcondtopn_solve | ||
|
||
|
|
||
| ! if (calc_Tsfc) then | ||
| ! fcondtopn = fcondtopn_solve | ||
| ! end if | ||
|
|
||
| call temperature_changes(dt, & | ||
| rhoa, flw, & | ||
|
|
@@ -353,8 +409,8 @@ subroutine thermo_vertical (dt, aicen, & | |
| Tsf, Tbot, & | ||
| fsensn, flatn, & | ||
| flwoutn, fsurfn, & | ||
| fcondtopn, fcondbotn, & | ||
| einit ) | ||
| fcondtopn_solve, fcondbotn, & | ||
| einit, e_num) | ||
| if (icepack_warnings_aborted(subname)) return | ||
|
|
||
| endif ! ktherm | ||
|
|
@@ -411,7 +467,8 @@ subroutine thermo_vertical (dt, aicen, & | |
| mlt_onset, frz_onset, & | ||
| zSin, sss, & | ||
| sst, & | ||
| dsnow, rsnw) | ||
| dsnow, rsnw, & | ||
| e_num, fcondtopn_extra ) | ||
| if (icepack_warnings_aborted(subname)) return | ||
|
|
||
| !----------------------------------------------------------------- | ||
|
|
@@ -425,7 +482,7 @@ subroutine thermo_vertical (dt, aicen, & | |
| fsnow, einit, & | ||
| einter, efinal, & | ||
| fcondtopn, fcondbotn, & | ||
| fadvocn, fbot ) | ||
| fadvocn, fbot, e_num, fcondtopn_extra ) | ||
| if (icepack_warnings_aborted(subname)) return | ||
|
|
||
| !----------------------------------------------------------------- | ||
|
|
@@ -1070,7 +1127,8 @@ subroutine thickness_changes (dt, yday, & | |
| mlt_onset, frz_onset,& | ||
| zSin, sss, & | ||
| sst, & | ||
| dsnow, rsnw) | ||
| dsnow, rsnw, & | ||
| e_num, fcondtopn_extra) | ||
|
|
||
| real (kind=dbl_kind), intent(in) :: & | ||
| dt , & ! time step | ||
|
|
@@ -1138,6 +1196,8 @@ subroutine thickness_changes (dt, yday, & | |
| sst , & ! sea surface temperature (C) | ||
| sss ! ocean salinity (PSU) | ||
|
|
||
| real (kind=dbl_kind), intent(in) :: & | ||
| e_num, fcondtopn_extra | ||
| ! local variables | ||
|
|
||
| integer (kind=int_kind) :: & | ||
|
|
@@ -1271,7 +1331,7 @@ subroutine thickness_changes (dt, yday, & | |
| wk1 = (fsurfn - fcondtopn) * dt | ||
| etop_mlt = max(wk1, c0) ! etop_mlt > 0 | ||
|
|
||
| wk1 = (fcondbotn - fbot) * dt | ||
| wk1 = (fcondbotn - fbot + fcondtopn_extra) * dt | ||
| ebot_mlt = max(wk1, c0) ! ebot_mlt > 0 | ||
| ebot_gro = min(wk1, c0) ! ebot_gro < 0 | ||
|
|
||
|
|
@@ -1561,8 +1621,7 @@ subroutine thickness_changes (dt, yday, & | |
| ! fhocn is the available ocean heat that is left after use by ice | ||
| !----------------------------------------------------------------- | ||
|
|
||
| fhocnn = fbot & | ||
| + (esub + etop_mlt + ebot_mlt)/dt | ||
| fhocnn = fbot + (esub + etop_mlt + ebot_mlt + e_num)/dt | ||
|
|
||
| !----------------------------------------------------------------- | ||
| ! Add new snowfall at top surface | ||
|
|
@@ -1987,7 +2046,7 @@ subroutine conservation_check_vthermo(dt, & | |
| einit, einter, & | ||
| efinal, & | ||
| fcondtopn,fcondbotn, & | ||
| fadvocn, fbot ) | ||
| fadvocn, fbot, e_num, fcondtopn_extra) | ||
|
|
||
| real (kind=dbl_kind), intent(in) :: & | ||
| dt ! time step | ||
|
|
@@ -2000,7 +2059,7 @@ subroutine conservation_check_vthermo(dt, & | |
| fsnow , & ! snowfall rate (kg m-2 s-1) | ||
| fcondtopn , & | ||
| fadvocn , & | ||
| fbot | ||
| fbot, e_num, fcondtopn_extra | ||
|
|
||
| real (kind=dbl_kind), intent(in) :: & | ||
| einit , & ! initial energy of melting (J m-2) | ||
|
|
@@ -2053,6 +2112,10 @@ subroutine conservation_check_vthermo(dt, & | |
| call icepack_warnings_add(warnstr) | ||
| write(warnstr,*) subname, 'Input energy =', einp | ||
| call icepack_warnings_add(warnstr) | ||
| write(warnstr,*) subname, 'Numerical energy =', e_num | ||
| call icepack_warnings_add(warnstr) | ||
| write(warnstr,*) subname, 'fcondtopn_extra energy =', fcondtopn_extra | ||
| call icepack_warnings_add(warnstr) | ||
| write(warnstr,*) subname, 'fbot,fcondbot:' | ||
| call icepack_warnings_add(warnstr) | ||
| write(warnstr,*) subname, fbot,fcondbotn | ||
|
|
||
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.
So this is the same as line 360 now?
The comment says
(When in standalone mode, fluxes ! are input as per ice area.)does that mean there is a standalone icepack using this subroutine, or the comment is out of date ?Uh oh!
There was an error while loading. Please reload this page.
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.
I've changed this to use an
#idfef(ACCESS3_CICE)(which is now defined in CICE)