Skip to content

Commit

Permalink
Merge pull request #23 from eclare108213/njeffery/seaice/add-step-sno…
Browse files Browse the repository at this point in the history
…w-icepack

Corrects use of snow flags and adds flag consistency checks
  • Loading branch information
eclare108213 authored Jul 13, 2023
2 parents eaaac15 + a9c8812 commit d205577
Show file tree
Hide file tree
Showing 6 changed files with 316 additions and 259 deletions.
27 changes: 11 additions & 16 deletions components/mpas-seaice/src/column/ice_colpkg.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2288,11 +2288,11 @@ subroutine colpkg_step_therm1(dt, ncat, nilyr, nslyr, n_aero, &
! Transport liquid water in snow between layers and
! compute the meltpond contribution
!-----------------------------------------------------------------

call drain_snow (dt, nslyr, &
vsnon (n) , aicen (n), &
smice (:,n), smliq (:,n), &
meltsliqn(n), use_smliq_pnd)
if (tr_rsnw) &
call drain_snow (dt, nslyr, &
vsnon (n) , aicen (n), &
smice (:,n), smliq (:,n), &
meltsliqn(n), use_smliq_pnd)


!-----------------------------------------------------------------
Expand Down Expand Up @@ -3842,7 +3842,6 @@ subroutine colpkg_step_snow (dt, wind, &
vicen, vsnon, &
alvl, vlvl, &
smice, smliq, &
rhos_effn, rhos_eff, &
rhos_cmpn, rhos_cmp, &
rsnw, zqin1, &
zSin1, Tsfc, &
Expand Down Expand Up @@ -3905,11 +3904,9 @@ subroutine colpkg_step_snow (dt, wind, &
smice , & ! mass of ice in snow (kg/m^3)
smliq , & ! mass of liquid in snow (kg/m^3)
rsnw , & ! snow grain radius (10^-6 m)
rhos_effn, & ! effective snow density: content (kg/m^3)
rhos_cmpn ! effective snow density: compaction (kg/m^3)

real (kind=dbl_kind), intent(inout) :: &
rhos_eff , & ! mean effective snow density: content (kg/m^3)
rhos_cmp ! mean effective snow density: compaction (kg/m^3)

! dry snow aging parameters
Expand Down Expand Up @@ -3956,9 +3953,7 @@ subroutine colpkg_step_snow (dt, wind, &

call snow_effective_density(nslyr, ncat, &
vsnon, vsno, &
smice, smliq, &
rhosnew, &
rhos_effn, rhos_eff, &
rhos_cmpn, rhos_cmp)

!-----------------------------------------------------------------
Expand Down Expand Up @@ -4950,8 +4945,8 @@ subroutine colpkg_init_tracer_flags(&
tr_pond_cesm_in , & ! if .true., use cesm pond tracer
tr_pond_lvl_in , & ! if .true., use level-ice pond tracer
tr_pond_topo_in , & ! if .true., use explicit topography-based ponds
tr_snow_in , & ! if .true., use snow trcrs (smice, smliq, rhos_cmp)
tr_rsnw_in , & ! if .true., use snow grain radius tracer
tr_snow_in , & ! if .true., use snow density tracer (rhos_cmp)
tr_rsnw_in , & ! if .true., use snow grain radius, liquid and mass tracers (smice, smliq, rsnw)
tr_aero_in , & ! if .true., use aerosol tracers
tr_brine_in , & ! if .true., brine height differs from ice thickness
tr_bgc_S_in , & ! if .true., use zsalinity
Expand All @@ -4977,8 +4972,8 @@ subroutine colpkg_init_tracer_flags(&
tr_pond_cesm , & ! if .true., use cesm pond tracer
tr_pond_lvl , & ! if .true., use level-ice pond tracer
tr_pond_topo , & ! if .true., use explicit topography-based ponds
tr_snow , & ! if .true., use snow trcrs (smice, smliq, rhos_cmp)
tr_rsnw , & ! if .true., use snow grain radius tracer
tr_snow , & ! if .true., use snow density tracer (rhos_cmp)
tr_rsnw , & ! if .true., use snow grain radius, liquid and mass tracers (smice, smliq, rsnw)
tr_aero , & ! if .true., use aerosol tracers
tr_brine , & ! if .true., brine height differs from ice thickness
tr_bgc_S , & ! if .true., use zsalinity
Expand All @@ -5004,8 +4999,8 @@ subroutine colpkg_init_tracer_flags(&
tr_pond_cesm_in , & ! if .true., use cesm pond tracer
tr_pond_lvl_in , & ! if .true., use level-ice pond tracer
tr_pond_topo_in , & ! if .true., use explicit topography-based ponds
tr_snow_in , & ! if .true., use snow trcrs (smice, smliq, rhos_cmp)
tr_rsnw_in , & ! if .true., use snow grain radius tracer
tr_snow_in , & ! if .true., use snow density tracer (rhos_cmp)
tr_rsnw_in , & ! if .true., use snow grain radius, liquid and mass tracers (smice, smliq, rsnw)
tr_aero_in , & ! if .true., use aerosol tracers
tr_brine_in , & ! if .true., brine height differs from ice thickness
tr_bgc_S_in , & ! if .true., use zsalinity
Expand Down
4 changes: 2 additions & 2 deletions components/mpas-seaice/src/column/ice_colpkg_tracers.F90
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ module ice_colpkg_tracers
tr_pond_cesm, & ! if .true., use cesm pond tracer
tr_pond_lvl , & ! if .true., use level-ice pond tracer
tr_pond_topo, & ! if .true., use explicit topography-based ponds
tr_snow , & ! if .true., use snow tracers (ice, liquid water mass)
tr_rsnw , & ! if .true., use dynamic snow grain radius tracer
tr_snow , & ! if .true., use snow density tracer (rhos_cmp)
tr_rsnw , & ! if .true., use dynamic snow grain radius, mass, liquid tracers
tr_aero , & ! if .true., use aerosol tracers
tr_brine ! if .true., brine height differs from ice thickness

Expand Down
12 changes: 2 additions & 10 deletions components/mpas-seaice/src/column/ice_snow.F90
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ module ice_snow

subroutine snow_effective_density(nslyr, ncat, &
vsnon, vsno, &
smice, smliq, &
rhosnew, &
rhos_effn, rhos_eff, &
rhos_cmpn, rhos_cmp)

integer (kind=int_kind), intent(in) :: &
Expand All @@ -51,21 +49,16 @@ subroutine snow_effective_density(nslyr, ncat, &

real (kind=dbl_kind), dimension(:,:), &
intent(inout) :: &
smice , & ! mass of ice in snow (kg/m^3)
smliq , & ! mass of liquid in snow (kg/m^3)
rhos_effn, & ! effective snow density: content (kg/m^3)
rhos_cmpn ! effective snow density: compaction (kg/m^3)

real (kind=dbl_kind), intent(inout) :: &
rhos_eff , & ! mean effective snow density: content (kg/m^3)
rhos_cmp ! mean effective snow density: compaction (kg/m^3)

integer (kind=int_kind) :: &
k , & ! snow layer index
n , & ! ice thickness category index
cnt ! counter for snow presence

rhos_eff = c0
rhos_cmp = c0

!-----------------------------------------------------------------
Expand All @@ -87,13 +80,10 @@ subroutine snow_effective_density(nslyr, ncat, &
do n = 1, ncat
if (vsnon(n) > c0) then
do k = 1, nslyr
rhos_effn(k,n) = rhos_effn(k,n) + smice(k,n) + smliq(k,n)
rhos_eff = rhos_eff + vsnon(n)*rhos_effn(k,n)
rhos_cmp = rhos_cmp + vsnon(n)*rhos_cmpn(k,n)
enddo
endif
enddo
rhos_eff = rhos_eff/(vsno*real(nslyr,kind=dbl_kind))
rhos_cmp = rhos_cmp/(vsno*real(nslyr,kind=dbl_kind))

endif ! vsno
Expand Down Expand Up @@ -422,6 +412,8 @@ subroutine snow_redist(dt, nslyr, ncat, wind, ain, vin, vsn, zqsn, &
zs1(:), zs2(:), &
hslyr, hsn_new(n), &
zqsn(:,n))
else
hsn_new(1) = hsn_new(1) + dhsn
endif ! nslyr > 1
endif ! |dhsn| > puny
endif ! ain > puny
Expand Down
30 changes: 14 additions & 16 deletions components/mpas-seaice/src/column/ice_therm_vertical.F90
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ subroutine thermo_vertical (nilyr, nslyr, &
yday ! day of year

logical (kind=log_kind), intent(in) :: &
tr_snow , & ! if .true., use snow tracers
tr_rsnw ! if .true., use dynamic snow grain radius
tr_snow , & ! if .true., use snow density tracer
tr_rsnw ! if .true., use dynamic snow grain radius, liquid and snow mass

logical (kind=log_kind), intent(out) :: &
l_stop ! if true, print diagnostics and abort on return
Expand Down Expand Up @@ -310,7 +310,7 @@ subroutine thermo_vertical (nilyr, nslyr, &
fadvocn, snoice, &
einit, &
smice, smliq, &
tr_snow, &
tr_rsnw, &
l_stop, stop_label)

if (l_stop) return
Expand Down Expand Up @@ -1124,8 +1124,8 @@ subroutine thickness_changes (nilyr, nslyr, &
sss ! ocean salinity (PSU)

logical (kind=log_kind), intent(in) :: &
tr_snow , & ! if .true., use snow tracers
tr_rsnw ! if .true., use snow dynamic snow grain radius
tr_snow , & ! if .true., use snow density tracer
tr_rsnw ! if .true., use snow dynamic snow grain radius, snow liquid and mass

! local variables

Expand Down Expand Up @@ -1198,7 +1198,7 @@ subroutine thickness_changes (nilyr, nslyr, &
dzs(k) = hslyr
smicetot(k) = c0
smliqtot(k) = c0
if (tr_snow) then
if (tr_rsnw) then
smicetot(k) = dzs(k) * smice(k)
smliqtot(k) = dzs(k) * smliq(k)
endif
Expand Down Expand Up @@ -1506,7 +1506,7 @@ subroutine thickness_changes (nilyr, nslyr, &
! avoid roundoff errors
zqsn(1) = min(zqsn(1), -rhos*Lfresh)

if (tr_snow) then
if (tr_rsnw) then

smtot = c0
if (abs(dzs(1)) > c0) smtot = smicetot(1)/dzs(1) !smice(1) ! save for now
Expand Down Expand Up @@ -1585,7 +1585,7 @@ subroutine thickness_changes (nilyr, nslyr, &
!-------------------------------------------------------------------
! Update snow mass tracers, smice and smliq, for uneven layers
!-------------------------------------------------------------------
if (tr_snow) then
if (tr_rsnw) then
do k = 1, nslyr
meltsliq = meltsliq + smliqtot(k) ! total liquid (in case all snow melted)
if (dzs(k) > c0) then
Expand Down Expand Up @@ -1687,13 +1687,11 @@ subroutine thickness_changes (nilyr, nslyr, &
hslyr, hsn, &
zqsn)

if (tr_rsnw) &
call adjust_enthalpy (nslyr, &
zs1(:), zs2(:), &
hslyr, hsn, &
rsnw(:))

if (tr_snow) then
if (tr_rsnw) then
call adjust_enthalpy (nslyr, &
zs1(:), zs2(:), &
hslyr, hsn, &
rsnw(:))
call adjust_enthalpy (nslyr, &
zs1(:), zs2(:), &
hslyr, hsn, &
Expand Down Expand Up @@ -1721,7 +1719,7 @@ subroutine thickness_changes (nilyr, nslyr, &
fhocnn = fhocnn &
+ zqsn(k)*hsn/(real(nslyr,kind=dbl_kind)*dt)
zqsn(k) = -rhos*Lfresh
if (tr_snow) then
if (tr_rsnw) then
meltsliq = meltsliq + smicetot(k) ! add to meltponds
smice(k) = rhos
smliq(k) = c0
Expand Down
Loading

0 comments on commit d205577

Please sign in to comment.