Skip to content

Commit

Permalink
Merge pull request #371 from zhangsp8/master
Browse files Browse the repository at this point in the history
Fill values for soil parameters of water body & remove errw_rsub & bug fixed & code optimization
  • Loading branch information
CoLM-SYSU authored Jan 18, 2025
2 parents f03648c + 009c94d commit 673269e
Show file tree
Hide file tree
Showing 8 changed files with 210 additions and 87 deletions.
14 changes: 4 additions & 10 deletions main/CoLMMAIN.F90
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,7 @@ SUBROUTINE CoLMMAIN ( &
pg_rain ,&! rainfall onto ground including canopy runoff [kg/(m2 s)]
pg_snow ,&! snowfall onto ground including canopy runoff [kg/(m2 s)]
qintr_rain ,&! rainfall interception (mm h2o/s)
qintr_snow ,&! snowfall interception (mm h2o/s)
errw_rsub ! the possible subsurface runoff deficit after PHS is included
qintr_snow ! snowfall interception (mm h2o/s)

integer snl ,&! number of snow layers
imelt(maxsnl+1:nl_soil), &! flag for: melting=1, freezing=2, Nothing happended=0
Expand Down Expand Up @@ -646,8 +645,6 @@ SUBROUTINE CoLMMAIN ( &
ENDIF
ENDIF

errw_rsub = 0._r8

fiold(:) = 0.0
IF (snl <0 ) THEN
fiold(snl+1:0)=wice_soisno(snl+1:0)/(wliq_soisno(snl+1:0)+wice_soisno(snl+1:0))
Expand Down Expand Up @@ -769,7 +766,7 @@ SUBROUTINE CoLMMAIN ( &
qsubl_snow ,qfros_snow ,fsno ,rsur ,&
rnof ,qinfl ,pondmx ,&
ssi ,wimp ,smpmin ,zwt ,&
wa ,qcharge ,errw_rsub ,&
wa ,qcharge ,&

#if(defined CaMa_Flood)
!add variables for flood depth [mm], flood fraction [0-1] and re-infiltration [mm/s] calculation.
Expand Down Expand Up @@ -906,10 +903,10 @@ SUBROUTINE CoLMMAIN ( &
#endif

#ifndef CatchLateralFlow
errorw=(endwb-totwb)-(forc_prc+forc_prl-fevpa-rnof-errw_rsub)*deltim
errorw=(endwb-totwb)-(forc_prc+forc_prl-fevpa-rnof)*deltim
#else
! for lateral flow, "rsur" is considered in HYDRO/MOD_Hydro_SurfaceFlow.F90
errorw=(endwb-totwb)-(forc_prc+forc_prl-fevpa-errw_rsub)*deltim
errorw=(endwb-totwb)-(forc_prc+forc_prl-fevpa)*deltim
#endif

#ifdef CROP
Expand All @@ -935,9 +932,6 @@ SUBROUTINE CoLMMAIN ( &
ENDIF
CALL CoLM_stop ()
ENDIF
IF(abs(errw_rsub*deltim)>1.e-3) THEN
write(6,*) 'Subsurface runoff deficit due to PHS', errw_rsub*deltim
ENDIF
#endif

!======================================================================
Expand Down
4 changes: 2 additions & 2 deletions main/MOD_Eroot.F90
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ SUBROUTINE eroot (nl_soil,trsmx0,porsl, &
real(r8), intent(in) :: sc_vgm (1:nl_soil)
real(r8), intent(in) :: fc_vgm (1:nl_soil)
#endif
real(r8), intent(in) :: psi0(1:nl_soil) ! saturated soil suction (cm) (NEGATIVE)
real(r8), intent(in) :: psi0(1:nl_soil) ! saturated soil suction (mm) (NEGATIVE)
real(r8), intent(in) :: rootfr(1:nl_soil) ! fraction of roots in a layer,
real(r8), intent(in) :: dz_soisno(1:nl_soil) ! layer thickness (m)
real(r8), intent(in) :: t_soisno(1:nl_soil) ! soil/snow skin temperature (K)
Expand All @@ -77,7 +77,7 @@ SUBROUTINE eroot (nl_soil,trsmx0,porsl, &
real(r8) roota ! accumulates root resistance factors
real(r8) rresis(1:nl_soil) ! soil water contribution to root resistance
real(r8) s_node ! vol_liq/porosity
real(r8) smpmax ! wilting point potential in cm
real(r8) smpmax ! wilting point potential in mm
real(r8) smp_node ! matrix potential

integer i ! loop counter
Expand Down
22 changes: 10 additions & 12 deletions main/MOD_SoilSnowHydrology.F90
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ SUBROUTINE WATER_2014 (ipatch,patchtype,lb ,nl_soil ,deltim ,&
qseva_snow ,qsdew_snow ,qsubl_snow ,qfros_snow ,fsno ,&
rsur ,rnof ,qinfl ,pondmx ,ssi ,&
wimp ,smpmin ,zwt ,wa ,qcharge ,&
errw_rsub ,&
#if(defined CaMa_Flood)
flddepth ,fldfrc ,qinfl_fld ,&
#endif
Expand Down Expand Up @@ -155,8 +154,7 @@ SUBROUTINE WATER_2014 (ipatch,patchtype,lb ,nl_soil ,deltim ,&
rsur ,&! surface runoff (mm h2o/s)
rnof ,&! total runoff (mm h2o/s)
qinfl ,&! infiltration rate (mm h2o/s)
qcharge ,&! groundwater recharge (positive to aquifer) [mm/s]
errw_rsub
qcharge ! groundwater recharge (positive to aquifer) [mm/s]

! SNICAR model variables
! Aerosol Fluxes (Jan. 07, 2023)
Expand Down Expand Up @@ -402,7 +400,7 @@ SUBROUTINE WATER_2014 (ipatch,patchtype,lb ,nl_soil ,deltim ,&
eff_porosity,icefrac,dz_soisno(1:),zi_soisno(0:),&
wice_soisno(1:),wliq_soisno(1:),&
porsl,psi0,bsw,zwt,wa,&
qcharge,rsubst,errw_rsub)
qcharge,rsubst)

! total runoff (mm/s)
rnof = rsubst + rsur
Expand All @@ -416,7 +414,7 @@ SUBROUTINE WATER_2014 (ipatch,patchtype,lb ,nl_soil ,deltim ,&
ENDIF

err_solver = (sum(wliq_soisno(1:))+sum(wice_soisno(1:))+wa) - w_sum &
- (gwat-etr-rnof-errw_rsub)*deltim
- (gwat-etr-rnof)*deltim

IF(lb >= 1)THEN
err_solver = err_solver-(qsdew+qfros-qsubl)*deltim
Expand All @@ -427,7 +425,7 @@ SUBROUTINE WATER_2014 (ipatch,patchtype,lb ,nl_soil ,deltim ,&
wice_soisno(1) = max(0., wice_soisno(1) + (qfros_soil-qsubl_soil) * deltim)

err_solver = (sum(wliq_soisno(1:))+sum(wice_soisno(1:))+wa) - w_sum &
- (gwat-etr-rnof-errw_rsub)*deltim
- (gwat-etr-rnof)*deltim

err_solver = err_solver-(qsdew_soil+qfros_soil-qsubl_soil)*deltim
ENDIF
Expand Down Expand Up @@ -479,7 +477,6 @@ SUBROUTINE WATER_2014 (ipatch,patchtype,lb ,nl_soil ,deltim ,&
wa = 4800.
zwt = 0.
qcharge = 0.
errw_rsub = 0.

ENDIF

Expand Down Expand Up @@ -2065,7 +2062,7 @@ SUBROUTINE groundwater (nl_soil,deltim,pondmx,&
eff_porosity,icefrac,&
dz_soisno,zi_soisno,wice_soisno,wliq_soisno,&
porsl,psi0,bsw,zwt,wa,&
qcharge,rsubst,errw_rsub)
qcharge,rsubst)

! -------------------------------------------------------------------------

Expand Down Expand Up @@ -2096,7 +2093,6 @@ SUBROUTINE groundwater (nl_soil,deltim,pondmx,&
real(r8), intent(inout) :: wa ! water in the unconfined aquifer (mm)
real(r8), intent(in) :: qcharge ! aquifer recharge rate (positive to aquifer) (mm/s)
real(r8), intent(inout) :: rsubst ! subsurface runoff (positive = out of soil column) (mm H2O /s)
real(r8), intent(out) :: errw_rsub ! the possible subsurface runoff dificit after PHS is included

!
! LOCAL ARGUMENTS
Expand Down Expand Up @@ -2316,9 +2312,11 @@ SUBROUTINE groundwater (nl_soil,deltim,pondmx,&
ENDDO

! Sub-surface runoff and drainage
errw_rsub = min(0., rsubst + xs/deltim)
rsubst = max(0., rsubst + xs/deltim)

rsubst = rsubst + xs/deltim
IF (rsubst < 0.) THEN
wa = wa + rsubst*deltim
rsubst = 0.
ENDIF

! DO j = 1, nl_soil-1
! IF (wice_soisno(j)*wice_soisno(j+1) < 1.e-6)THEN
Expand Down
12 changes: 2 additions & 10 deletions main/URBAN/CoLMMAIN_Urban.F90
Original file line number Diff line number Diff line change
Expand Up @@ -665,9 +665,6 @@ SUBROUTINE CoLMMAIN_Urban ( &
fveg_gper ,&! fraction of fveg/fgper
fveg_gimp ! fraction of fveg/fgimp

real(r8) :: &
errw_rsub ! the possible subsurface runoff deficit after PHS is included

real(r8) :: &
ei ,&! vapor pressure on leaf surface [pa]
deidT ,&! derivative of "ei" on "tl" [pa/K]
Expand Down Expand Up @@ -1085,8 +1082,7 @@ SUBROUTINE CoLMMAIN_Urban ( &

! output
rsur ,rnof ,qinfl ,zwt ,&
wa ,qcharge ,smp ,hk ,&
errw_rsub )
wa ,qcharge ,smp ,hk )

! roof
!============================================================
Expand Down Expand Up @@ -1241,18 +1237,14 @@ SUBROUTINE CoLMMAIN_Urban ( &

endwb = sum(wice_soisno(1:) + wliq_soisno(1:))
endwb = endwb + scv + ldew*fveg + wa*(1-froof)*fgper
errorw = (endwb - totwb) - (forc_prc + forc_prl + urb_irrig - fevpa - rnof - errw_rsub)*deltim
errorw = (endwb - totwb) - (forc_prc + forc_prl + urb_irrig - fevpa - rnof)*deltim
xerr = errorw/deltim

#if(defined CoLMDEBUG)
IF(abs(errorw)>1.e-3) THEN
write(6,*) 'Warning: water balance violation', errorw, ipatch, patchclass
!STOP
ENDIF

IF(abs(errw_rsub*deltim)>1.e-3) THEN
write(6,*) 'Subsurface runoff deficit due to PHS', errw_rsub*deltim
ENDIF
#endif

!======================================================================
Expand Down
8 changes: 3 additions & 5 deletions main/URBAN/MOD_Urban_Hydrology.F90
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ SUBROUTINE UrbanHydrology ( &

! output
rsur ,rnof ,qinfl ,zwt ,&
wa ,qcharge ,smp ,hk ,&
errw_rsub )
wa ,qcharge ,smp ,hk )

!=======================================================================
! this is the main SUBROUTINE to execute the calculation of URBAN
Expand Down Expand Up @@ -227,8 +226,7 @@ SUBROUTINE UrbanHydrology ( &

real(r8), intent(out) :: &
smp(1:nl_soil) ,&! soil matrix potential [mm]
hk (1:nl_soil) ,&! hydraulic conductivity [mm h2o/m]
errw_rsub ! the possible subsurface runoff deficit after PHS is included
hk (1:nl_soil) ! hydraulic conductivity [mm h2o/m]
!
!-----------------------Local Variables------------------------------
!
Expand Down Expand Up @@ -273,7 +271,7 @@ SUBROUTINE UrbanHydrology ( &
0. ,& ! fsno, not active
rsur_gper ,rnof_gper ,qinfl ,&
pondmx ,ssi ,wimp ,smpmin ,&
zwt ,wa ,qcharge ,errw_rsub ,&
zwt ,wa ,qcharge ,&
#if(defined CaMa_Flood)
flddepth ,fldfrc ,qinfl_fld ,&
#endif
Expand Down
Loading

0 comments on commit 673269e

Please sign in to comment.