From 0df1704e7171abdf33ebf87381772c96cd3998cf Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 3 Aug 2018 12:05:05 -0600 Subject: [PATCH 01/16] Do not allow SOYFIXN diagnostic field with FUN With FUN on, SOYFIXN is not calculated so reporting it as zeros is misleading to users. Fixes #419 --- src/biogeochem/CNVegNitrogenFluxType.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/biogeochem/CNVegNitrogenFluxType.F90 b/src/biogeochem/CNVegNitrogenFluxType.F90 index 6836fd74a1..47b620bf91 100644 --- a/src/biogeochem/CNVegNitrogenFluxType.F90 +++ b/src/biogeochem/CNVegNitrogenFluxType.F90 @@ -950,7 +950,7 @@ subroutine InitHistory(this, bounds) ptr_patch=this%fert_patch) end if - if (use_crop) then + if (use_crop .and. .not. use_fun) then this%soyfixn_patch(begp:endp) = spval call hist_addfld1d (fname='SOYFIXN', units='gN/m^2/s', & avgflag='A', long_name='soybean fixation', & From 0a36ae0d8058c887f40c358a70bcb26d66db4515 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 3 Aug 2018 12:28:11 -0600 Subject: [PATCH 02/16] Remove broken ncd_io_1d_log_glob For now I'm just removing the ability to try to call this with a 1-d logical, rather than trying to fix the code. Fixes #24 --- src/main/ncdio_pio.F90.in | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/src/main/ncdio_pio.F90.in b/src/main/ncdio_pio.F90.in index 58f26636bf..6de8acb363 100644 --- a/src/main/ncdio_pio.F90.in +++ b/src/main/ncdio_pio.F90.in @@ -104,7 +104,7 @@ module ncdio_pio interface ncd_io module procedure ncd_io_char_var0_start_glob - !DIMS 0,1 + !DIMS 0 module procedure ncd_io_{DIMS}d_log_glob !DIMS 0,1,2,3 @@ -1192,11 +1192,11 @@ contains end subroutine ncd_io_char_var0_start_glob !------------------------------------------------------------------------ - !DIMS 0,1 + !DIMS 0 subroutine ncd_io_{DIMS}d_log_glob(varname, data, flag, ncid, readvar, nt, posNOTonfile) ! ! !DESCRIPTION: - ! netcdf I/O of global integer variable + ! netcdf I/O of global logical variable ! ! !ARGUMENTS: class(file_desc_t) , intent(inout) :: ncid ! netcdf file id @@ -1242,12 +1242,7 @@ contains call shr_sys_abort(' ERROR: bad integer value for logical data'//errMsg(sourcefile, __LINE__)) end if #else - allocate(idata1d(size(data))) - data = (idata1d == 1) - if ( any(idata1d /= 0 .and. idata1d /= 1) )then - call shr_sys_abort(' ERROR: read in bad integer value(s) for logical data'//errMsg(sourcefile, __LINE__)) - end if - deallocate(idata1d) + call shr_sys_abort('ncd_io_*_log_glob not implemented for DIMS > 0') #endif endif if (present(readvar)) readvar = varpresent @@ -1267,18 +1262,7 @@ contains status = pio_put_var(ncid, varid, start, count, idata1d) deallocate(idata1d) #else - start(1) = 1 ; count(1) = size(data) - start(2) = 1 ; count(2) = 1 - if (present(nt)) start(2) = nt - allocate(idata1d(size(data))) - where( data ) - idata1d = 1 - elsewhere - idata1d = 0 - end where - call ncd_inqvid (ncid, varname, varid, vardesc) - status = pio_put_var(ncid, varid, start, count, idata1d) - deallocate( idata1d ) + call shr_sys_abort('ncd_io_*_log_glob not implemented for DIMS > 0') #endif endif ! flag From 372fa8e8cf77b7c438657d10fd6c1165661b4ef1 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 3 Aug 2018 12:39:34 -0600 Subject: [PATCH 03/16] Replace a prebeta test with a similar test in the aux_clm test suite Fixes #467 --- cime_config/testdefs/testlist_clm.xml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 5adc7d615d..fbfa8eed3c 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -657,14 +657,6 @@ - - - - - - - - @@ -753,6 +745,7 @@ + From 714e0c69a520a97c8aa35e491dd330c490d5d7a9 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 3 Aug 2018 12:47:55 -0600 Subject: [PATCH 04/16] Fix documentation of hr and hr_road_perv Fixes #120 --- src/biogeophys/CanopyTemperatureMod.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/biogeophys/CanopyTemperatureMod.F90 b/src/biogeophys/CanopyTemperatureMod.F90 index 97fc45884f..de9c977f93 100644 --- a/src/biogeophys/CanopyTemperatureMod.F90 +++ b/src/biogeophys/CanopyTemperatureMod.F90 @@ -110,8 +110,8 @@ subroutine CanopyTemperature(bounds, & real(r8) :: qsatgdT ! d(qsatg)/dT real(r8) :: fac ! soil wetness of surface layer real(r8) :: psit ! negative potential of soil - real(r8) :: hr ! relative humidity - real(r8) :: hr_road_perv ! relative humidity for urban pervious road + real(r8) :: hr ! alpha soil + real(r8) :: hr_road_perv ! alpha soil for urban pervious road real(r8) :: wx ! partial volume of ice and water of surface layer real(r8) :: fac_fc ! soil wetness of surface layer relative to field capacity real(r8) :: eff_porosity ! effective porosity in layer From 3426fb65f71f2ddc3d1805752fd78e90c3d5f852 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 3 Aug 2018 13:11:54 -0600 Subject: [PATCH 05/16] Change a gnu debug test to intel gnu can't catch all of the issues that intel, pgi or nag can in debug mode: see ESMCI/cime#1974 . Therefore, it would be best if we avoided having our only debug tests of certain options be with gnu. Fixes #217 --- cime_config/testdefs/testlist_clm.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index fbfa8eed3c..a94ff67dee 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1343,10 +1343,10 @@ - + - + From 216d58964f388229d9eac8e5aac130d863a4efbe Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 3 Aug 2018 13:37:08 -0600 Subject: [PATCH 06/16] Move all .gitignore entries to top-level .gitignore From some googling, it seems this is the most common convention. Also, use a leading slash for files in specific places (/foo/bar.x says: ignore the exact file /PATH/TO/REPO/ROOT/foo/bar.x; foo/bar.x says: ignore any file with path foo/bar.x, including, for example, /PATH/TO/REPO/ROOT/some/intermediate/path/foo/bar.x) Fixes #245 --- .gitignore | 61 ++++++++++++++++------------ src/dyn_subgrid/.gitignore | 4 -- src/unit_test_shr/.gitignore | 2 - src/unit_test_stubs/main/.gitignore | 3 -- src/unit_test_stubs/utils/.gitignore | 2 - src/utils/.gitignore | 2 - 6 files changed, 34 insertions(+), 40 deletions(-) delete mode 100644 src/dyn_subgrid/.gitignore delete mode 100644 src/unit_test_shr/.gitignore delete mode 100644 src/unit_test_stubs/main/.gitignore delete mode 100644 src/unit_test_stubs/utils/.gitignore delete mode 100644 src/utils/.gitignore diff --git a/.gitignore b/.gitignore index abebdd6657..d8000a5537 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,10 @@ # directories checked out by manage_externals, and other files created # by manage_externals manage_externals.log -src/fates/ -tools/PTCLM/ -cime/ -components/ +/src/fates/ +/tools/PTCLM/ +/cime/ +/components/ # ignore svn directories **/.svn/** @@ -26,28 +26,35 @@ CMakeFiles/ # unit testing directories -src/unit_tests.* +/src/unit_tests.* + +# files generated by the unit test build +/src/dyn_subgrid/dynVarMod.F90 +/src/dyn_subgrid/dynVarTimeInterpMod.F90 +/src/dyn_subgrid/dynVarTimeUninterpMod.F90 +/src/utils/array_utils.F90 +/src/unit_test_stubs/utils/restUtilMod_stub.F90 +/src/unit_test_stubs/main/ncdio_pio_fake.F90 +/src/unit_test_stubs/main/ncdio_var.F90 +/src/unit_test_shr/unittestArrayMod.F90 # cime_config buildnmlc buildcppc -# don't ignore cism build utilities directory -!components/cism/**/build - # configure / build files -bld/**/CESM_cppdefs -bld/**/Filepath -bld/**/config_cache.xml -bld/**/lnd_in -bld/**/drv_flds_in +/bld/**/CESM_cppdefs +/bld/**/Filepath +/bld/**/config_cache.xml +/bld/**/lnd_in +/bld/**/drv_flds_in # build-naemlist testing -bld/unit_testers/lnd_in* -bld/unit_testers/drv_flds_in* -bld/unit_testers/temp_file.txt* -bld/unit_testers/user_nl_clm_real_parameters* -bld/unit_testers/env_run.xml +/bld/unit_testers/lnd_in* +/bld/unit_testers/drv_flds_in* +/bld/unit_testers/temp_file.txt* +/bld/unit_testers/user_nl_clm_real_parameters* +/bld/unit_testers/env_run.xml # tools testing output td.*.status @@ -66,19 +73,19 @@ clm.input_data_list.previous *.stdout.txt.o* # Tools executables -tools/mksurfdata_map/mksurfdata_map -tools/mkprocdata_map/mkprocdata_map +/tools/mksurfdata_map/mksurfdata_map +/tools/mkprocdata_map/mkprocdata_map # mksurfdata output files -tools/mksurfdata_map/surfdata_*.nc -tools/mksurfdata_map/landuse.timeseries_*.nc +/tools/mksurfdata_map/surfdata_*.nc +/tools/mksurfdata_map/landuse.timeseries_*.nc # mkmapdata output files -tools/mkmapdata/PET*.RegridWeightGen.Log -tools/mkmapdata/regrid.*.out -tools/mkmapdata/regrid.*.err -tools/mkmapdata/regrid.o* -tools/mkmapdata/map*.nc +/tools/mkmapdata/PET*.RegridWeightGen.Log +/tools/mkmapdata/regrid.*.out +/tools/mkmapdata/regrid.*.err +/tools/mkmapdata/regrid.o* +/tools/mkmapdata/map*.nc # build output *.o diff --git a/src/dyn_subgrid/.gitignore b/src/dyn_subgrid/.gitignore deleted file mode 100644 index 52f24730b5..0000000000 --- a/src/dyn_subgrid/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# files generated by genf90 in the unit test build -dynVarMod.F90 -dynVarTimeInterpMod.F90 -dynVarTimeUninterpMod.F90 diff --git a/src/unit_test_shr/.gitignore b/src/unit_test_shr/.gitignore deleted file mode 100644 index 70bacd9621..0000000000 --- a/src/unit_test_shr/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# files generated by genf90 in the unit test build -unittestArrayMod.F90 diff --git a/src/unit_test_stubs/main/.gitignore b/src/unit_test_stubs/main/.gitignore deleted file mode 100644 index a457979e10..0000000000 --- a/src/unit_test_stubs/main/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# files generated by genf90 in the unit test build -ncdio_pio_fake.F90 -ncdio_var.F90 diff --git a/src/unit_test_stubs/utils/.gitignore b/src/unit_test_stubs/utils/.gitignore deleted file mode 100644 index 9e11aa7f64..0000000000 --- a/src/unit_test_stubs/utils/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# files generated by genf90 in the unit test build -restUtilMod_stub.F90 diff --git a/src/utils/.gitignore b/src/utils/.gitignore deleted file mode 100644 index 79fcba6e26..0000000000 --- a/src/utils/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# files generated by genf90 in the unit test build -array_utils.F90 From 576702dad668fd5a76793496a3c73f77d22270a0 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 3 Aug 2018 14:07:54 -0600 Subject: [PATCH 07/16] Abort if mxsoil_color is not on surface dataset Aborting is safer than assuming 8 classes, and avoids possibly cryptic errors Fixes #272 --- src/biogeophys/SurfaceAlbedoMod.F90 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/biogeophys/SurfaceAlbedoMod.F90 b/src/biogeophys/SurfaceAlbedoMod.F90 index 324d37207c..9ad3229543 100644 --- a/src/biogeophys/SurfaceAlbedoMod.F90 +++ b/src/biogeophys/SurfaceAlbedoMod.F90 @@ -112,13 +112,14 @@ subroutine SurfaceAlbedoInitTimeConst(bounds) allocate(isoicol(bounds%begc:bounds%endc)) ! Determine soil color and number of soil color classes - ! if number of soil color classes is not on input dataset set it to 8 call getfil (fsurdat, locfn, 0) call ncd_pio_openfile (ncid, locfn, 0) call ncd_io(ncid=ncid, varname='mxsoil_color', flag='read', data=mxsoil_color, readvar=readvar) - if ( .not. readvar ) mxsoil_color = 8 + if ( .not. readvar ) then + call endrun(msg=' ERROR: mxsoil_color NOT on surfdata file '//errMsg(sourcefile, __LINE__)) + end if allocate(soic2d(bounds%begg:bounds%endg)) call ncd_io(ncid=ncid, varname='SOIL_COLOR', flag='read', data=soic2d, dim1name=grlnd, readvar=readvar) From efdf0e78bf2ae12a870aacb83fd98e74a570c843 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 3 Aug 2018 14:17:27 -0600 Subject: [PATCH 08/16] Add helpful message if levgrnd differs on restart file Suggest using init_interp, as is suggested if levsno differs Fixes #283 --- src/main/restFileMod.F90 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/restFileMod.F90 b/src/main/restFileMod.F90 index 9beeec1b92..c352572d02 100644 --- a/src/main/restFileMod.F90 +++ b/src/main/restFileMod.F90 @@ -714,10 +714,10 @@ subroutine restFile_dimcheck( ncid ) call check_dim(ncid, namep, nump, msg=msg) if ( use_fates ) call check_dim(ncid, nameCohort , numCohort, msg=msg) end if - call check_dim(ncid, 'levsno' , nlevsno, & - msg = 'You can deal with this mismatch by rerunning with ' // & - 'use_init_interp = .true. in user_nl_clm') - call check_dim(ncid, 'levgrnd' , nlevgrnd) + msg = 'You can deal with this mismatch by rerunning with ' // & + 'use_init_interp = .true. in user_nl_clm' + call check_dim(ncid, 'levsno' , nlevsno, msg=msg) + call check_dim(ncid, 'levgrnd' , nlevgrnd, msg=msg) call check_dim(ncid, 'levurb' , nlevurb) call check_dim(ncid, 'levlak' , nlevlak) From d5d2107ea67a20f44a5f6542d3142b41151dbd2a Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 3 Aug 2018 14:28:10 -0600 Subject: [PATCH 09/16] For cmip6 runs, turn on histaux_l2x1yrg Land Ice Working Group members request that, for cmip6 runs, we output the coupler history fields needed to drive a later TG compset (CISM-only forced by dlnd). Fixes #367 --- cime_config/usermods_dirs/cmip6_output/user_nl_cpl | 1 + 1 file changed, 1 insertion(+) create mode 100644 cime_config/usermods_dirs/cmip6_output/user_nl_cpl diff --git a/cime_config/usermods_dirs/cmip6_output/user_nl_cpl b/cime_config/usermods_dirs/cmip6_output/user_nl_cpl new file mode 100644 index 0000000000..ba776735ff --- /dev/null +++ b/cime_config/usermods_dirs/cmip6_output/user_nl_cpl @@ -0,0 +1 @@ +histaux_l2x1yrg = .true. From d116afe59f7f5eabbc686b7f815aa2cb9a3ea6a0 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 3 Aug 2018 15:36:41 -0600 Subject: [PATCH 10/16] Fix documentation of init_interp_method The documentation for init_interp_method said that the method use_finidat_areas can be used when transitioning from a spinup to a transient run. But I realized that this isn't true in general, because spinup runs typically have irrigation off and transient runs have irrigation on. Fixes #412 --- .../namelist_definition_clm4_5.xml | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/bld/namelist_files/namelist_definition_clm4_5.xml b/bld/namelist_files/namelist_definition_clm4_5.xml index afb8c97818..0a4bbd9a28 100644 --- a/bld/namelist_files/namelist_definition_clm4_5.xml +++ b/bld/namelist_files/namelist_definition_clm4_5.xml @@ -2432,20 +2432,24 @@ to the atmosphere) (but using the 'general' method will typically have only a very minor impact on results in this case). For this method to work, the input finidat file needs to be at the same resolution as the current configuration. So this is a less general form of -init_interp. However, it can be used when transitioning from a spinup -run to a transient run, or in other cases where the only difference is -in internal memory allocation. In order to catch possible problems, this -uses a different algorithm for finding the input point for each output -point, which ensures that each active output point is associated with -exactly one input point with the same latitude, longitude and type. This -method requires (a) the same grid for input and output, within roundoff; -(b) any non-zero-weight point in the input must have memory allocated -for it in this grid cell in the output (this will be satisfied if the -point is non-zero-weight on the surface dataset or if it's a point for -which we allocate memory even for zero-weight points); (c) any active -point in the output (based on the surface dataset and rules for -determining active points) must have a matching point in this grid cell -in the input. +init_interp. However, it can be used in cases where the only difference +is in internal memory allocation. In order to catch possible problems, +this uses a different algorithm for finding the input point for each +output point, which ensures that each active output point is associated +with exactly one input point with the same latitude, longitude and +type. This method requires (a) the same grid for input and output, +within roundoff; (b) any non-zero-weight point in the input must have +memory allocated for it in this grid cell in the output (this will be +satisfied if the point is non-zero-weight on the surface dataset or if +it's a point for which we allocate memory even for zero-weight points); +(c) any active point in the output (based on the surface dataset and +rules for determining active points) must have a matching point in this +grid cell in the input. (Note that this generally can NOT be used when +transitioning from a spinup run to a transient run, because spinup runs +typically have irrigation off and transient runs have irrigation on, and +the presence/absence of irrigation affects the subgrid structure; if it +weren't for that difference, then this option would be useful for this +use case.) From 21330dc04cec220881db6d666f2de032faac7829 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 3 Aug 2018 15:49:41 -0600 Subject: [PATCH 11/16] Remove trailing whitespace on lines longer than 132 characters The only problem was trailing whitespace, but it was causing failures in https://github.com/NCAR/code-format-checker (run with code-format-checker/CodeFormatChecker.py -t rc -l 133) that I wanted to clean up. --- src/biogeochem/CNDriverMod.F90 | 2 +- src/biogeochem/CNFUNMod.F90 | 2 +- src/biogeochem/CNGapMortalityMod.F90 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/biogeochem/CNDriverMod.F90 b/src/biogeochem/CNDriverMod.F90 index 83a58f2c42..edce6c7095 100644 --- a/src/biogeochem/CNDriverMod.F90 +++ b/src/biogeochem/CNDriverMod.F90 @@ -754,7 +754,7 @@ subroutine CNDriverNoLeaching(bounds, dgvs_inst, cnveg_state_inst, & cnveg_carbonstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenstate_inst, cnveg_nitrogenflux_inst, & leaf_prof_patch=soilbiogeochem_state_inst%leaf_prof_patch(begp:endp, 1:nlevdecomp_full), & - froot_prof_patch=soilbiogeochem_state_inst%froot_prof_patch(begp:endp, 1:nlevdecomp_full), & + froot_prof_patch=soilbiogeochem_state_inst%froot_prof_patch(begp:endp, 1:nlevdecomp_full), & croot_prof_patch=soilbiogeochem_state_inst%croot_prof_patch(begp:endp, 1:nlevdecomp_full), & stem_prof_patch=soilbiogeochem_state_inst%stem_prof_patch(begp:endp, 1:nlevdecomp_full), & totsomc_col=soilbiogeochem_carbonstate_inst%totsomc_col(begc:endc), & diff --git a/src/biogeochem/CNFUNMod.F90 b/src/biogeochem/CNFUNMod.F90 index 98adfc36e2..f1adee8f6b 100644 --- a/src/biogeochem/CNFUNMod.F90 +++ b/src/biogeochem/CNFUNMod.F90 @@ -1236,7 +1236,7 @@ subroutine CNFUN(bounds,num_soilc, filter_soilc,num_soilp& frac_ideal_C_use = max(0.0_r8,1.0_r8 - (total_N_resistance-fun_cn_flex_a(ivt(p)))/fun_cn_flex_b(ivt(p)) ) ! then, if the plant is very much in need of N, the C used for uptake is increased accordingly. if(delta_CN .gt.0.and. frac_ideal_C_use.lt.1.0)then - frac_ideal_C_use = frac_ideal_C_use + (1.0_r8-frac_ideal_C_use)*min(1.0_r8, delta_CN/fun_cn_flex_c(ivt(p))); + frac_ideal_C_use = frac_ideal_C_use + (1.0_r8-frac_ideal_C_use)*min(1.0_r8, delta_CN/fun_cn_flex_c(ivt(p))) end if ! If we have too much N (e.g. from free N retranslocation) then make frac_ideal_c_use even lower. ! For a CN delta of fun_cn_flex_c, then we reduce C expendiure to the minimum of 0.5. diff --git a/src/biogeochem/CNGapMortalityMod.F90 b/src/biogeochem/CNGapMortalityMod.F90 index a2f8c4fd89..939d4b52eb 100644 --- a/src/biogeochem/CNGapMortalityMod.F90 +++ b/src/biogeochem/CNGapMortalityMod.F90 @@ -193,7 +193,7 @@ subroutine CNGapMortality (bounds, num_soilc, filter_soilc, num_soilp, filter_so cnveg_carbonflux_inst%m_livecrootc_to_litter_patch(p) = cnveg_carbonstate_inst%livecrootc_patch(p) * m if (spinup_state == 2 .and. .not. use_cndv) then !accelerate mortality of dead woody pools cnveg_carbonflux_inst%m_deadstemc_to_litter_patch(p) = cnveg_carbonstate_inst%deadstemc_patch(p) * m * 10._r8 - cnveg_carbonflux_inst%m_deadcrootc_to_litter_patch(p) = cnveg_carbonstate_inst%deadcrootc_patch(p) * m * 10._r8 + cnveg_carbonflux_inst%m_deadcrootc_to_litter_patch(p) = cnveg_carbonstate_inst%deadcrootc_patch(p) * m * 10._r8 else cnveg_carbonflux_inst%m_deadstemc_to_litter_patch(p) = cnveg_carbonstate_inst%deadstemc_patch(p) * m cnveg_carbonflux_inst%m_deadcrootc_to_litter_patch(p) = cnveg_carbonstate_inst%deadcrootc_patch(p) * m From 5fbbab83b205974f65bf079638edb855b71ef921 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 3 Aug 2018 16:04:36 -0600 Subject: [PATCH 12/16] Remove old code that looks no longer needed It looks like this was there for backwards compatibility, but I can't imagine it being needed any more. The removed code block was messier than before now that we have separated WaterStateType, so it seemed time to remove it. --- src/biogeophys/WaterDiagnosticBulkType.F90 | 37 ++++++---------------- src/biogeophys/WaterType.F90 | 3 +- 2 files changed, 11 insertions(+), 29 deletions(-) diff --git a/src/biogeophys/WaterDiagnosticBulkType.F90 b/src/biogeophys/WaterDiagnosticBulkType.F90 index 8c9c7330a0..e97610e2be 100644 --- a/src/biogeophys/WaterDiagnosticBulkType.F90 +++ b/src/biogeophys/WaterDiagnosticBulkType.F90 @@ -15,6 +15,7 @@ module WaterDiagnosticBulkType use shr_kind_mod , only : r8 => shr_kind_r8 use shr_log_mod , only : errMsg => shr_log_errMsg use decompMod , only : bounds_type + use abortutils , only : endrun use clm_varctl , only : use_cn, iulog, use_luna use clm_varpar , only : nlevgrnd, nlevurb, nlevsno use clm_varcon , only : spval @@ -485,7 +486,6 @@ subroutine InitBulkCold(this, bounds, & use clm_varctl , only : fsurdat, iulog use clm_varctl , only : use_bedrock use spmdMod , only : masterproc - use abortutils , only : endrun use fileutils , only : getfil use ncdio_pio , only : file_desc_t, ncd_io ! @@ -583,7 +583,7 @@ subroutine InitBulkCold(this, bounds, & end subroutine InitBulkCold !------------------------------------------------------------------------ - subroutine RestartBulk(this, bounds, ncid, flag, waterstatebulk_inst) + subroutine RestartBulk(this, bounds, ncid, flag) ! ! !DESCRIPTION: ! Read/Write module information to/from restart file. @@ -603,10 +603,8 @@ subroutine RestartBulk(this, bounds, ncid, flag, waterstatebulk_inst) type(bounds_type), intent(in) :: bounds type(file_desc_t), intent(inout) :: ncid ! netcdf id character(len=*) , intent(in) :: flag ! 'read' or 'write' - class(waterstatebulk_type), intent(in) :: waterstatebulk_inst ! ! !LOCAL VARIABLES: - integer :: c,l,j logical :: readvar !------------------------------------------------------------------------ @@ -695,32 +693,17 @@ subroutine RestartBulk(this, bounds, ncid, flag, waterstatebulk_inst) units='um', & interpinic_flag='interp', readvar=readvar, data=this%snw_rds_col) if (flag == 'read' .and. .not. readvar) then - - ! initial run, not restart: initialize snw_rds + ! NOTE(wjs, 2018-08-03) There was some code here that looked like it was just for + ! the sake of backwards compatibility, dating back to 2014 or earlier. I was + ! tempted to just remove it, but on the off-chance that this conditional is still + ! ever entered, I'm putting an endrun call here to notify users of this removed + ! code. if (masterproc) then write(iulog,*) "SNICAR: This is an initial run (not a restart), and grain size/aerosol " // & - "mass data are not defined in initial condition file. Initialize snow " // & - "effective radius to fresh snow value, and snow/aerosol masses to zero." + "mass data are not defined in initial condition file. This situation is no longer handled." endif - - do c= bounds%begc, bounds%endc - if (col%snl(c) < 0) then - this%snw_rds_col(c,col%snl(c)+1:0) = snw_rds_min - this%snw_rds_col(c,-nlevsno+1:col%snl(c)) = 0._r8 - this%snw_rds_top_col(c) = snw_rds_min - this%sno_liq_top_col(c) = waterstatebulk_inst%h2osoi_liq_col(c,col%snl(c)+1) / & - (waterstatebulk_inst%h2osoi_liq_col(c,col%snl(c)+1)+waterstatebulk_inst%h2osoi_ice_col(c,col%snl(c)+1)) - elseif (waterstatebulk_inst%h2osno_col(c) > 0._r8) then - this%snw_rds_col(c,0) = snw_rds_min - this%snw_rds_col(c,-nlevsno+1:-1) = 0._r8 - this%snw_rds_top_col(c) = spval - this%sno_liq_top_col(c) = spval - else - this%snw_rds_col(c,:) = 0._r8 - this%snw_rds_top_col(c) = spval - this%sno_liq_top_col(c) = spval - endif - enddo + call endrun(msg = "Absent snw_rds on initial conditions file no longer handled. "// & + errMsg(sourcefile, __LINE__)) endif if (use_cn) then diff --git a/src/biogeophys/WaterType.F90 b/src/biogeophys/WaterType.F90 index 77fe7c8af1..664f20f423 100644 --- a/src/biogeophys/WaterType.F90 +++ b/src/biogeophys/WaterType.F90 @@ -328,8 +328,7 @@ subroutine Restart(this, bounds, ncid, flag, & call this%waterstatebulk_inst%restartBulk (bounds, ncid, flag=flag, & watsat_col=watsat_col(bounds%begc:bounds%endc,:)) - call this%waterdiagnosticbulk_inst%restartBulk (bounds, ncid, flag=flag, & - waterstatebulk_inst=this%waterstatebulk_inst) + call this%waterdiagnosticbulk_inst%restartBulk (bounds, ncid, flag=flag) do i = 1, this%num_tracers From 5207582a0cfa8f9d8f8be5c2097af83affcfceb4 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 3 Aug 2018 16:12:07 -0600 Subject: [PATCH 13/16] Split lines longer than 132 characters Checked with code-format-checker/CodeFormatChecker.py -t rc -l 133 (Note the off-by-one error in that script, hence the need for 133 rather than 132.) Fixes #464 --- src/biogeophys/CanopyFluxesMod.F90 | 5 +++-- src/biogeophys/CanopyTemperatureMod.F90 | 3 ++- src/biogeophys/HydrologyNoDrainageMod.F90 | 9 ++++++--- src/biogeophys/WaterFluxType.F90 | 3 ++- src/utils/clmfates_interfaceMod.F90 | 3 ++- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 59a67c0e93..68efaef95d 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -855,8 +855,9 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, svpts(begp:endp), eah(begp:endp), o2(begp:endp), co2(begp:endp), rb(begp:endp), bsun(begp:endp), & bsha(begp:endp), btran(begp:endp), dayl_factor(begp:endp), leafn_patch(begp:endp), & qsatl(begp:endp), qaf(begp:endp), & - atm2lnd_inst, temperature_inst, soilstate_inst, waterdiagnosticbulk_inst, surfalb_inst, solarabs_inst, & - canopystate_inst, ozone_inst, photosyns_inst, waterfluxbulk_inst, froot_carbon(begp:endp), croot_carbon(begp:endp)) + atm2lnd_inst, temperature_inst, soilstate_inst, waterdiagnosticbulk_inst, surfalb_inst, solarabs_inst, & + canopystate_inst, ozone_inst, photosyns_inst, waterfluxbulk_inst, & + froot_carbon(begp:endp), croot_carbon(begp:endp)) else call Photosynthesis (bounds, fn, filterp, & svpts(begp:endp), eah(begp:endp), o2(begp:endp), co2(begp:endp), rb(begp:endp), btran(begp:endp), & diff --git a/src/biogeophys/CanopyTemperatureMod.F90 b/src/biogeophys/CanopyTemperatureMod.F90 index 01b62cde29..d59b1d1697 100644 --- a/src/biogeophys/CanopyTemperatureMod.F90 +++ b/src/biogeophys/CanopyTemperatureMod.F90 @@ -227,7 +227,8 @@ subroutine CanopyTemperature(bounds, & end do ! calculate moisture stress/resistance for soil evaporation - call calc_soilevap_resis(bounds, num_nolakec, filter_nolakec, soilstate_inst, waterstatebulk_inst, waterdiagnosticbulk_inst, temperature_inst) + call calc_soilevap_resis(bounds, num_nolakec, filter_nolakec, & + soilstate_inst, waterstatebulk_inst, waterdiagnosticbulk_inst, temperature_inst) do fc = 1,num_nolakec c = filter_nolakec(fc) diff --git a/src/biogeophys/HydrologyNoDrainageMod.F90 b/src/biogeophys/HydrologyNoDrainageMod.F90 index a503d12d01..e03fd6b116 100644 --- a/src/biogeophys/HydrologyNoDrainageMod.F90 +++ b/src/biogeophys/HydrologyNoDrainageMod.F90 @@ -223,7 +223,9 @@ subroutine HydrologyNoDrainage(bounds, & call Compute_EffecRootFrac_And_VertTranSink(bounds, num_hydrologyc, & filter_hydrologyc, soilstate_inst, canopystate_inst, waterfluxbulk_inst, energyflux_inst) - if ( use_fates ) call clm_fates%ComputeRootSoilFlux(bounds, num_hydrologyc, filter_hydrologyc, soilstate_inst, waterfluxbulk_inst) + if ( use_fates ) then + call clm_fates%ComputeRootSoilFlux(bounds, num_hydrologyc, filter_hydrologyc, soilstate_inst, waterfluxbulk_inst) + end if call SoilWater(bounds, num_hydrologyc, filter_hydrologyc, num_urbanc, filter_urbanc, & soilhydrology_inst, soilstate_inst, waterfluxbulk_inst, waterstatebulk_inst, temperature_inst, & @@ -235,9 +237,10 @@ subroutine HydrologyNoDrainage(bounds, & soilhydrology_inst, waterstatebulk_inst) end if - if (use_aquifer_layer()) then + if (use_aquifer_layer()) then call WaterTable(bounds, num_hydrologyc, filter_hydrologyc, num_urbanc, filter_urbanc, & - soilhydrology_inst, soilstate_inst, temperature_inst, waterstatebulk_inst, waterdiagnosticbulk_inst, waterfluxbulk_inst) + soilhydrology_inst, soilstate_inst, temperature_inst, waterstatebulk_inst, & + waterdiagnosticbulk_inst, waterfluxbulk_inst) else call PerchedWaterTable(bounds, num_hydrologyc, filter_hydrologyc, & diff --git a/src/biogeophys/WaterFluxType.F90 b/src/biogeophys/WaterFluxType.F90 index 6a86eb0aa1..5e50558cb3 100644 --- a/src/biogeophys/WaterFluxType.F90 +++ b/src/biogeophys/WaterFluxType.F90 @@ -242,7 +242,8 @@ subroutine InitHistory(this, bounds) fname=this%info%fname('QRGWL'), & units='mm/s', & avgflag='A', & - long_name=this%info%lname('surface runoff at glaciers (liquid only), wetlands, lakes; also includes melted ice runoff from QSNWCPICE'), & + long_name=this%info%lname( & + 'surface runoff at glaciers (liquid only), wetlands, lakes; also includes melted ice runoff from QSNWCPICE'), & ptr_col=this%qflx_qrgwl_col, c2l_scale_type='urbanf') this%qflx_drain_col(begc:endc) = spval diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 5fa1b5f746..c09ca18bb1 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -1124,7 +1124,8 @@ end subroutine restart !===================================================================================== - subroutine init_coldstart(this, waterstatebulk_inst, waterdiagnosticbulk_inst, canopystate_inst, soilstate_inst, frictionvel_inst) + subroutine init_coldstart(this, waterstatebulk_inst, waterdiagnosticbulk_inst, & + canopystate_inst, soilstate_inst, frictionvel_inst) ! Arguments From 5c226bdf8492c0ea2e373e2be41d0ee9eef975e5 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sat, 4 Aug 2018 06:54:46 -0600 Subject: [PATCH 14/16] For some single-point tests on both gnu and intel: keep them on one We had a number of single-point tests that were duplicated on the gnu and intel compilers on cheyenne. @ekluzek introduced this duplication in bc06d49c. These tests take a long time to run (> 1 hour), and some of the long gnu tests were timing out (in my last run of the test suite, ERS_Lm54_Mmpi-serial.1x1_numaIA.I2000Clm50BgcCropGs.cheyenne_gnu.clm-cropMonthOutput and ERS_Ly6_Mmpi-serial.1x1_smallvilleIA.IHistClm50BgcCropGs.cheyenne_gnu.clm-cropMonthOutput timed out). I don't see any need for this duplication across compilers, so I'm keeping these tests on just a single compiler. My general rule was: keep short tests (< 4 years) on gnu, keep long tests on intel. This is because the intel tests run faster, but it's good to keep some tests on gnu. For the most part, this brings these tests back to how they were prior to bc06d49c, but we now have ERS_Ly6_Mmpi-serial.1x1_smallvilleIA.IHistClm50BgcCropGs.cheyenne_intel.clm-cropMonthOutput instead of gnu because this one timed-out on gnu. --- cime_config/testdefs/testlist_clm.xml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index a94ff67dee..88e3b2ed27 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -938,7 +938,6 @@ - @@ -948,7 +947,6 @@ - @@ -959,7 +957,6 @@ - @@ -969,7 +966,6 @@ - @@ -996,7 +992,6 @@ - @@ -1040,7 +1035,6 @@ - From 48ac8d75e5920ab24fc607e26853fb4b080bed7a Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sat, 4 Aug 2018 07:02:00 -0600 Subject: [PATCH 15/16] Remove a test from the expected fail list I removed this test in the last commit --- cime_config/testdefs/ExpectedTestFails.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml index e22a297ed7..50f2e889f1 100644 --- a/cime_config/testdefs/ExpectedTestFails.xml +++ b/cime_config/testdefs/ExpectedTestFails.xml @@ -4,7 +4,6 @@ FAIL ERP_D_Ld10_P36x2.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-ciso_decStart RUN FAIL ERS_Lm20_Mmpi-serial.1x1_smallvilleIA.I2000Clm50BgcCropGs.cheyenne_gnu.clm-monthly RUN - FAIL ERS_Lm20_Mmpi-serial.1x1_smallvilleIA.I2000Clm50BgcCropGs.cheyenne_intel.clm-monthly RUN FAIL ERP_D_Ld5.f09_g17.I2000Clm50Vic.cheyenne_intel.clm-vrtlay RUN FAIL SMS.f10_f10_musgs.I2000Clm50BgcCrop.hobart_pgi.clm-crop RUN FAIL SMS_D.f10_f10_musgs.I2000Clm50BgcCrop.hobart_pgi.clm-crop RUN From 899834153f9557ccbacba4fc995b1a614f1a5d47 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sat, 4 Aug 2018 07:48:28 -0600 Subject: [PATCH 16/16] Update ChangeLog --- doc/ChangeLog | 136 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 137 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index c255d208cd..225a0c8530 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,140 @@ =============================================================== +Tag name: ctsm1.0.dev006 +Originator(s): sacks (Bill Sacks) +Date: Sat Aug 4 07:48:09 MDT 2018 +One-line Summary: Minor bug fixes, cleanup, documentation and enhancements + +Purpose of changes +------------------ + +A collection of minor bug fixes, code cleanup, documentation and +enhancements, all bit-for-bit. See list of issues fixed below for +details. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Fixes #24 (ncd_io_1d_log_glob is broken) +- Fixes #120 (Incorrect comments in Biogeophysics1Mod.F90 +- Fixes #217 (Change some cheyenne_gnu tests to cheyenne_intel) +- Fixes #245 (Put all .gitignore entries in top-level file) +- Fixes #272 (Code should error on missing mxsoil_color when SOIL_COLOR + is used) +- Fixes #283 (Add more helpful message about need to do init_interp with + wrong number of vertical layers) +- Fixes #367 (For cmip6 runs: Turn on cpl hist output needed to drive a + TG compset) +- Fixes #412 (Fix documentation of init_interp_method) +- Fixes #419 (Do not allow SOYFIXN diagnostic field with FUN) +- Fixes #464 (Some lines longer than 132 characters) +- Fixes #465 (Remove backwards compatibility check for snw_rds) +- Fixes #467 (Increase wallclock limit for test) + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] clm4_5 + +[ ] clm4_0 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in .CTSMTrunkChecklist as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: +- Changed a single-point test from gnu to intel to get better debugging + information + (SMS_D_Ly6_Mmpi-serial.1x1_smallvilleIA.IHistClm45BgcCropQianGs.cheyenne_intel.clm-cropMonthOutput) +- For some single-point tests on both gnu and intel: removed one + compiler, keeping the tests on just one + +Code reviewed by: self + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + unit-tests (components/clm/src): + + cheyenne - pass + + tools-tests (components/clm/test/tools): + + cheyenne - not run + + PTCLM testing (components/clm/tools/shared/PTCLM/test): + + cheyenne - not run + + regular tests (aux_clm): + + cheyenne_intel ---- pass + cheyenne_gnu ------ pass + hobart_nag -------- pass + hobart_pgi -------- pass + hobart_intel ------ pass + + NLCOMP failures as expected for tests with the cmip6 test mod + + Some long single-point gnu tests failed due to running out of + wallclock time; I have removed these, just keeping them on intel + (along with removing a few other tests after I ran the testing - see + commit 5c226bdf): + + FAIL ERS_Lm54_Mmpi-serial.1x1_numaIA.I2000Clm50BgcCropGs.cheyenne_gnu.clm-cropMonthOutput RUN time=4803 + FAIL ERS_Ly6_Mmpi-serial.1x1_smallvilleIA.IHistClm50BgcCropGs.cheyenne_gnu.clm-cropMonthOutput RUN time=6024 + + +CTSM tag used for the baseline comparisons: ctsm1.0.dev005 + + +Answer changes +-------------- + +Changes answers relative to baseline: NO - bit-for-bit + + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +- #392 (Remove old code for snw_rds restart that looks no longer needed) +- (Other changes not documented in PRs) + +=============================================================== +=============================================================== Tag name: ctsm1.0.dev005 Originator(s): sacks (Bill Sacks), mvr (Mathew Rothstein) Date: Fri Aug 3 07:54:59 MDT 2018 diff --git a/doc/ChangeSum b/doc/ChangeSum index 0e1f433c78..e988ba96eb 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm1.0.dev006 sacks 08/04/2018 Minor bug fixes, cleanup, documentation and enhancements ctsm1.0.dev005 sacks 08/03/2018 Rework water data types to accommodate isotopes and other tracers ctsm1.0.dev004 erik 07/18/2018 Add some new diagnostic fields, fix a few issues, update cmip6 output ctsm1.0.dev003 erik 07/15/2018 Update cime/cism to work on upgraded hobart and with glade changes on cheyenne