diff --git a/columnphysics/icepack_flux.F90 b/columnphysics/icepack_flux.F90 index ce0b4b72..1e4f2aff 100644 --- a/columnphysics/icepack_flux.F90 +++ b/columnphysics/icepack_flux.F90 @@ -93,7 +93,6 @@ subroutine merge_fluxes (aicen, & meltbn , & ! bottom ice melt (m) meltsn , & ! snow melt (m) meltsliqn,& ! mass of snow melt (kg/m^2) - dsnown , & ! change in snow depth (m) congeln , & ! congelation ice growth (m) snoicen ! snow-ice growth (m) @@ -102,7 +101,8 @@ subroutine merge_fluxes (aicen, & fswthrun_vdf, & ! vis dif sw radiation through ice bot (W/m**2) fswthrun_idr, & ! nir dir sw radiation through ice bot (W/m**2) fswthrun_idf, & ! nir dif sw radiation through ice bot (W/m**2) - Urefn ! air speed reference level (m/s) + dsnown , & ! change in snow depth (m) + Urefn ! air speed reference level (m/s) ! cumulative fluxes real (kind=dbl_kind), intent(inout) :: & @@ -203,13 +203,14 @@ subroutine merge_fluxes (aicen, & fsalt = fsalt + fsaltn * aicen fhocn = fhocn + fhocnn * aicen fswthru = fswthru + fswthrun * aicen - if (present(fswthru_vdr)) & + + if (present(fswthru_vdr) .and. present(fswthrun_vdr)) & fswthru_vdr = fswthru_vdr + fswthrun_vdr * aicen - if (present(fswthru_vdf)) & + if (present(fswthru_vdf) .and. present(fswthrun_vdf)) & fswthru_vdf = fswthru_vdf + fswthrun_vdf * aicen - if (present(fswthru_idr)) & + if (present(fswthru_idr) .and. present(fswthrun_idr)) & fswthru_idr = fswthru_idr + fswthrun_idr * aicen - if (present(fswthru_idf)) & + if (present(fswthru_idf) .and. present(fswthrun_idf)) & fswthru_idf = fswthru_idf + fswthrun_idf * aicen ! ice/snow thickness @@ -217,12 +218,14 @@ subroutine merge_fluxes (aicen, & meltt = meltt + melttn * aicen meltb = meltb + meltbn * aicen melts = melts + meltsn * aicen + if (snwgrain) then meltsliq = meltsliq + meltsliqn * aicen endif - if (present(dsnow)) then + + if (present(dsnow) .and. present(dsnown)) & dsnow = dsnow + dsnown * aicen - endif + congel = congel + congeln * aicen snoice = snoice + snoicen * aicen diff --git a/columnphysics/icepack_therm_vertical.F90 b/columnphysics/icepack_therm_vertical.F90 index 233e3854..153cf53c 100644 --- a/columnphysics/icepack_therm_vertical.F90 +++ b/columnphysics/icepack_therm_vertical.F90 @@ -2267,11 +2267,11 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & wlat ! lateral melt rate (m/s) real (kind=dbl_kind), intent(inout), optional :: & + dsnow , & ! change in snow depth (m/step-->cm/day) fswthru_vdr , & ! vis dir shortwave penetrating to ocean (W/m^2) fswthru_vdf , & ! vis dif shortwave penetrating to ocean (W/m^2) fswthru_idr , & ! nir dir shortwave penetrating to ocean (W/m^2) fswthru_idf , & ! nir dif shortwave penetrating to ocean (W/m^2) - dsnow , & ! change in snow depth (m/step-->cm/day) fsloss ! rate of snow loss to leads (kg/m^2/s) real (kind=dbl_kind), intent(out), optional :: & @@ -2332,17 +2332,17 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & melttn , & ! top ice melt (m) meltbn , & ! bottom ice melt (m) congeln , & ! congelation ice growth (m) - snoicen , & ! snow-ice growth (m) - dsnown ! change in snow thickness (m/step-->cm/day) + snoicen ! snow-ice growth (m) - real (kind=dbl_kind), dimension(:), intent(in) :: & + real (kind=dbl_kind), dimension(:), intent(inout) :: & fswthrun ! SW through ice to ocean (W/m^2) - real (kind=dbl_kind), dimension(:), intent(in), optional :: & + real (kind=dbl_kind), dimension(:), intent(inout), optional :: & fswthrun_vdr , & ! vis dir SW through ice to ocean (W/m^2) fswthrun_vdf , & ! vis dif SW through ice to ocean (W/m^2) fswthrun_idr , & ! nir dir SW through ice to ocean (W/m^2) - fswthrun_idf ! nir dif SW through ice to ocean (W/m^2) + fswthrun_idf , & ! nir dif SW through ice to ocean (W/m^2) + dsnown ! change in snow thickness (m/step-->cm/day) real (kind=dbl_kind), dimension(:,:), intent(inout) :: & zqsn , & ! snow layer enthalpy (J m-3) @@ -2406,6 +2406,7 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & smliq ! tracer for mass of liquid in snow (kg/m^3) real (kind=dbl_kind), dimension(ncat) :: & + l_dsnown, & ! change in snow thickness (m/step-->cm/day) l_meltsliqn ! mass of snow melt local (kg/m^2) real (kind=dbl_kind) :: & @@ -2456,6 +2457,12 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & call icepack_warnings_setabort(.true.,__FILE__,__LINE__) return endif + if ((present(dsnow) .and. .not.present(dsnown)) .or. & + (present(dsnown) .and. .not.present(dsnow))) then + call icepack_warnings_add(subname//' error in dsnow and dsnown arguments') + call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + return + endif if (tr_fsd) then if (.not.(present(wlat))) then call icepack_warnings_add(subname//' error in FSD arguments, tr_fsd=T') @@ -2474,7 +2481,8 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & smliq(:) = c0 l_meltsliq = c0 - l_meltsliqn = c0 + l_meltsliqn(:) = c0 + l_dsnown(:) = c0 ! solid and liquid components of snow mass massicen(:,:) = c0 @@ -2555,7 +2563,6 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & meltbn (n) = c0 congeln(n) = c0 snoicen(n) = c0 - dsnown (n) = c0 Trefn = c0 Qrefn = c0 @@ -2682,7 +2689,7 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & smliq=smliq, massliq=massliqn (:,n), & congel=congeln (n), snoice=snoicen (n), & mlt_onset=mlt_onset, frz_onset=frz_onset, & - yday=yday, dsnow=dsnown (n), & + yday=yday, dsnow=l_dsnown (n), & prescribed_ice=prescribed_ice) if (icepack_warnings_aborted(subname)) then @@ -2873,7 +2880,7 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & meltbn=meltbn (n), congeln=congeln(n),& meltt=meltt, melts=melts, & meltb=meltb, snoicen=snoicen(n),& - dsnow=dsnow, dsnown=dsnown(n), & + dsnow=dsnow, dsnown=l_dsnown(n),& congel=congel, snoice=snoice, & meltsliq=l_meltsliq, & meltsliqn=l_meltsliqn(n), & @@ -2914,6 +2921,7 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & if (present(meltsliqn )) meltsliqn = l_meltsliqn if (present(meltsliq )) meltsliq = l_meltsliq + if (present(dsnown )) dsnown = l_dsnown !----------------------------------------------------------------- ! Calculate ponds from the topographic scheme