Skip to content

Commit

Permalink
Merge pull request #17 from apcraig/snowbrinebugs
Browse files Browse the repository at this point in the history
Merge Consortium Main #5999551399b including snowbrinebugs
  • Loading branch information
eclare108213 authored Nov 30, 2022
2 parents 4d131da + 941e3c5 commit 9d08355
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 11 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/test-icepack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,20 @@ jobs:
ln -s ${GITHUB_WORKSPACE}/../Icepack ${HOME}/icepack
# ls -al ${HOME}/
# ls -al ${GITHUB_WORKSPACE}/
- name: check for tabs
run: |
cd $HOME/icepack
set cnt = 0
set ffiles = `find -P columnphysics configuration/driver -iname "*.f*"`
set cfiles = `find -P columnphysics configuration/driver -iname "*.c*"`
foreach file ($ffiles $cfiles)
set fcnt = `sed -n '/\t/p' $file | wc -l`
@ cnt = $cnt + $fcnt
if ($fcnt > 0) then
echo "TAB found: $fcnt $file"
endif
end
exit $cnt
- name: setup conda env
shell: /bin/bash {0}
run: |
Expand Down
20 changes: 12 additions & 8 deletions columnphysics/icepack_snow.F90
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module icepack_snow
use icepack_parameters, only: isnw_T, isnw_Tgrd, isnw_rhos
use icepack_parameters, only: snowage_rhos, snowage_Tgrd, snowage_T
use icepack_parameters, only: snowage_tau, snowage_kappa, snowage_drdt0
use icepack_parameters, only: snw_aging_table
use icepack_parameters, only: snw_aging_table, use_smliq_pnd

use icepack_therm_shared, only: icepack_ice_temperature
use icepack_therm_shared, only: adjust_enthalpy
Expand All @@ -31,7 +31,8 @@ module icepack_snow

real (kind=dbl_kind), parameter, public :: &
S_r = 0.033_dbl_kind, & ! irreducible saturation (Anderson 1976)
S_wet= 4.22e-5_dbl_kind ! (um^3/s) wet metamorphism parameters
S_wet= 4.22e5_dbl_kind ! wet metamorphism parameter (um^3/s)
! = 1.e18 * 4.22e-13 (Oleson 2010)

real (kind=dbl_kind) :: &
min_rhos, & ! snowtable axis data, assumes linear data
Expand Down Expand Up @@ -1079,7 +1080,7 @@ subroutine snow_wet_metamorph (dt, dr_wet, rsnw, smice, smliq)
dr_wet = c0
fliq = c1
if (smice + smliq > c0 .and. rsnw > c0) then
fliq = min(smliq/(smice + smliq),p1)*c100
fliq = min(smliq/(smice + smliq),p1)
dr_wet = S_wet * fliq**3*dt/(c4*pi*rsnw**2)
endif

Expand Down Expand Up @@ -1160,7 +1161,8 @@ subroutine drain_snow (nslyr, vsnon, aicen, &

real (kind=dbl_kind) :: &
hslyr, & ! snow layer thickness (m)
hsn ! snow thickness (m)
hsn, & ! snow thickness (m)
sliq ! snow liquid content (kg/m^2)

real (kind=dbl_kind), dimension(nslyr) :: &
dlin , & ! liquid mass into the layer from above (kg/m^2)
Expand All @@ -1171,27 +1173,29 @@ subroutine drain_snow (nslyr, vsnon, aicen, &
character (len=*), parameter :: subname='(drain_snow)'

hsn = c0
sliq = c0
if (aicen > c0) hsn = vsnon/aicen
if (hsn > puny) then
dlin (:) = c0
dlout(:) = c0
hslyr = hsn / real(nslyr,kind=dbl_kind)
meltsliq = c0
do k = 1, nslyr
massliq(k) = massliq(k) + dlin(k) ! add liquid in from layer above
phi_ice(k) = min(c1, massice(k) / (rhoi *hslyr))
phi_liq(k) = massliq(k) / (rhofresh*hslyr)
dlout(k) = max(c0, (phi_liq(k) - S_r*(c1-phi_ice(k))) / rhofresh*hslyr)
dlout(k) = max(c0, (phi_liq(k) - S_r*(c1-phi_ice(k))) * rhofresh * hslyr)
massliq(k) = massliq(k) - dlout(k)
if (k < nslyr) then
dlin(k+1) = dlout(k)
else
meltsliq = dlout(nslyr) ! this (re)initializes meltsliq
sliq = dlout(nslyr) ! this (re)initializes meltsliq
endif
enddo
else
meltsliq = meltsliq ! computed in thickness_changes
sliq = meltsliq ! computed in thickness_changes
endif
meltsliq = meltsliq
if (use_smliq_pnd) meltsliq = sliq

end subroutine drain_snow

Expand Down
4 changes: 2 additions & 2 deletions columnphysics/icepack_therm_itd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ subroutine linear_itd (ncat, hin_max, &

if (tr_brine) then
vbrin(n) = vbrin(n) + trcrn(nt_fbri,n) &
* vicen(n)/real(nilyr,kind=dbl_kind)
* vicen(n)
endif

do k = 1, nilyr
Expand Down Expand Up @@ -654,7 +654,7 @@ subroutine linear_itd (ncat, hin_max, &

if (tr_brine) then
vbrin(n) = vbrin(n) + trcrn(nt_fbri,n) &
* vicen(n)/real(nilyr,kind=dbl_kind)
* vicen(n)
endif

do k = 1, nilyr
Expand Down
2 changes: 1 addition & 1 deletion columnphysics/icepack_therm_vertical.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2796,7 +2796,7 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, &

endif ! aicen_init

if (snwgrain .and. use_smliq_pnd) then
if (snwgrain) then
call drain_snow (nslyr = nslyr, &
vsnon = vsnon(n), &
aicen = aicen(n), &
Expand Down

0 comments on commit 9d08355

Please sign in to comment.