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 #506

Merged
merged 3 commits into from
Nov 15, 2024
Merged
Changes from 1 commit
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
25 changes: 19 additions & 6 deletions columnphysics/icepack_therm_vertical.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2361,12 +2361,14 @@ subroutine icepack_step_therm1(dt, &
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) :: &
fswthrun ! SW through ice to ocean (W/m^2)

real (kind=dbl_kind), dimension(:), intent(inout), optional :: &
dsnown ! change in snow thickness (m/step-->cm/day)

real (kind=dbl_kind), dimension(:), intent(in), 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)
Expand Down Expand Up @@ -2442,6 +2444,8 @@ subroutine icepack_step_therm1(dt, &
l_fswthrun_vdf, & ! vis dif SW local n ice to ocean (W/m^2)
l_fswthrun_idr, & ! nir dir SW local n ice to ocean (W/m^2)
l_fswthrun_idf, & ! nir dif SW local n ice to ocean (W/m^2)
l_dsnow, & ! local snow change
l_dsnown, & ! local snow change category
l_meltsliq ! mass of snow melt local (kg/m^2)

real (kind=dbl_kind) :: &
Expand Down Expand Up @@ -2485,6 +2489,12 @@ subroutine icepack_step_therm1(dt, &
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 arguments')
call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
return
endif
if (tr_fsd) then
if (.not.present(afsdn)) then
call icepack_warnings_add(subname//' error missing afsdn argument, tr_fsd=T')
Expand All @@ -2509,6 +2519,8 @@ subroutine icepack_step_therm1(dt, &

l_meltsliq = c0
l_meltsliqn = c0
l_dsnow = c0
if (present(dsnow)) l_dsnow = dsnow

! solid and liquid components of snow mass
massicen(:,:) = c0
Expand Down Expand Up @@ -2589,7 +2601,8 @@ subroutine icepack_step_therm1(dt, &
meltbn (n) = c0
congeln(n) = c0
snoicen(n) = c0
dsnown (n) = c0
l_dsnown = c0
if (present(dsnown)) l_dsnown = dsnown (n)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the old implementation, "dsnown(n)" was always set to zero before being passed into thermo_vertical. Now it is being initialized to the incoming value of "dsnown(n)". Is this correct? Why doesn't this change answers?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This confused me as well, but dsnow and dsnown are both intent(inout). I guess the initialization to zero is automatically happening in the driver and we were never using it in the driver. I will fix this though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am thinking that dsnown should be intent out only.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, dsnown (called dsnow) is initialized to zero in thermo_vertical. Again, it should really only be intent(out).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dabail10, Please make updates ASAP if possible, would like to get this merged and into weekend testing as first steps to release. Thanks.


Trefn = c0
Qrefn = c0
Expand Down Expand Up @@ -2714,8 +2727,8 @@ subroutine icepack_step_therm1(dt, &
smice=smice, massice=massicen (:,n), &
smliq=smliq, massliq=massliqn (:,n), &
congel=congeln (n), snoice=snoicen (n), &
mlt_onset=mlt_onset, frz_onset=frz_onset, &
yday=yday, dsnow=dsnown (n), &
mlt_onset=mlt_onset, frz_onset=frz_onset , &
yday=yday, dsnow=l_dsnown , &
prescribed_ice=prescribed_ice)

if (icepack_warnings_aborted(subname)) then
Expand Down Expand Up @@ -2903,7 +2916,7 @@ subroutine icepack_step_therm1(dt, &
meltbn=meltbn (n), congeln=congeln(n),&
meltt=meltt, melts=melts, &
meltb=meltb, snoicen=snoicen(n),&
dsnow=dsnow, dsnown=dsnown(n), &
dsnow=l_dsnow, dsnown=l_dsnown, &
congel=congel, snoice=snoice, &
meltsliq=l_meltsliq, &
meltsliqn=l_meltsliqn(n), &
Expand Down
Loading