Skip to content

Commit 13a7ec5

Browse files
authored
Merge pull request #537 from CH-Earth/develop
Develop into master v3.2.0
2 parents fa9adf8 + 51bf7ae commit 13a7ec5

48 files changed

Lines changed: 1660 additions & 189 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ Make sure all the relevant boxes are checked (and only check the box if you actu
55
- [ ] New tests added (describe which tests were performed to test the changes)
66
- [ ] Science test figures (add figures to PR comment and describe the tests)
77
- [ ] Checked that the new code conforms to the [SUMMA coding conventions](https://github.com/NCAR/summa/blob/master/docs/howto/summa_coding_conventions.md)
8-
- [ ] Describe the change in the release notes (use either `./summa/docs/whats-new.md` or `./summa/docs/minor-changes.md` depending on what changed)
8+
- [ ] Describe the change in the release notes (use `./summa/docs/whats-new.md`)

build/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,10 @@ DRIVER__EX = summa.exe
300300

301301
# Define version number
302302
VERSIONFILE = $(DRIVER_DIR)/summaversion.inc
303-
VERSION = $(shell git tag | tail -n 1)
304303
BULTTIM = $(shell date)
305304
GITBRCH = $(shell git describe --long --all --always | sed -e's/heads\///')
306305
GITHASH = $(shell git rev-parse HEAD)
306+
VERSION = $(shell git show-ref --tags | grep $GITHASH | sed 's/.*tags\///' | grep . || echo "undefined")
307307

308308
#========================================================================
309309
# PART 3: Checks

build/source/dshare/flxMapping.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ subroutine flxMapping(err,message)
143143
flux2state_orig(iLookFLUX%mLayerLiqFluxSnow) = flux2state(state1=iname_watLayer, state2=integerMissing)
144144

145145
! liquid water fluxes for the soil domain
146-
flux2state_orig(iLookFLUX%scalarRainPlusMelt) = flux2state(state1=iname_watLayer, state2=integerMissing)
146+
flux2state_orig(iLookFLUX%scalarRainPlusMelt) = flux2state(state1=iname_matLayer, state2=integerMissing)
147147
flux2state_orig(iLookFLUX%scalarMaxInfilRate) = flux2state(state1=iname_matLayer, state2=integerMissing)
148148
flux2state_orig(iLookFLUX%scalarInfiltration) = flux2state(state1=iname_matLayer, state2=integerMissing)
149149
flux2state_orig(iLookFLUX%scalarExfiltration) = flux2state(state1=iname_matLayer, state2=integerMissing)
@@ -164,9 +164,9 @@ subroutine flxMapping(err,message)
164164
flux2state_orig(iLookFLUX%scalarAquiferBaseflow) = flux2state(state1=iname_matLayer, state2=integerMissing)
165165

166166
! derived variables
167-
flux2state_orig(iLookFLUX%scalarTotalET) = flux2state(state1=iname_nrgCanopy, state2=integerMissing)
167+
flux2state_orig(iLookFLUX%scalarTotalET) = flux2state(state1=iname_nrgCanopy, state2=iname_nrgLayer)
168168
flux2state_orig(iLookFLUX%scalarTotalRunoff) = flux2state(state1=iname_matLayer, state2=integerMissing)
169-
flux2state_orig(iLookFLUX%scalarNetRadiation) = flux2state(state1=iname_nrgCanopy, state2=integerMissing)
169+
flux2state_orig(iLookFLUX%scalarNetRadiation) = flux2state(state1=iname_nrgCanopy, state2=iname_nrgLayer)
170170

171171
! ** copy across flux metadata
172172
do iVar=1,nFlux

build/source/dshare/get_ixname.f90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,8 +558,9 @@ function get_ixdiag(varName)
558558
case('scalarVGn_m' ); get_ixdiag = iLookDIAG%scalarVGn_m ! van Genuchten "m" parameter (-)
559559
case('scalarKappa' ); get_ixdiag = iLookDIAG%scalarKappa ! constant in the freezing curve function (m K-1)
560560
case('scalarVolLatHt_fus' ); get_ixdiag = iLookDIAG%scalarVolLatHt_fus ! volumetric latent heat of fusion (J m-3)
561-
! number of function evaluations
561+
! timing information
562562
case('numFluxCalls' ); get_ixdiag = iLookDIAG%numFluxCalls ! number of flux calls (-)
563+
case('wallClockTime' ); get_ixdiag = iLookDIAG%wallClockTime ! wall clock time (s)
563564
! get to here if cannot find the variable
564565
case default
565566
get_ixdiag = integerMissing

build/source/dshare/globalData.f90

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ MODULE globalData
197197
! * part 2: globally constant variables/structures that require initialization
198198
! ----------------------------------------------------------------------------------------------------------------
199199

200-
! define Indian bread (NaN)
201-
real(rkind),save,public :: dNaN
200+
! define Not-a-Number (NaN)
201+
real(rkind),save,public :: dNaN
202202

203203
! define default parameter values and parameter bounds
204204
type(par_info),save,public :: localParFallback(maxvarMpar) ! local column default parameters
@@ -305,6 +305,7 @@ MODULE globalData
305305
logical(lgt),save,public :: globalPrintFlag=.false. ! flag to compute the Jacobian
306306
integer(i4b),save,public :: chunksize=1024 ! chunk size for the netcdf read/write
307307
integer(i4b),save,public :: outputPrecision=nf90_double ! variable type
308+
integer(i4b),save,public :: outputCompressionLevel=4 ! output netcdf file deflate level: 0-9. 0 is no compression.
308309

309310
! define result from the time calls
310311
integer(i4b),dimension(8),save,public :: startInit,endInit ! date/time for the start and end of the initialization
@@ -331,14 +332,14 @@ MODULE globalData
331332
! output file information
332333
logical(lgt),dimension(maxvarFreq),save,public :: outFreq ! true if the output frequency is desired
333334
integer(i4b),dimension(maxvarFreq),save,public :: ncid ! netcdf output file id
334-
335+
335336
! look-up values for the choice of the time zone information (formerly in modelDecisions module)
336337
integer(i4b),parameter,public :: ncTime=1 ! time zone information from NetCDF file (timeOffset = longitude/15. - ncTimeOffset)
337338
integer(i4b),parameter,public :: utcTime=2 ! all times in UTC (timeOffset = longitude/15. hours)
338339
integer(i4b),parameter,public :: localTime=3 ! all times local (timeOffset = 0)
339-
340+
340341
! define fixed dimensions
341342
integer(i4b),parameter,public :: nBand=2 ! number of spectral bands
342-
integer(i4b),parameter,public :: nTimeDelay=2000 ! number of hours in the time delay histogram (default: ~1 season = 24*365/4)
343+
integer(i4b),parameter,public :: nTimeDelay=2000 ! number of time steps in the time delay histogram (default: ~1 season = 24*365/4)
343344

344345
END MODULE globalData

build/source/dshare/popMetadat.f90

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ subroutine popMetadat(err,message)
204204
mpar_meta(iLookPARAM%rootDistExp) = var_info('rootDistExp' , 'exponent for the vertical distribution of root density' , '-' , get_ixVarType('scalarv'), iMissVec, iMissVec, .false.)
205205
mpar_meta(iLookPARAM%plantWiltPsi) = var_info('plantWiltPsi' , 'matric head at wilting point' , 'm' , get_ixVarType('scalarv'), iMissVec, iMissVec, .false.)
206206
mpar_meta(iLookPARAM%soilStressParam) = var_info('soilStressParam' , 'parameter in the exponential soil stress function' , '-' , get_ixVarType('scalarv'), iMissVec, iMissVec, .false.)
207-
mpar_meta(iLookPARAM%critSoilWilting) = var_info('critSoilWilting' , 'critical vol. liq. water content when plants are wilting' , '-' , get_ixVarType('scalarv'), iMissVec, iMissVec, .false.)
208-
mpar_meta(iLookPARAM%critSoilTranspire) = var_info('critSoilTranspire' , 'critical vol. liq. water content when transpiration is limited' , '-' , get_ixVarType('scalarv'), iMissVec, iMissVec, .false.)
207+
mpar_meta(iLookPARAM%critSoilWilting) = var_info('critSoilWilting' , 'critical vol. liq. water content when plants are wilting' , '-' , get_ixVarType('parSoil'), iMissVec, iMissVec, .false.)
208+
mpar_meta(iLookPARAM%critSoilTranspire) = var_info('critSoilTranspire' , 'critical vol. liq. water content when transpiration is limited' , '-' , get_ixVarType('parSoil'), iMissVec, iMissVec, .false.)
209209
mpar_meta(iLookPARAM%critAquiferTranspire) = var_info('critAquiferTranspire' , 'critical aquifer storage value when transpiration is limited' , 'm' , get_ixVarType('scalarv'), iMissVec, iMissVec, .false.)
210210
mpar_meta(iLookPARAM%minStomatalResistance) = var_info('minStomatalResistance' , 'minimum stomatal resistance' , 's m-1' , get_ixVarType('scalarv'), iMissVec, iMissVec, .false.)
211211
mpar_meta(iLookPARAM%leafDimension) = var_info('leafDimension' , 'characteristic leaf dimension' , 'm' , get_ixVarType('scalarv'), iMissVec, iMissVec, .false.)
@@ -241,7 +241,7 @@ subroutine popMetadat(err,message)
241241
! scalar soil properties
242242
mpar_meta(iLookPARAM%fieldCapacity) = var_info('fieldCapacity' , 'soil field capacity (vol liq water content when baseflow begins)' , '-' , get_ixVarType('scalarv'), iMissVec, iMissVec, .false.)
243243
mpar_meta(iLookPARAM%wettingFrontSuction) = var_info('wettingFrontSuction' , 'Green-Ampt wetting front suction' , 'm' , get_ixVarType('scalarv'), iMissVec, iMissVec, .false.)
244-
mpar_meta(iLookPARAM%theta_mp) = var_info('theta_mp' , 'volumetric liquid water content when macropore flow begins' , '-' , get_ixVarType('scalarv'), iMissVec, iMissVec, .false.)
244+
mpar_meta(iLookPARAM%theta_mp) = var_info('theta_mp' , 'volumetric liquid water content when macropore flow begins' , '-' , get_ixVarType('parSoil'), iMissVec, iMissVec, .false.)
245245
mpar_meta(iLookPARAM%mpExp) = var_info('mpExp' , 'empirical exponent in macropore flow equation' , '-' , get_ixVarType('scalarv'), iMissVec, iMissVec, .false.)
246246
mpar_meta(iLookPARAM%kAnisotropic) = var_info('kAnisotropic' , 'anisotropy factor for lateral hydraulic conductivity' , '-' , get_ixVarType('scalarv'), iMissVec, iMissVec, .false.)
247247
mpar_meta(iLookPARAM%zScale_TOPMODEL) = var_info('zScale_TOPMODEL' , 'TOPMODEL scaling factor used in lower boundary condition for soil', 'm' , get_ixVarType('scalarv'), iMissVec, iMissVec, .false.)
@@ -420,8 +420,9 @@ subroutine popMetadat(err,message)
420420
diag_meta(iLookDIAG%scalarVGn_m) = var_info('scalarVGn_m' , 'van Genuchten "m" parameter' , '-' , get_ixVarType('midSoil'), iMissVec, iMissVec, .false.)
421421
diag_meta(iLookDIAG%scalarKappa) = var_info('scalarKappa' , 'constant in the freezing curve function' , 'm K-1' , get_ixVarType('scalarv'), iMissVec, iMissVec, .false.)
422422
diag_meta(iLookDIAG%scalarVolLatHt_fus) = var_info('scalarVolLatHt_fus' , 'volumetric latent heat of fusion' , 'J m-3' , get_ixVarType('scalarv'), iMissVec, iMissVec, .false.)
423-
! number of function evaluations
423+
! timing information
424424
diag_meta(iLookDIAG%numFluxCalls) = var_info('numFluxCalls' , 'number of flux calls' , '-' , get_ixVarType('scalarv'), iMissVec, iMissVec, .false.)
425+
diag_meta(iLookDIAG%wallClockTime) = var_info('wallClockTime' , 'wall clock time' , 's' , get_ixVarType('scalarv'), iMissVec, iMissVec, .false.)
425426

426427
! -----
427428
! * local model fluxes...
@@ -708,6 +709,7 @@ subroutine read_output_file(err,message)
708709
USE globalData, only: flux_meta ! data structure for local flux variables
709710
USE globalData, only: deriv_meta ! data structure for local flux derivatives
710711
USE globalData, only: outputPrecision ! data structure for output precision
712+
USE globalData, only: outputCompressionLevel ! data structure for output netcdf deflate level
711713

712714
! structures of named variables
713715
USE var_lookup, only: iLookTYPE ! named variables for categorical data
@@ -814,6 +816,19 @@ subroutine read_output_file(err,message)
814816
end if
815817
cycle
816818
end if
819+
820+
! set output netcdf file compression level if given. default is level 4.
821+
if (trim(varName)=='outputCompressionLevel') then
822+
statName = trim(lineWords(nWords))
823+
read(statName, *) outputCompressionLevel
824+
if ((outputCompressionLevel .LT. 0) .or. (outputCompressionLevel .GT. 9)) then
825+
err=20
826+
cmessage='outputCompressionLevel must be between 0 and 9.'
827+
message=trim(message)//trim(cmessage)//trim(varName);
828+
return
829+
end if
830+
cycle
831+
end if
817832

818833
! --- variables with multiple statistics options --------------------------
819834

build/source/dshare/var_lookup.f90

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,8 +435,9 @@ MODULE var_lookup
435435
integer(i4b) :: scalarVGn_m = integerMissing ! van Genuchten "m" parameter (-)
436436
integer(i4b) :: scalarKappa = integerMissing ! constant in the freezing curve function (m K-1)
437437
integer(i4b) :: scalarVolLatHt_fus = integerMissing ! volumetric latent heat of fusion (J m-3)
438-
! number of function evaluations
438+
! timing information
439439
integer(i4b) :: numFluxCalls = integerMissing ! number of flux calls (-)
440+
integer(i4b) :: wallClockTime = integerMissing ! wall clock time (s)
440441
endtype iLook_diag
441442

442443
! ***********************************************************************************************************
@@ -811,7 +812,7 @@ MODULE var_lookup
811812
51, 52, 53, 54, 55, 56, 57, 58, 59, 60,&
812813
61, 62, 63, 64, 65, 66, 67, 68, 69, 70,&
813814
71, 72, 73, 74, 75, 76, 77, 78, 79, 80,&
814-
81, 82, 83)
815+
81, 82, 83, 84)
815816
! named variables: model fluxes
816817
type(iLook_flux), public,parameter :: iLookFLUX =iLook_flux ( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,&
817818
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,&

build/source/engine/check_icond.f90

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,18 @@ subroutine check_icond(nGRU, & ! number of GRUs and HRU
8080
integer(i4b) :: iHRU ! loop index
8181

8282
! temporary variables for realism checks
83-
integer(i4b) :: iLayer ! index of model layer
84-
integer(i4b) :: iSoil ! index of soil layer
85-
real(rkind) :: fLiq ! fraction of liquid water on the vegetation canopy (-)
86-
real(rkind) :: vGn_m ! van Genutchen "m" parameter (-)
87-
real(rkind) :: tWat ! total water on the vegetation canopy (kg m-2)
88-
real(rkind) :: scalarTheta ! liquid water equivalent of total water [liquid water + ice] (-)
89-
real(rkind) :: h1,h2 ! used to check depth and height are consistent
90-
integer(i4b) :: nLayers ! total number of layers
91-
real(rkind) :: kappa ! constant in the freezing curve function (m K-1)
92-
integer(i4b) :: nSnow ! number of snow layers
93-
real(rkind),parameter :: xTol=1.e-10_rkind ! small tolerance to address precision issues
83+
integer(i4b) :: iLayer ! index of model layer
84+
integer(i4b) :: iSoil ! index of soil layer
85+
real(rkind) :: fLiq ! fraction of liquid water on the vegetation canopy (-)
86+
real(rkind) :: vGn_m ! van Genutchen "m" parameter (-)
87+
real(rkind) :: tWat ! total water on the vegetation canopy (kg m-2)
88+
real(rkind) :: scalarTheta ! liquid water equivalent of total water [liquid water + ice] (-)
89+
real(rkind) :: h1,h2 ! used to check depth and height are consistent
90+
integer(i4b) :: nLayers ! total number of layers
91+
real(rkind) :: kappa ! constant in the freezing curve function (m K-1)
92+
integer(i4b) :: nSnow ! number of snow layers
93+
real(rkind),parameter :: xTol=1.e-10_rkind ! small tolerance to address precision issues
94+
real(rkind),parameter :: canIceTol=1.e-3_rkind ! small tolerance to allow existence of canopy ice for above-freezing temperatures (kg m-2)
9495
! --------------------------------------------------------------------------------------------------------
9596

9697
! Start procedure here
@@ -148,15 +149,15 @@ subroutine check_icond(nGRU, & ! number of GRUs and HRU
148149
! compute the constant in the freezing curve function (m K-1)
149150
kappa = (iden_ice/iden_water)*(LH_fus/(gravity*Tfreeze)) ! NOTE: J = kg m2 s-2
150151

151-
! modify the liquid water and ice in the canopy
152-
if(scalarCanopyIce > 0._rkind .and. scalarCanopyTemp > Tfreeze)then
153-
message=trim(message)//'canopy ice > 0 when canopy temperature > Tfreeze'
152+
! check canopy ice content for unrealistic situations
153+
if(scalarCanopyIce > canIceTol .and. scalarCanopyTemp > Tfreeze)then
154+
! ice content > threshold, terminate run
155+
write(message,'(A,E22.16,A,E9.3,A,F7.3,A,F7.3,A)') trim(message)//'canopy ice (=',scalarCanopyIce,') > canIceTol (=',canIceTol,') when canopy temperature (=',scalarCanopyTemp,') > Tfreeze (=',Tfreeze,')'
154156
err=20; return
157+
else if(scalarCanopyIce > 0._rkind .and. scalarCanopyTemp > Tfreeze)then
158+
! if here, ice content < threshold. Could be sublimation on previous timestep or simply wrong input. Print a warning
159+
write(*,'(A,E22.16,A,F7.3,A,F7.3,A)') 'Warning: canopy ice content in restart file (=',scalarCanopyIce,') > 0 when canopy temperature (=',scalarCanopyTemp,') > Tfreeze (=',Tfreeze,'). Continuing.',NEW_LINE('a')
155160
end if
156-
fLiq = fracliquid(scalarCanopyTemp,snowfrz_scale) ! fraction of liquid water (-)
157-
tWat = scalarCanopyLiq + scalarCanopyIce ! total water (kg m-2)
158-
scalarCanopyLiq = fLiq*tWat ! mass of liquid water on the canopy (kg m-2)
159-
scalarCanopyIce = (1._rkind - fLiq)*tWat ! mass of ice on the canopy (kg m-2)
160161

161162
! number of layers
162163
nLayers = gru_struc(iGRU)%hruInfo(iHRU)%nSnow + gru_struc(iGRU)%hruInfo(iHRU)%nSoil
@@ -274,7 +275,7 @@ subroutine check_icond(nGRU, & ! number of GRUs and HRU
274275
h1 = sum(progData%gru(iGRU)%hru(iHRU)%var(iLookPROG%mLayerDepth)%dat(1:iLayer)) ! sum of the depths up to the current layer
275276
h2 = progData%gru(iGRU)%hru(iHRU)%var(iLookPROG%iLayerHeight)%dat(iLayer) - progData%gru(iGRU)%hru(iHRU)%var(iLookPROG%iLayerHeight)%dat(0) ! difference between snow-atm interface and bottom of layer
276277
if(abs(h1 - h2) > 1.e-6_rkind)then
277-
write(message,'(a,1x,i0)') trim(message)//'mis-match between layer depth and layer height; layer = ', iLayer, '; sum depths = ',h1,'; height = ',h2
278+
write(message,'(a,1x,i0,a,f5.3,a,f5.3)') trim(message)//'mis-match between layer depth and layer height; layer = ', iLayer, '; sum depths = ',h1,'; height = ',h2
278279
err=20; return
279280
end if
280281
end do

0 commit comments

Comments
 (0)