Skip to content
Open
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
21 changes: 21 additions & 0 deletions components/elm/src/biogeophys/BalanceCheckMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,27 @@ subroutine ColWaterBalanceCheck( bounds, num_do_smb_c, filter_do_smb_c, &
snow_sinks(c) = qflx_sub_snow(c) + qflx_evap_grnd(c) + qflx_snow_melt(c) &
+ qflx_snwcp_ice(c) + qflx_snwcp_liq(c) + qflx_sl_top_soil(c)

if (lun_pp%itype(l) == istice .or. lun_pp%itype(l) == istice_mec) then
! With fractional frac_sno_eff on glacier columns, only the
! snow-covered fraction receives dew/rain and loses sub/evap.
if (do_capsnow(c) .and. .not. use_firn_percolation_and_compaction) then
snow_sources(c) = qflx_prec_grnd(c) &
+ frac_sno_eff(c) * (qflx_dew_snow(c) + qflx_dew_grnd(c))

snow_sinks(c) = frac_sno_eff(c) * (qflx_sub_snow(c) + qflx_evap_grnd(c)) &
+ qflx_snwcp_ice(c) + qflx_snwcp_liq(c) &
+ qflx_snow_melt(c) + qflx_sl_top_soil(c)
else
snow_sources(c) = qflx_snow_grnd_col(c) &
+ frac_sno_eff(c) * (qflx_rain_grnd_col(c) &
+ qflx_dew_snow(c) + qflx_dew_grnd(c))

snow_sinks(c) = frac_sno_eff(c) * (qflx_sub_snow(c) + qflx_evap_grnd(c)) &
+ qflx_snwcp_ice(c) + qflx_snwcp_liq(c) &
+ qflx_snow_melt(c) + qflx_sl_top_soil(c)
endif
endif

if (col_pp%is_lake(c)) then
if (.not. use_firn_percolation_and_compaction) then
if ( do_capsnow(c)) then
Expand Down
15 changes: 8 additions & 7 deletions components/elm/src/biogeophys/CanopyHydrologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -642,14 +642,15 @@ subroutine CanopyHydrology(bounds, &
end if !end of do_capsnow construct

! set frac_sno_eff variable
if (col_pp%is_soil(c) .or. col_pp%is_crop(c)) then
if (subgridflag ==1) then
frac_sno_eff(c) = frac_sno(c)
else
frac_sno_eff(c) = 1._r8
endif
else
! Port of CLM fractional-snow energy fix: when subgrid fluxes are on,
! allow fractional frac_sno_eff for all non-urban, non-lake columns
! (including glacier and wetland), matching soil/crop treatment.
if (subgridflag == 1 .and. .not. urbpoi(l) .and. ltype(l) /= istdlak) then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is the default value of subgridflag 1 or 0?

frac_sno_eff(c) = frac_sno(c)
else if (frac_sno(c) > 0._r8) then
frac_sno_eff(c) = 1._r8
else
frac_sno_eff(c) = 0._r8
endif

if (ltype(l) == istwet .and. t_grnd(c)>tfrz) then
Expand Down
9 changes: 8 additions & 1 deletion components/elm/src/biogeophys/SnowHydrologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@ subroutine SnowCompaction(bounds, num_snowc, filter_snowc, &
!
! !LOCAL VARIABLES:
integer :: j, l, c, fc, t ! indices
! (urbpoi / lakpoi used for CLM-consistent fractional melt compaction gate)
! parameters
real(r8), parameter :: c2 = 23.e-3_r8 ! [m3/kg]
real(r8), parameter :: c3 = 2.777e-6_r8 ! [1/s]
Expand Down Expand Up @@ -605,6 +606,8 @@ subroutine SnowCompaction(bounds, num_snowc, filter_snowc, &
snl => col_pp%snl , & ! Input: [integer (:) ] number of snow layers
n_melt => col_pp%n_melt , & ! Input: [real(r8) (:) ] SCA shape parameter
ltype => lun_pp%itype , & ! Input: [integer (:) ] landunit type
urbpoi => lun_pp%urbpoi , & ! Input: [logical (:) ] true => landunit is an urban point
lakpoi => lun_pp%lakpoi , & ! Input: [logical (:) ] true => landunit is a lake point

forc_wind => top_as_inst%windbot , & ! Input: [real(r8) (:) ] atmospheric wind speed (m/s)
t_soisno => col_es%t_soisno , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin)
Expand Down Expand Up @@ -703,9 +706,13 @@ subroutine SnowCompaction(bounds, num_snowc, filter_snowc, &
endif

! Compaction occurring during melt
! Port of CLM fractional-snow melt compaction fix: use the
! fractional ddz3 form for all non-lake, non-urban columns when
! subgridflag is on (includes glacier and wetland).

if (imelt(c,j) == 1) then
if(subgridflag==1 .and. (col_pp%is_soil(c) .or. col_pp%is_crop(c))) then
l = col_pp%landunit(c)
if (subgridflag == 1 .and. (.not. lakpoi(l) .and. .not. urbpoi(l))) then
! first term is delta mass over mass
ddz3 = max(0._r8,min(1._r8,(swe_old(c,j) - wx)/wx))

Expand Down
22 changes: 11 additions & 11 deletions components/elm/src/biogeophys/SoilHydrologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -554,23 +554,23 @@ subroutine Infiltration(bounds, num_hydrologyc, filter_hydrologyc, num_urbanc, f
!5. surface runoff from h2osfc
if (h2osfcflag==1) then
! calculate runoff from h2osfc -------------------------------------
if (use_modified_infil) then
!if (use_modified_infil) then
if (frac_h2osfc_act(c) <= pc .and. frac_h2osfc(c) <= pc) then
frac_infclust=0.0_r8
else
if (frac_h2osfc(c) <= pc) then
if (frac_h2osfc_act(c) <= pc) then
frac_infclust=(frac_h2osfc_act(c)-pc)**mu
else
frac_infclust=(frac_h2osfc(c)-pc)**mu
frac_infclust=(frac_h2osfc_act(c)-pc)**mu
endif
Comment on lines 555 to 565

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree with Copilot's review: Why is the second frac_infclust=(frac_h2osfc(c)-pc)**mu being changed to frac_infclust=(frac_h2osfc_act(c)-pc)**mu?

endif
else
if (frac_h2osfc(c) <= pc) then
frac_infclust=0.0_r8
else
frac_infclust=(frac_h2osfc(c)-pc)**mu
endif
endif
!else
! if (frac_h2osfc(c) <= pc) then
! frac_infclust=0.0_r8
! else
! frac_infclust=(frac_h2osfc(c)-pc)**mu
! endif
!endif
Comment on lines +557 to +573

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It seems to me that we are making the use_modified_infil scheme as the default. So, why are we not doing it through namelist instead of commented out the old code and making the use_modified_infil as the default?

Or, if use_modified_infil needs to be made default, let's remove it from the namelist and delete the code corresponding to .not. use_modified_infil.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

use_modified_infil is still used to control how the infiltration capacity is computed for different sub fractions. This modification just remove the control of use_modified_infil on the surface water runoff generation.

endif

if (lun_pp%ispolygon(col_pp%landunit(c))) then
Expand All @@ -596,7 +596,7 @@ subroutine Infiltration(bounds, num_hydrologyc, filter_hydrologyc, num_urbanc, f
! limit runoff to value of storage above S(pc)
if(h2osfc(c) >= h2osfc_thresh(c) .and. h2osfcflag/=0) then
! spatially variable k_wet
k_wet=1.0_r8 * sin((rpi/180._r8) * col_pp%topo_slope(c))
k_wet=1.0e-4_r8 * sin((rpi/180._r8) * max(col_pp%topo_slope(c), 1.0e-3_r8))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What is the logic of reducing k_wet by four-orders of magnitude? Was this a bug identified by CLM that we are fixing here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

A bug from the misuse of unit

qflx_h2osfc_surf(c) = k_wet * frac_infclust * (h2osfc(c) - h2osfc_thresh(c))

qflx_h2osfc_surf(c)=min(qflx_h2osfc_surf(c),(h2osfc(c) - h2osfc_thresh(c))/dtime)
Expand Down
4 changes: 4 additions & 0 deletions components/elm/src/biogeophys/SoilTemperatureMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,10 @@ subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, &
.AND. col_pp%itype(c) /= icol_sunwall .AND. col_pp%itype(c) /= icol_shadewall .AND. &
col_pp%itype(c) /= icol_roof) then
cv(c,j) = csol(c,j)*(1._r8-watsat(c,j))*dz(c,j) + (h2osoi_ice(c,j)*cpice + h2osoi_liq(c,j)*cpliq)
! Port of CLM bedrock heat-capacity fix: do not reduce solid-rock
! heat capacity by soil porosity below the soil-bedrock boundary.
! csol is already set to bedrock mineral heat capacity for these layers.
if (j > nlevbed) cv(c,j) = csol(c,j)*dz(c,j)
else if (lun_pp%itype(l) == istwet) then
cv(c,j) = (h2osoi_ice(c,j)*cpice + h2osoi_liq(c,j)*cpliq)
if (j > nlevbed) cv(c,j) = csol(c,j)*dz(c,j)
Expand Down
Loading