Skip to content

Commit 372c3fb

Browse files
authored
Merge pull request #452 from NCAR/develop
Bugfixes and minor improvements
2 parents 4ee457d + 7e1c0c3 commit 372c3fb

86 files changed

Lines changed: 3684 additions & 3549 deletions

Some content is hidden

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

build/Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ ifeq "$(FC)" "gfortran"
9191
endif
9292

9393
# Production runs
94-
FLAGS_NOAH = -O3 -ffree-form -fdefault-real-8 -ffree-line-length-none -fmax-errors=0 $(FLAGS_OMP)
94+
FLAGS_NOAH = -O3 -ffree-form -ffree-line-length-none -fmax-errors=0 $(FLAGS_OMP)
9595
FLAGS_COMM = -O3 -ffree-line-length-none -fmax-errors=0 $(FLAGS_OMP)
9696
FLAGS_SUMMA = -O3 -ffree-line-length-none -fmax-errors=0 $(FLAGS_OMP)
9797

9898
# Debug runs
99-
#FLAGS_NOAH = -p -g -ffree-form -fdefault-real-8 -ffree-line-length-none -fmax-errors=0 -fbacktrace -Wno-unused -Wno-unused-dummy-argument
99+
#FLAGS_NOAH = -p -g -ffree-form -ffree-line-length-none -fmax-errors=0 -fbacktrace -Wno-unused -Wno-unused-dummy-argument
100100
#FLAGS_COMM = -p -g -Wall -ffree-line-length-none -fmax-errors=0 -fbacktrace -fcheck=bounds
101101
#FLAGS_SUMMA = -p -g -Wall -ffree-line-length-none -fmax-errors=0 -fbacktrace -fcheck=bounds
102102

@@ -110,12 +110,12 @@ ifeq "$(FC)" "ifort"
110110
endif
111111

112112
# Production runs
113-
FLAGS_NOAH = -O3 -autodouble -noerror_limit -FR -auto -fltconsistency $(FLAGS_OMP)
113+
FLAGS_NOAH = -O3 -noerror_limit -FR -auto -fltconsistency $(FLAGS_OMP)
114114
FLAGS_COMM = -O3 -FR -auto -fltconsistency -fpe0 $(FLAGS_OMP)
115115
FLAGS_SUMMA = -O3 -FR -auto -fltconsistency -fpe0 $(FLAGS_OMP)
116116

117117
# Debug runs
118-
#FLAGS_NOAH = -O0 -p -g -warn nounused -autodouble -noerror_limit -FR -auto -WB -traceback -fltconsistency
118+
#FLAGS_NOAH = -O0 -p -g -warn nounused -noerror_limit -FR -auto -WB -traceback -fltconsistency
119119
#FLAGS_COMM = -O0 -p -g -debug -warn all -check all -FR -auto -WB -traceback -fltconsistency -fpe0
120120
#FLAGS_SUMMA = -O0 -p -g -debug -warn all -check all -FR -auto -WB -traceback -fltconsistency -fpe0
121121
endif
@@ -357,7 +357,7 @@ update_version:
357357

358358
# compile Noah-MP routines
359359
compile_noah:
360-
$(FC_EXE) $(FLAGS_NOAH) -c $(NOAHMP)
360+
$(FC_EXE) $(FLAGS_NOAH) -c $(NRUTIL) $(NOAHMP)
361361

362362
# compile common routines
363363
compile_comm:

build/source/driver/summa_defineOutput.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ subroutine summa_defineOutputFiles(modelTimeStep, summa1_struc, err, message)
100100
! *** define the name of the model output file
101101
! *****************************************************************************
102102

103-
! define full name of output file
103+
! define full name of output file
104104
if(modelTimeStep==1)then
105105
select case(newOutputFile)
106106
case(noNewFiles); ! do nothing, just ensure validity of outputfile option
107-
case(newFileEveryOct1);
107+
case(newFileEveryOct1);
108108
case default; err=20; message=trim(message)//'unable to identify the option to define new output files'; return
109109
end select
110110

@@ -141,7 +141,7 @@ subroutine summa_defineOutputFiles(modelTimeStep, summa1_struc, err, message)
141141
end do ! (looping through HRUs)
142142

143143
! write GRU parameters
144-
call writeParm(integerMissing,bparStruct%gru(iGRU),bpar_meta,err,cmessage)
144+
call writeParm(iGRU,bparStruct%gru(iGRU),bpar_meta,err,cmessage)
145145
if(err/=0)then; message=trim(message)//trim(cmessage); return; endif
146146

