From 2240d84d6fac85af9200f79d50c1831e472c0e15 Mon Sep 17 00:00:00 2001 From: zhangsp8 <21294631@qq.com> Date: Thu, 16 Jan 2025 15:55:42 +0800 Subject: [PATCH 1/2] Fill values for soil parameters of water body --- mksrfdata/Aggregation_SoilParameters.F90 | 228 ++++++++++++++++++----- mksrfdata/MKSRFDATA.F90 | 2 +- 2 files changed, 183 insertions(+), 47 deletions(-) diff --git a/mksrfdata/Aggregation_SoilParameters.F90 b/mksrfdata/Aggregation_SoilParameters.F90 index a576ab79..3cf1631b 100644 --- a/mksrfdata/Aggregation_SoilParameters.F90 +++ b/mksrfdata/Aggregation_SoilParameters.F90 @@ -170,6 +170,32 @@ SUBROUTINE Aggregation_SoilParameters ( & real(r8),allocatable :: fjacc(:,:),fvecc(:),fjacv(:,:),fvecv(:),fjacb(:,:),fvecb(:) integer isiter ! flags to tell whether the iteration is completed, 1=Yes, 0=No + ! Parameters to fill water body patches + real(r8), parameter :: vf_quartz_mineral_fill_water(8) = (/0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.4 /) + real(r8), parameter :: vf_gravels_fill_water(8) = (/0., 0., 0., 0., 0., 0.011, 0.010, 0.010/) + real(r8), parameter :: vf_sand_fill_water(8) = (/0.703, 0.703, 0.704, 0.705, 0.717, 0.722, 0.697, 0.512/) + real(r8), parameter :: vf_om_fill_water(8) = (/0.023, 0.022, 0.021, 0.019, 0.016, 0.011, 0.006, 0.003/) + real(r8), parameter :: wf_gravels_fill_water(8) = (/0., 0., 0., 0., 0., 0.011, 0.011, 0.010/) + real(r8), parameter :: wf_sand_fill_water(8) = (/0.72, 0.72, 0.72, 0.72, 0.73, 0.74, 0.71, 0.52 /) + real(r8), parameter :: theta_r_fill_water(8) = (/0.078, 0.078, 0.077, 0.074, 0.075, 0.074, 0.075, 0.091/) + real(r8), parameter :: alpha_vgm_fill_water(8) = (/0.051, 0.051, 0.050, 0.048, 0.047, 0.044, 0.040, 0.029/) + real(r8), parameter :: n_vgm_fill_water(8) = (/1.413, 1.412, 1.412, 1.414, 1.410, 1.422, 1.399, 1.188/) + real(r8), parameter :: theta_s_fill_water(8) = (/0.374, 0.371, 0.366, 0.358, 0.345, 0.323, 0.297, 0.281/) + real(r8), parameter :: k_s_fill_water(8) = (/96., 89., 79., 75., 79., 74., 55., 19. /) + real(r8), parameter :: L_vgm_fill_water(8) = (/0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 /) + real(r8), parameter :: psi_s_fill_water(8) = (/-13.5, -13.7, -13.9, -14.8, -15.1, -16.0, -19.8, -45.6/) + real(r8), parameter :: lambda_fill_water(8) = (/0.275, 0.275, 0.275, 0.284, 0.287, 0.291, 0.286, 0.194/) + real(r8), parameter :: csol_fill_water(8) = (/1.3e6, 1.3e6, 1.3e6, 1.3e6, 1.4e6, 1.4e6, 1.5e6, 1.5e6/) + real(r8), parameter :: tksatu_fill_water(8) = (/1.985, 2.002, 2.026, 2.066, 2.133, 2.240, 2.388, 2.053/) + real(r8), parameter :: tksatf_fill_water(8) = (/3.343, 3.356, 3.373, 3.401, 3.448, 3.515, 3.613, 3.036/) + real(r8), parameter :: tkdry_fill_water(8) = (/0.260, 0.264, 0.269, 0.278, 0.293, 0.321, 0.359, 0.387/) + real(r8), parameter :: k_solids_fill_water(8) = (/2.450, 2.467, 2.490, 2.528, 2.590, 2.688, 2.823, 2.405/) + real(r8), parameter :: OM_density_fill_water(8) = (/19.18, 18.57, 17.74, 16.37, 14.18, 10.54, 6.088, 3.319/) + real(r8), parameter :: BD_all_fill_water(8) = (/1673., 1683., 1698., 1721., 1758., 1821., 1897., 1944./) + real(r8), parameter :: BA_alpha_fill_water(8) = (/0.38, 0.38, 0.38, 0.38, 0.38, 0.38, 0.38, 0.38 /) + real(r8), parameter :: BA_beta_fill_water (8) = (/35, 35, 35, 35, 35, 35, 35, 35 /) + + #ifdef SrfdataDiag integer :: typpatch(N_land_classification+1), ityp #endif @@ -287,8 +313,12 @@ SUBROUTINE Aggregation_SoilParameters ( & ENDIF IF (isnan_ud(vf_quartz_mineral_s_patches(ipatch))) THEN - write(*,*) "NAN appears in vf_quartz_mineral_s_patches." - write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + IF (L == WATERBODY) THEN + vf_quartz_mineral_s_patches(ipatch) = vf_quartz_mineral_fill_water(nsl) + ELSE + write(*,*) "Warning: NAN appears in vf_quartz_mineral_s_patches." + write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + ENDIF ENDIF ENDDO @@ -397,18 +427,48 @@ SUBROUTINE Aggregation_SoilParameters ( & ENDIF IF (isnan_ud(vf_gravels_s_patches(ipatch))) THEN - write(*,*) "NAN appears in vf_gravels_s_patches." - write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + IF (L == WATERBODY) THEN + vf_gravels_s_patches(ipatch) = vf_gravels_fill_water(nsl) + ELSE + write(*,*) "Warning: NAN appears in vf_gravels_s_patches." + write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + ENDIF ENDIF IF (isnan_ud(vf_sand_s_patches(ipatch))) THEN - write(*,*) "NAN appears in vf_sand_s_patches." - write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + IF (L == WATERBODY) THEN + vf_sand_s_patches(ipatch) = vf_sand_fill_water(nsl) + ELSE + write(*,*) "Warning: NAN appears in vf_sand_s_patches." + write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + ENDIF ENDIF IF (isnan_ud(vf_om_s_patches(ipatch))) THEN - write(*,*) "NAN appears in vf_om_s_patches." - write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + IF (L == WATERBODY) THEN + vf_om_s_patches(ipatch) = vf_om_fill_water(nsl) + ELSE + write(*,*) "Warning: NAN appears in vf_om_s_patches." + write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + ENDIF + ENDIF + + IF (isnan_ud(BA_alpha_patches(ipatch))) THEN + IF (L == WATERBODY) THEN + BA_alpha_patches(ipatch) = BA_alpha_fill_water(nsl) + ELSE + write(*,*) "Warning: NAN appears in BA_alpha_patches." + write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + ENDIF + ENDIF + + IF (isnan_ud(BA_beta_patches(ipatch))) THEN + IF (L == WATERBODY) THEN + BA_beta_patches(ipatch) = BA_beta_fill_water(nsl) + ELSE + write(*,*) "Warning: NAN appears in BA_beta_patches." + write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + ENDIF ENDIF ENDDO @@ -541,8 +601,12 @@ SUBROUTINE Aggregation_SoilParameters ( & ENDIF IF (isnan_ud(wf_gravels_s_patches(ipatch))) THEN - write(*,*) "NAN appears in wf_gravels_s_patches." - write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + IF (L == WATERBODY) THEN + wf_gravels_s_patches(ipatch) = wf_gravels_fill_water(nsl) + ELSE + write(*,*) "Warning: NAN appears in wf_gravels_s_patches." + write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + ENDIF ENDIF ENDDO @@ -604,8 +668,12 @@ SUBROUTINE Aggregation_SoilParameters ( & ENDIF IF (isnan_ud(wf_sand_s_patches(ipatch))) THEN - write(*,*) "NAN appears in wf_sand_s_patches." - write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + IF (L == WATERBODY) THEN + wf_sand_s_patches(ipatch) = wf_sand_fill_water(nsl) + ELSE + write(*,*) "Warning: NAN appears in wf_sand_s_patches." + write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + ENDIF ENDIF ENDDO @@ -771,33 +839,57 @@ SUBROUTINE Aggregation_SoilParameters ( & ENDIF IF (isnan_ud(theta_r_patches(ipatch))) THEN - write(*,*) "NAN appears in theta_r_patches." - write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + IF (L == WATERBODY) THEN + theta_r_patches(ipatch) = theta_r_fill_water(nsl) + ELSE + write(*,*) "Warning: NAN appears in theta_r_patches." + write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + ENDIF ENDIF IF (isnan_ud(alpha_vgm_patches(ipatch))) THEN - write(*,*) "NAN appears in alpha_vgm_patches." - write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + IF (L == WATERBODY) THEN + alpha_vgm_patches(ipatch) = alpha_vgm_fill_water(nsl) + ELSE + write(*,*) "Warning: NAN appears in alpha_vgm_patches." + write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + ENDIF ENDIF IF (isnan_ud(n_vgm_patches(ipatch))) THEN - write(*,*) "NAN appears in n_vgm_patches." - write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + IF (L == WATERBODY) THEN + n_vgm_patches(ipatch) = n_vgm_fill_water(nsl) + ELSE + write(*,*) "Warning: NAN appears in n_vgm_patches." + write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + ENDIF ENDIF IF (isnan_ud(theta_s_patches(ipatch))) THEN - write(*,*) "NAN appears in theta_s_patches." - write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + IF (L == WATERBODY) THEN + theta_s_patches(ipatch) = theta_s_fill_water(nsl) + ELSE + write(*,*) "Warning: NAN appears in theta_s_patches." + write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + ENDIF ENDIF IF (isnan_ud(k_s_patches(ipatch))) THEN - write(*,*) "NAN appears in k_s_patches." - write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + IF (L == WATERBODY) THEN + k_s_patches(ipatch) = k_s_fill_water(nsl) + ELSE + write(*,*) "Warning: NAN appears in k_s_patches." + write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + ENDIF ENDIF IF (isnan_ud(L_vgm_patches(ipatch))) THEN - write(*,*) "NAN appears in L_vgm_patches." - write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + IF (L == WATERBODY) THEN + L_vgm_patches(ipatch) = L_vgm_fill_water(nsl) + ELSE + write(*,*) "Warning: NAN appears in L_vgm_patches." + write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + ENDIF ENDIF ENDDO @@ -1025,23 +1117,39 @@ SUBROUTINE Aggregation_SoilParameters ( & ENDIF IF (isnan_ud(theta_s_patches(ipatch))) THEN - write(*,*) "NAN appears in theta_s_patches." - write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + IF (L == WATERBODY) THEN + theta_s_patches(ipatch) = theta_s_fill_water(nsl) + ELSE + write(*,*) "Warning: NAN appears in theta_s_patches." + write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + ENDIF ENDIF IF (isnan_ud(k_s_patches(ipatch))) THEN - write(*,*) "NAN appears in k_s_patches." - write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + IF (L == WATERBODY) THEN + k_s_patches(ipatch) = k_s_fill_water(nsl) + ELSE + write(*,*) "Warning: NAN appears in k_s_patches." + write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + ENDIF ENDIF IF (isnan_ud(psi_s_patches(ipatch))) THEN - write(*,*) "NAN appears in psi_s_patches." - write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + IF (L == WATERBODY) THEN + psi_s_patches(ipatch) = psi_s_fill_water(nsl) + ELSE + write(*,*) "Warning: NAN appears in psi_s_patches." + write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + ENDIF ENDIF IF (isnan_ud(lambda_patches(ipatch))) THEN - write(*,*) "NAN appears in lambda_patches." - write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + IF (L == WATERBODY) THEN + lambda_patches(ipatch) = lambda_fill_water(nsl) + ELSE + write(*,*) "Warning: NAN appears in lambda_patches." + write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + ENDIF ENDIF ENDDO @@ -1157,8 +1265,12 @@ SUBROUTINE Aggregation_SoilParameters ( & ENDIF IF (isnan_ud(csol_patches(ipatch))) THEN - write(*,*) "NAN appears in csol_patches." - write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + IF (L == WATERBODY) THEN + csol_patches(ipatch) = csol_fill_water(nsl) + ELSE + write(*,*) "Warning: NAN appears in csol_patches." + write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + ENDIF ENDIF ENDDO @@ -1218,8 +1330,12 @@ SUBROUTINE Aggregation_SoilParameters ( & ENDIF IF (isnan_ud(tksatu_patches(ipatch))) THEN - write(*,*) "NAN appears in tksatu_patches." - write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + IF (L == WATERBODY) THEN + tksatu_patches(ipatch) = tksatu_fill_water(nsl) + ELSE + write(*,*) "Warning: NAN appears in tksatu_patches." + write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + ENDIF ENDIF ENDDO @@ -1279,8 +1395,12 @@ SUBROUTINE Aggregation_SoilParameters ( & ENDIF IF (isnan_ud(tksatf_patches(ipatch))) THEN - write(*,*) "NAN appears in tksatf_patches." - write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + IF (L == WATERBODY) THEN + tksatf_patches(ipatch) = tksatf_fill_water(nsl) + ELSE + write(*,*) "Warning: NAN appears in tksatf_patches." + write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + ENDIF ENDIF ENDDO @@ -1340,8 +1460,12 @@ SUBROUTINE Aggregation_SoilParameters ( & ENDIF IF (isnan_ud(tkdry_patches(ipatch))) THEN - write(*,*) "NAN appears in tkdry_patches." - write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + IF (L == WATERBODY) THEN + tkdry_patches(ipatch) = tkdry_fill_water(nsl) + ELSE + write(*,*) "Warning: NAN appears in tkdry_patches." + write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + ENDIF ENDIF ENDDO @@ -1401,8 +1525,12 @@ SUBROUTINE Aggregation_SoilParameters ( & ENDIF IF (isnan_ud(k_solids_patches(ipatch))) THEN - write(*,*) "NAN appears in k_solids_patches." - write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + IF (L == WATERBODY) THEN + k_solids_patches(ipatch) = k_solids_fill_water(nsl) + ELSE + write(*,*) "Warning: NAN appears in k_solids_patches." + write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + ENDIF ENDIF ENDDO @@ -1463,8 +1591,12 @@ SUBROUTINE Aggregation_SoilParameters ( & ENDIF IF (isnan_ud(OM_density_s_patches(ipatch))) THEN - write(*,*) "NAN appears in OM_density_s_patches." - write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + IF (L == WATERBODY) THEN + OM_density_s_patches(ipatch) = OM_density_fill_water(nsl) + ELSE + write(*,*) "Warning: NAN appears in OM_density_s_patches." + write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + ENDIF ENDIF ENDDO @@ -1525,8 +1657,12 @@ SUBROUTINE Aggregation_SoilParameters ( & ENDIF IF (isnan_ud(BD_all_s_patches(ipatch))) THEN - write(*,*) "NAN appears in BD_all_s_patches." - write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + IF (L == WATERBODY) THEN + BD_all_s_patches(ipatch) = BD_all_fill_water(nsl) + ELSE + write(*,*) "Warning: NAN appears in BD_all_s_patches." + write(*,*) landpatch%eindex(ipatch), landpatch%settyp(ipatch) + ENDIF ENDIF ENDDO diff --git a/mksrfdata/MKSRFDATA.F90 b/mksrfdata/MKSRFDATA.F90 index 5a966f5d..f8a3d546 100644 --- a/mksrfdata/MKSRFDATA.F90 +++ b/mksrfdata/MKSRFDATA.F90 @@ -286,7 +286,7 @@ PROGRAM MKSRFDATA CALL mesh_build () CALL landelm_build -#ifndef CATCHMENT +#if (defined GRIDBASED || defined UNSTRUCTURED) IF (DEF_LANDONLY) THEN !TODO: distinguish USGS and IGBP land cover #ifndef LULC_USGS From 009c94d0472156b370a4a592090fdfa38c59c520 Mon Sep 17 00:00:00 2001 From: zhangsp8 <21294631@qq.com> Date: Sat, 18 Jan 2025 17:11:22 +0800 Subject: [PATCH 2/2] Code optimizations. --- main/CoLMMAIN.F90 | 14 ++++---------- main/MOD_Eroot.F90 | 4 ++-- main/MOD_SoilSnowHydrology.F90 | 22 ++++++++++------------ main/URBAN/CoLMMAIN_Urban.F90 | 12 ++---------- main/URBAN/MOD_Urban_Hydrology.F90 | 8 +++----- share/MOD_CatchmentDataReadin.F90 | 7 ++++++- 6 files changed, 27 insertions(+), 40 deletions(-) diff --git a/main/CoLMMAIN.F90 b/main/CoLMMAIN.F90 index 2e19c527..b0cedb8d 100644 --- a/main/CoLMMAIN.F90 +++ b/main/CoLMMAIN.F90 @@ -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 @@ -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)) @@ -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. @@ -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 @@ -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 !====================================================================== diff --git a/main/MOD_Eroot.F90 b/main/MOD_Eroot.F90 index 76d2ec96..4bda0acc 100644 --- a/main/MOD_Eroot.F90 +++ b/main/MOD_Eroot.F90 @@ -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) @@ -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 diff --git a/main/MOD_SoilSnowHydrology.F90 b/main/MOD_SoilSnowHydrology.F90 index 3b8fb331..c511da8d 100644 --- a/main/MOD_SoilSnowHydrology.F90 +++ b/main/MOD_SoilSnowHydrology.F90 @@ -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 @@ -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) @@ -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 @@ -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 @@ -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 @@ -479,7 +477,6 @@ SUBROUTINE WATER_2014 (ipatch,patchtype,lb ,nl_soil ,deltim ,& wa = 4800. zwt = 0. qcharge = 0. - errw_rsub = 0. ENDIF @@ -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) ! ------------------------------------------------------------------------- @@ -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 @@ -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 diff --git a/main/URBAN/CoLMMAIN_Urban.F90 b/main/URBAN/CoLMMAIN_Urban.F90 index 5b0dd2e5..2fdceecf 100644 --- a/main/URBAN/CoLMMAIN_Urban.F90 +++ b/main/URBAN/CoLMMAIN_Urban.F90 @@ -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] @@ -1085,8 +1082,7 @@ SUBROUTINE CoLMMAIN_Urban ( & ! output rsur ,rnof ,qinfl ,zwt ,& - wa ,qcharge ,smp ,hk ,& - errw_rsub ) + wa ,qcharge ,smp ,hk ) ! roof !============================================================ @@ -1241,7 +1237,7 @@ 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) @@ -1249,10 +1245,6 @@ SUBROUTINE CoLMMAIN_Urban ( & 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 !====================================================================== diff --git a/main/URBAN/MOD_Urban_Hydrology.F90 b/main/URBAN/MOD_Urban_Hydrology.F90 index 8dffc4c8..1d4262cb 100644 --- a/main/URBAN/MOD_Urban_Hydrology.F90 +++ b/main/URBAN/MOD_Urban_Hydrology.F90 @@ -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 @@ -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------------------------------ ! @@ -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 diff --git a/share/MOD_CatchmentDataReadin.F90 b/share/MOD_CatchmentDataReadin.F90 index b7442d50..89f82cc6 100644 --- a/share/MOD_CatchmentDataReadin.F90 +++ b/share/MOD_CatchmentDataReadin.F90 @@ -64,7 +64,12 @@ SUBROUTINE catchment_data_read (file_meshdata_in, dataname, grid, rdata, spv) ENDIF ENDIF - in_one_file = ncio_var_exist (file_meshdata_in, dataname) + IF (p_is_master) THEN + in_one_file = ncio_var_exist (file_meshdata_in, dataname) + ENDIF +#ifdef USEMPI + CALL mpi_bcast (in_one_file, 1, mpi_logical, p_address_master, p_comm_glb, p_err) +#endif IF (in_one_file) THEN