Skip to content
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

Make dsnow and dsnown optional. #492

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions columnphysics/icepack_flux.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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) :: &
Expand Down Expand Up @@ -203,26 +203,29 @@ 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

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

Expand Down
28 changes: 18 additions & 10 deletions columnphysics/icepack_therm_vertical.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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 :: &
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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) :: &
Expand Down Expand Up @@ -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')
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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), &
Expand Down Expand Up @@ -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
Expand Down
Loading