147147
end do ! (looping through GRUs)

build/source/driver/summa_globalData.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ subroutine summa_defineGlobalData(err, message)
107107
doJacobian=.false. ! initialize the Jacobian flag
108108

109109
! define double precision NaNs (shared in globalData)
110-
dNaN = ieee_value(1._dp, ieee_quiet_nan)
110+
dNaN = ieee_value(1._rkind, ieee_quiet_nan)
111111

112112
! populate metadata for all model variables
113113
call popMetadat(err,cmessage)

build/source/driver/summa_init.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,9 @@ subroutine summa_initialize(summa1_struc, err, message)
175175
ncid(:) = integerMissing
176176

177177
! initialize the elapsed time for cumulative quantities
178-
elapsedRead=0._dp
179-
elapsedWrite=0._dp
180-
elapsedPhysics=0._dp
178+
elapsedRead=0._rkind
179+
elapsedWrite=0._rkind
180+
elapsedPhysics=0._rkind
181181

182182
! get the command line arguments
183183
call getCommandArguments(summa1_struc,err,cmessage)

build/source/driver/summa_modelRun.f90

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,16 @@ subroutine summa_runPhysics(modelTimeStep, summa1_struc, err, message)
7272
integer(i4b) :: iGRU,jGRU,kGRU ! GRU indices
7373
! local variables: veg phenology
7474
logical(lgt) :: computeVegFluxFlag ! flag to indicate if we are computing fluxes over vegetation (.false. means veg is buried with snow)
75-
real(dp) :: notUsed_canopyDepth ! NOT USED: canopy depth (m)
76-
real(dp) :: notUsed_exposedVAI ! NOT USED: exposed vegetation area index (m2 m-2)
75+
real(rkind) :: notUsed_canopyDepth ! NOT USED: canopy depth (m)
76+
real(rkind) :: notUsed_exposedVAI ! NOT USED: exposed vegetation area index (m2 m-2)
7777
! local variables: parallelize the model run
7878
integer(i4b), allocatable :: ixExpense(:) ! ranked index GRU w.r.t. computational expense
7979
integer(i4b), allocatable :: totalFluxCalls(:) ! total number of flux calls for each GRU
8080
! local variables: timing information
8181
integer*8 :: openMPstart,openMPend ! time for the start of the parallelization section
8282
integer*8, allocatable :: timeGRUstart(:) ! time GRUs start
83-
real(dp), allocatable :: timeGRUcompleted(:) ! time required to complete each GRU
84-
real(dp), allocatable :: timeGRU(:) ! time spent on each GRU
83+
real(rkind), allocatable :: timeGRUcompleted(:) ! time required to complete each GRU
84+
real(rkind), allocatable :: timeGRU(:) ! time spent on each GRU
8585
! ---------------------------------------------------------------------------------------
8686
! associate to elements in the data structure
8787
summaVars: associate(&
@@ -171,7 +171,7 @@ subroutine summa_runPhysics(modelTimeStep, summa1_struc, err, message)
171171

172172
! compute the total number of flux calls from the previous time step
173173
do jGRU=1,nGRU
174-
totalFluxCalls(jGRU) = 0._dp
174+
totalFluxCalls(jGRU) = 0._rkind
175175
do iHRU=1,gru_struc(jGRU)%hruCount
176176
totalFluxCalls(jGRU) = totalFluxCalls(jGRU) + indxStruct%gru(jGRU)%hru(iHRU)%var(iLookINDEX%numberFluxCalc)%dat(1)
177177
end do
@@ -268,8 +268,8 @@ subroutine summa_runPhysics(modelTimeStep, summa1_struc, err, message)
268268
!$omp critical(saveTiming)
269269
! save timing information
270270
call system_clock(openMPend)
271-
timeGRU(iGRU) = real(openMPend - timeGRUstart(iGRU), kind(dp))
272-
timeGRUcompleted(iGRU) = real(openMPend - openMPstart , kind(dp))
271+
timeGRU(iGRU) = real(openMPend - timeGRUstart(iGRU), kind(rkind))
272+
timeGRUcompleted(iGRU) = real(openMPend - openMPstart , kind(rkind))
273273
!$omp end critical(saveTiming)
274274

275275
end do ! (looping through GRUs)

build/source/driver/summa_restart.f90

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ subroutine summa_readRestart(summa1_struc, err, message)
178178

179179
! initialize canopy drip
180180
! NOTE: canopy drip from the previous time step is used to compute throughfall for the current time step
181-
fluxStruct%gru(iGRU)%hru(iHRU)%var(iLookFLUX%scalarCanopyLiqDrainage)%dat(1) = 0._dp ! not used
181+
fluxStruct%gru(iGRU)%hru(iHRU)%var(iLookFLUX%scalarCanopyLiqDrainage)%dat(1) = 0._rkind ! not used
182182

183183
end do ! end looping through HRUs
184184

@@ -201,14 +201,14 @@ subroutine summa_readRestart(summa1_struc, err, message)
201201

202202
! the basin-average aquifer storage is not used if the groundwater is included in the local column
203203
case(localColumn)
204-
bvarStruct%gru(iGRU)%var(iLookBVAR%basin__AquiferStorage)%dat(1) = 0._dp ! set to zero to be clear that there is no basin-average aquifer storage in this configuration
204+
bvarStruct%gru(iGRU)%var(iLookBVAR%basin__AquiferStorage)%dat(1) = 0._rkind ! set to zero to be clear that there is no basin-average aquifer storage in this configuration
205205

206206
! the local column aquifer storage is not used if the groundwater is basin-average
207207
! (i.e., where multiple HRUs drain to a basin-average aquifer)
208208
case(singleBasin)
209-
bvarStruct%gru(iGRU)%var(iLookBVAR%basin__AquiferStorage)%dat(1) = 1._dp
209+
bvarStruct%gru(iGRU)%var(iLookBVAR%basin__AquiferStorage)%dat(1) = 1._rkind
210210
do iHRU=1,gru_struc(iGRU)%hruCount
211-
progStruct%gru(iGRU)%hru(iHRU)%var(iLookPROG%scalarAquiferStorage)%dat(1) = 0._dp ! set to zero to be clear that there is no local aquifer storage in this configuration
211+
progStruct%gru(iGRU)%hru(iHRU)%var(iLookPROG%scalarAquiferStorage)%dat(1) = 0._rkind ! set to zero to be clear that there is no local aquifer storage in this configuration
212212
end do
213213

214214
! error check

build/source/driver/summa_setup.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ subroutine summa_paramSetup(summa1_struc, err, message)
191191
! *****************************************************************************
192192

193193
! define monthly fraction of green vegetation
194-
greenVegFrac_monthly = (/0.01_dp, 0.02_dp, 0.03_dp, 0.07_dp, 0.50_dp, 0.90_dp, 0.95_dp, 0.96_dp, 0.65_dp, 0.24_dp, 0.11_dp, 0.02_dp/)
194+
greenVegFrac_monthly = (/0.01_rkind, 0.02_rkind, 0.03_rkind, 0.07_rkind, 0.50_rkind, 0.90_rkind, 0.95_rkind, 0.96_rkind, 0.65_rkind, 0.24_rkind, 0.11_rkind, 0.02_rkind/)
195195

196196
! read Noah soil and vegetation tables
197197
call soil_veg_gen_parm(trim(SETTINGS_PATH)//trim(VEGPARM), & ! filename for vegetation table
@@ -298,7 +298,7 @@ subroutine summa_paramSetup(summa1_struc, err, message)
298298

299299
! compute total area of the upstream HRUS that flow into each HRU
300300
do iHRU=1,gru_struc(iGRU)%hruCount
301-
upArea%gru(iGRU)%hru(iHRU) = 0._dp
301+
upArea%gru(iGRU)%hru(iHRU) = 0._rkind
302302
do jHRU=1,gru_struc(iGRU)%hruCount
303303
! check if jHRU flows into iHRU; assume no exchange between GRUs
304304
if(typeStruct%gru(iGRU)%hru(jHRU)%var(iLookTYPE%downHRUindex)==typeStruct%gru(iGRU)%hru(iHRU)%var(iLookID%hruId))then
@@ -309,7 +309,7 @@ subroutine summa_paramSetup(summa1_struc, err, message)
309309

310310
! identify the total basin area for a GRU (m2)
311311
associate(totalArea => bvarStruct%gru(iGRU)%var(iLookBVAR%basin__totalArea)%dat(1) )
312-
totalArea = 0._dp
312+
totalArea = 0._rkind
313313
do iHRU=1,gru_struc(iGRU)%hruCount
314314
totalArea = totalArea + attrStruct%gru(iGRU)%hru(iHRU)%var(iLookATTR%HRUarea)
315315
end do

0 commit comments

Comments
 (0)