diff --git a/Externals.cfg b/Externals.cfg index 08a6d0695e..090732ee79 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -7,30 +7,30 @@ required = True [cism] local_path = components/cism protocol = git -repo_url = https://github.com/ESCOMP/cism-wrapper -tag = release-cesm2.0.04 +repo_url = https://github.com/ESCOMP/CISM-wrapper +tag = cism-release-cesm2.1.2_01 externals = Externals_CISM.cfg required = True [rtm] local_path = components/rtm protocol = git -repo_url = https://github.com/ESCOMP/rtm -tag = release-cesm2.0.03 +repo_url = https://github.com/ESCOMP/RTM +tag = release-cesm2.0.04 required = True [mosart] local_path = components/mosart protocol = git -repo_url = https://github.com/ESCOMP/mosart -tag = release-cesm2.0.03 +repo_url = https://github.com/ESCOMP/MOSART +tag = release-cesm2.0.04 required = True [cime] local_path = cime protocol = git repo_url = https://github.com/ESMCI/cime -tag = cime5.6.25 +tag = cime5.6.28 required = True [externals_description] diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index 23d74d10e2..f38a229b9f 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -1,15 +1,15 @@ [fates] local_path = src/fates protocol = git -repo_url = https://github.com/ncar/fates-release -tag = fates_s1.21.0_a7.0.0_br_rev2 +repo_url = https://github.com/NGEET/fates +tag = sci.1.30.0_api.8.0.0 required = True [PTCLM] local_path = tools/PTCLM protocol = git -repo_url = https://github.com/ESCOMP/ptclm -tag = PTCLM2_180611 +repo_url = https://github.com/ESCOMP/PTCLM +tag = PTCLM2_20200121 required = True [externals_description] diff --git a/bld/namelist_files/namelist_defaults_clm4_5.xml b/bld/namelist_files/namelist_defaults_clm4_5.xml index 01384e9e6f..63816ced70 100644 --- a/bld/namelist_files/namelist_defaults_clm4_5.xml +++ b/bld/namelist_files/namelist_defaults_clm4_5.xml @@ -378,7 +378,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/fates_params_default_2trop.c190114.nc +lnd/clm2/paramdata/fates_params_api.8.0.0_12pft_c191216.nc diff --git a/bld/namelist_files/namelist_defaults_overall.xml b/bld/namelist_files/namelist_defaults_overall.xml index 3b2721fbbf..44da084342 100644 --- a/bld/namelist_files/namelist_defaults_overall.xml +++ b/bld/namelist_files/namelist_defaults_overall.xml @@ -55,9 +55,8 @@ determine default values for namelists. constant - -1 -0 + +0 1 diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml index 9be3edee3b..9f41cc2e52 100644 --- a/cime_config/testdefs/ExpectedTestFails.xml +++ b/cime_config/testdefs/ExpectedTestFails.xml @@ -11,10 +11,12 @@ FAIL PEPEM_Ld1.f10_f10_musgs.I2000Clm50BgcCrop.hobart_intel.clm-crop RUN + FAIL SMS_Lm3_D_Mmpi-serial.1x1_brazil.I2000Clm50FatesCruGs.cheyenne_intel.clm-FatesHydro RUN FAIL ERS_D_Ld5.1x1_brazil.I2000Clm50FatesCruGs.cheyenne_intel.clm-FatesHydro COMPARE_base_rest FAIL ERS_D_Ld5.1x1_brazil.I2000Clm50FatesCruGs.hobart_nag.clm-FatesHydro RUN - FAIL SMS_Lm3_D_Mmpi-serial.1x1_brazil.I2000Clm50FatesCruGs.hobart_nag.clm-FatesHydro MEMLEAK FAIL ERS_D_Ld5.1x1_brazil.I2000Clm50FatesCruGs.izumi_nag.clm-FatesHydro RUN - FAIL SMS_Lm3_D_Mmpi-serial.1x1_brazil.I2000Clm50FatesCruGs.izumi_nag.clm-FatesHydro MEMLEAK + FAIL SMS_Lm3_D_Mmpi-serial.1x1_brazil.I2000Clm50FatesCruGs.hobart_nag.clm-FatesHydro MEMLEAK + FAIL SMS_Lm3_D_Mmpi-serial.1x1_brazil.I2000Clm50FatesCruGs.izumi_nag.clm-FatesHydro RUN + FAIL SMS_Lm3_D_Mmpi-serial.1x1_brazil.I2000Clm50FatesCruGs.cheyenne_intel.clm-FatesHydro RUN diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index ec2fb4746d..97ced69e17 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1882,15 +1882,6 @@ - - - - - - - - - @@ -1898,6 +1889,7 @@ + @@ -1996,7 +1988,7 @@ - + @@ -2021,7 +2013,7 @@ - + diff --git a/cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm index 3f6a4dbc56..c40769a62e 100644 --- a/cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm @@ -3,9 +3,11 @@ hist_mfilt = 365 hist_nhtfrq = -24 hist_empty_htapes = .true. use_fates_spitfire= .true. -hist_fincl1 = 'NPP','GPP','BTRAN','H2OSOI','TLAI','LITTER_IN','LITTER_OUT', +hist_fincl1 = 'NPP','GPP','BTRAN','H2OSOI','TLAI','LITTER_IN_ELEM','LITTER_OUT_ELEM', 'FIRE_AREA','SCORCH_HEIGHT','FIRE_INTENSITY','FIRE_TFC_ROS','fire_fuel_mef', 'fire_fuel_bulkd','fire_fuel_sav','FIRE_NESTEROV_INDEX','PFTbiomass', 'PFTleafbiomass','FIRE_ROS','WIND','AREA_TREES','AREA_PLANT', - 'TOTSOMC','TOTLITC','T_SCALAR','NEP','NBP','HR','TOTECOSYSC','NPLANT_SCAG','NPLANT_SCPF', - 'BA_SCLS','NPP_BY_AGE','CWD_AG_CWDSC','PARSUN_Z_CNLF','PARSUN_Z_CNLFPFT','PARSHA_Z_CAN' + 'TOTSOMC','TOTLITC','T_SCALAR','NEP','HR','NPLANT_SCAG','NPLANT_SCPF', + 'BA_SCLS','NPP_BY_AGE','CWD_AG_CWDSC','PARSUN_Z_CNLF','PARSUN_Z_CNLFPFT','PARSHA_Z_CAN', + 'LITTER_FINES_AG_ELEM','LITTER_FINES_BG_ELEM','LITTER_CWD_AG_ELEM','LITTER_CWD_BG_ELEM', + 'SEED_BANK' diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm index 66c94f3cc2..9b9243cee5 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm @@ -27,4 +27,6 @@ hist_fincl1 = 'NCL_BY_AGE','NPATCH_BY_AGE','BIOMASS_BY_AGE','NPP_BY_AGE',' 'NPP_LEAF_UNDERSTORY_SCLS','NPP_FROOT_UNDERSTORY_SCLS','NPP_BSW_UNDERSTORY_SCLS', 'NPP_BDEAD_UNDERSTORY_SCLS','NPP_BSEED_UNDERSTORY_SCLS','NPP_STORE_UNDERSTORY_SCLS','RDARK_UNDERSTORY_SCLS', 'LIVESTEM_MR_UNDERSTORY_SCLS','LIVECROOT_MR_UNDERSTORY_SCLS','FROOT_MR_UNDERSTORY_SCLS','RESP_G_UNDERSTORY_SCLS', - 'RESP_M_UNDERSTORY_SCLS' + 'RESP_M_UNDERSTORY_SCLS','LITTER_IN_ELEM','LITTER_OUT_ELEM','SEED_BANK_ELEM','SEEDS_IN_LOCAL_ELEM','SEEDS_IN_EXTERN_ELEM', + 'SEED_GERM_ELEM','SEED_DECAY','CBALANCE_ERROR_FATES','ERROR_FATES','LITTER_FINES_AG_ELEM','LITTER_FINES_BG_ELEM','LITTER_CWD_BG_ELEM', + 'LITTER_CWD_AG_ELEM','LITTER_CWD' diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm index bae4c2cb9e..97cafd9d42 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm @@ -6,5 +6,5 @@ hist_fincl1 = 'NPP','GPP','BTRAN','H2OSOI','TLAI','LITTER_IN','LITTER_OUT' 'FIRE_AREA','SCORCH_HEIGHT','FIRE_INTENSITY','FIRE_TFC_ROS','fire_fuel_mef', 'fire_fuel_bulkd','fire_fuel_sav','FIRE_NESTEROV_INDEX','PFTbiomass', 'PFTleafbiomass','FIRE_ROS','WIND','AREA_TREES','AREA_PLANT', - 'TOTSOMC','TOTLITC','T_SCALAR','NEP','NBP','HR','TOTECOSYSC','NPLANT_SCAG','NPLANT_SCPF', + 'TOTSOMC','TOTLITC','T_SCALAR','NEP','HR','NPLANT_SCAG','NPLANT_SCPF', 'BA_SCLS','NPP_BY_AGE','CWD_AG_CWDSC','PARSUN_Z_CNLF','PARSUN_Z_CNLFPFT','PARSHA_Z_CAN' diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesShortList/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesShortList/user_nl_clm index f9d31eecbb..fc057c0be3 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesShortList/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/FatesShortList/user_nl_clm @@ -2,4 +2,4 @@ hist_fincl1 = 'NPP','GPP','BTRAN','H2OSOI','TLAI','LITTER_IN','LITTER_OUT' 'FIRE_AREA','SCORCH_HEIGHT','FIRE_INTENSITY','FIRE_TFC_ROS','fire_fuel_mef', 'fire_fuel_bulkd','fire_fuel_sav','FIRE_NESTEROV_INDEX','PFTbiomass', 'PFTleafbiomass','FIRE_ROS','WIND','AREA_TREES','AREA_PLANT', - 'TOTSOMC','TOTLITC','T_SCALAR','NEP','NBP','HR','TOTECOSYSC' + 'TOTSOMC','TOTLITC','T_SCALAR','NEP','HR' diff --git a/doc/.ChangeLog_template b/doc/.ChangeLog_template index 27699a0582..bfe250c85c 100644 --- a/doc/.ChangeLog_template +++ b/doc/.ChangeLog_template @@ -95,9 +95,9 @@ CTSM testing: cheyenne_intel ---- cheyenne_gnu ------ - hobart_nag -------- - hobart_pgi -------- - hobart_intel ------ + izumi_nag --------- + izumi_pgi --------- + izumi_intel ------- Answer changes -------------- diff --git a/doc/ChangeSum b/doc/ChangeSum index 9f24b313a4..b377f166a2 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ +release-clm5.0.30 erik 01/21/2020 Update FATES to sci.1.30.0_api.8.0.0 release-clm5.0.29 erik 11/19/2019 Some answer changes needed for prescribed soil-moisture and clm4_5 defaults (1850-ndep, and urbantv settings) release-clm5.0.28 erik 11/14/2019 Several bit-for-bit fixes especially around soil-moisture streams release-clm5.0.27 erik 08/13/2019 Add presoribed soil moisture streams as an option, and a few fixes diff --git a/doc/release-clm5.0.ChangeLog b/doc/release-clm5.0.ChangeLog index 06e77c0a1d..4d43ab1115 100644 --- a/doc/release-clm5.0.ChangeLog +++ b/doc/release-clm5.0.ChangeLog @@ -1,4 +1,98 @@ =============================================================== +Tag name: release-clm5.0.30 +Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) +Date: Tue Jan 21 13:50:48 MST 2020 +One-line Summary: Update FATES to sci.1.30.0_api.8.0.0 + +Purpose of this version: +------------------------ + +Update FATES to sci.1.30.0_api.8.0.0, and point to the NGEET version, rather +than NCAR/fates-release version. + +One change to soil-moisture (also check if gridcell weight is non-zero, before specifying prescribed soil moisture. +Also update mosart with cold start bug fix. Update rtm, cism, and cime to versions on cesm2.1.2 release tag. +Fix some issues with PTCLM. + +CTSM Master Tag This Corresponds To: ctsm1.0.dev025 (with many other changes) + +Summary of changes: +------------------- + +Issues fixed (include CTSM Issue #): #847 #871 + Fixes #847 -- issues with prescribed soil moisture + Fixes #871 -- don't check for valid resolution for CESM cases by default + +Science changes since: release-clm5.0.28 + FATES science update from sci-1.27.1 to sci.1.30.0 + +Software changes since: release-clm5.0.28 + FATES API update from api.7.3.0 to api.8.0.0 + +Changes to User Interface since: release-clm5.0.28 + fates paramfile is updated + +Testing: +-------- + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS (35 tests are different because of fates param file update) + + unit-tests (components/clm/src): + + cheyenne - PASS + + tools-tests (components/clm/test/tools): + + cheyenne - PASS + + PTCLM testing (components/clm/tools/shared/PTCLM/test): + + cheyenne - OK + + regular tests (aux_clm): + + cheyenne_intel ---- OK + cheyenne_gnu ------ OK + izumi_nag --------- OK + izumi_pgi --------- OK + izumi_intel ------- OK + +Summary of Answer changes: +------------------------- + +If the tag used for baseline comparisons was NOT the previous tag, note that here: previous + +Changes answers relative to baseline: Yes, but only when running with FATES + + Summarize any changes to answers, i.e., + - what code configurations: with FATES active + - what platforms/compilers: all + - nature of change: similar climate + +Detailed list of changes: +------------------------ + +Externals being used: all externals updated + + cism: cism-release-cesm2.1.2_01 + rtm: release-cesm2.0.04 + mosart: release-cesm2.0.04 + cime: cim5.6.28 + FATES: sci.1.30.0_api.8.0.0 + PTCLM: PTCLM2_20200121 + +CTSM Tag versions pulled over from master development branch: None + +Pull Requests that document the changes (include PR ids): #846 +(https://github.com/ESCOMP/ctsm/pull) + #846 -- Update to fates sci.1.30.0_api.8.0.0 + +=============================================================== +=============================================================== Tag name: release-clm5.0.29 Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) Date: Tue Nov 19 12:14:02 MST 2019 diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 8efbb2e6ed..5890ad9869 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -21,7 +21,6 @@ module CanopyFluxesMod use decompMod , only : bounds_type use PhotosynthesisMod , only : Photosynthesis, PhotoSynthesisHydraulicStress, PhotosynthesisTotal, Fractionation use EDAccumulateFluxesMod , only : AccumulateFluxes_ED - use EDBtranMod , only : btran_ed use SoilMoistStressMod , only : calc_effective_soilporosity, calc_volumetric_h2oliq use SoilMoistStressMod , only : calc_root_moist_stress, set_perchroot_opt use SimpleMathMod , only : array_div_vector diff --git a/src/biogeophys/SoilMoistureStreamMod.F90 b/src/biogeophys/SoilMoistureStreamMod.F90 index 6f625c52a4..8e606418f6 100644 --- a/src/biogeophys/SoilMoistureStreamMod.F90 +++ b/src/biogeophys/SoilMoistureStreamMod.F90 @@ -358,7 +358,9 @@ subroutine PrescribedSoilMoistureInterp(bounds, soilstate_inst, & g = col%gridcell(c) ig = g_to_ig(g) - if ( (lun%itype(col%landunit(c)) == istsoil) .or. (lun%itype(col%landunit(c)) == istcrop) ) then + ! EBK Jan/2020, also check weights on gridcell (See https://github.com/ESCOMP/CTSM/issues/847) + if ( (lun%itype(col%landunit(c)) == istsoil) .or. (lun%itype(col%landunit(c)) == istcrop) .and. & + (col%wtgcell(c) /= 0._r8) ) then ! this is a 2d field (gridcell/nlevsoi) ! do j = 1, nlevsoi diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index b1df43d6b4..ca9c64e476 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -24,8 +24,10 @@ module histFileMod use EDTypesMod , only : nlevleaf use FatesInterfaceMod , only : nlevsclass, nlevage use FatesInterfaceMod , only : nlevheight - use EDTypesMod , only : nfsc, ncwd - use FatesInterfaceMod , only : numpft_ed => numpft + use EDTypesMod , only : nfsc + use FatesLitterMod , only : ncwd + use EDTypesMod , only : num_elements_fates => num_elements + use FatesInterfaceMod , only : numpft_fates => numpft use ncdio_pio ! @@ -195,6 +197,9 @@ module histFileMod integer :: beg1d_out ! on-node 1d hbuf pointer start index integer :: end1d_out ! on-node 1d hbuf pointer end index integer :: num1d_out ! size of hbuf first dimension (all nodes) + integer :: numdims ! the actual number of dimensions, this allows + ! for 2D arrays, where the second dimension is allowed + ! to be 1 integer :: num2d ! size of hbuf second dimension (e.g. number of vertical levels) integer :: hpindex ! history pointer index character(len=scale_type_strlen) :: p2c_scale_type ! scale factor when averaging patch to column @@ -315,7 +320,7 @@ subroutine hist_printflds() end subroutine hist_printflds !----------------------------------------------------------------------- - subroutine masterlist_addfld (fname, type1d, type1d_out, & + subroutine masterlist_addfld (fname, numdims, type1d, type1d_out, & type2d, num2d, units, avgflag, long_name, hpindex, & p2c_scale_type, c2l_scale_type, l2g_scale_type, & no_snow_behavior) @@ -331,6 +336,7 @@ subroutine masterlist_addfld (fname, type1d, type1d_out, & ! ! !ARGUMENTS: character(len=*), intent(in) :: fname ! field name + integer , intent(in) :: numdims ! number of dimensions character(len=*), intent(in) :: type1d ! 1d data type character(len=*), intent(in) :: type1d_out ! 1d output type character(len=*), intent(in) :: type2d ! 2d output type @@ -409,6 +415,7 @@ subroutine masterlist_addfld (fname, type1d, type1d_out, & masterlist(f)%field%type1d = type1d masterlist(f)%field%type1d_out = type1d_out masterlist(f)%field%type2d = type2d + masterlist(f)%field%numdims = numdims masterlist(f)%field%num2d = num2d masterlist(f)%field%hpindex = hpindex masterlist(f)%field%p2c_scale_type = p2c_scale_type @@ -1056,17 +1063,20 @@ subroutine hist_update_hbuf(bounds) integer :: t ! tape index integer :: f ! field index integer :: num2d ! size of second dimension (e.g. number of vertical levels) + integer :: numdims ! number of dimensions character(len=*),parameter :: subname = 'hist_update_hbuf' character(len=hist_dim_name_length) :: type2d ! hbuf second dimension type ["levgrnd","levlak","numrad","ltype","natpft","cft","glc_nec","elevclas","subname(n)"] !----------------------------------------------------------------------- do t = 1,ntapes -!$OMP PARALLEL DO PRIVATE (f, num2d) +!$OMP PARALLEL DO PRIVATE (f, num2d, numdims) do f = 1,tape(t)%nflds - num2d = tape(t)%hlist(f)%field%num2d - if ( num2d == 1) then + numdims = tape(t)%hlist(f)%field%numdims + + if ( numdims == 1) then call hist_update_hbuf_field_1d (t, f, bounds) else + num2d = tape(t)%hlist(f)%field%num2d call hist_update_hbuf_field_2d (t, f, bounds, num2d) end if end do @@ -2058,18 +2068,22 @@ subroutine htape_create (t, histrest) if(use_fates)then call ncd_defdim(lnfid, 'fates_levscag', nlevsclass * nlevage, dimid) - call ncd_defdim(lnfid, 'fates_levscagpf', nlevsclass * nlevage * numpft_ed, dimid) - call ncd_defdim(lnfid, 'fates_levagepft', nlevage * numpft_ed, dimid) + call ncd_defdim(lnfid, 'fates_levscagpf', nlevsclass * nlevage * numpft_fates, dimid) + call ncd_defdim(lnfid, 'fates_levagepft', nlevage * numpft_fates, dimid) call ncd_defdim(lnfid, 'fates_levscls', nlevsclass, dimid) - call ncd_defdim(lnfid, 'fates_levpft', numpft_ed, dimid) + call ncd_defdim(lnfid, 'fates_levpft', numpft_fates, dimid) call ncd_defdim(lnfid, 'fates_levage', nlevage, dimid) call ncd_defdim(lnfid, 'fates_levheight', nlevheight, dimid) call ncd_defdim(lnfid, 'fates_levfuel', nfsc, dimid) call ncd_defdim(lnfid, 'fates_levcwdsc', ncwd, dimid) - call ncd_defdim(lnfid, 'fates_levscpf', nlevsclass*numpft_ed, dimid) + call ncd_defdim(lnfid, 'fates_levscpf', nlevsclass*numpft_fates, dimid) call ncd_defdim(lnfid, 'fates_levcan', nclmax, dimid) call ncd_defdim(lnfid, 'fates_levcnlf', nlevleaf * nclmax, dimid) - call ncd_defdim(lnfid, 'fates_levcnlfpf', nlevleaf * nclmax * numpft_ed, dimid) + call ncd_defdim(lnfid, 'fates_levcnlfpf', nlevleaf * nclmax * numpft_fates, dimid) + call ncd_defdim(lnfid, 'fates_levelem', num_elements_fates, dimid) + call ncd_defdim(lnfid, 'fates_levelpft', num_elements_fates * numpft_fates, dimid) + call ncd_defdim(lnfid, 'fates_levelcwd', num_elements_fates * ncwd, dimid) + call ncd_defdim(lnfid, 'fates_levelage', num_elements_fates * nlevage, dimid) end if if ( .not. lhistrest )then @@ -2504,6 +2518,15 @@ subroutine htape_timeconst(t, mode) use FatesInterfaceMod, only : fates_hdim_canmap_levcnlfpf use FatesInterfaceMod, only : fates_hdim_lfmap_levcnlfpf use FatesInterfaceMod, only : fates_hdim_pftmap_levcnlfpf + use FatesInterfaceMod, only : fates_hdim_levelem + use FatesInterfaceMod, only : fates_hdim_elmap_levelpft + use FatesInterfaceMod, only : fates_hdim_pftmap_levelpft + use FatesInterfaceMod, only : fates_hdim_elmap_levelcwd + use FatesInterfaceMod, only : fates_hdim_cwdmap_levelcwd + use FatesInterfaceMod, only : fates_hdim_elmap_levelage + use FatesInterfaceMod, only : fates_hdim_agemap_levelage + + ! ! !ARGUMENTS: integer, intent(in) :: t ! tape index @@ -2600,6 +2623,20 @@ subroutine htape_timeconst(t, mode) long_name='FATES pft map into patch age x pft', units='-', ncid=nfid(t)) call ncd_defvar(varname='fates_agmap_levagepft', xtype=ncd_int, dim1name='fates_levagepft', & long_name='FATES age-class map into patch age x pft', units='-', ncid=nfid(t)) + call ncd_defvar(varname='fates_levelem',xtype=ncd_int, dim1name='fates_levelem', & + long_name='FATES element (C,N,P,...) identifier', units='-', ncid=nfid(t)) + call ncd_defvar(varname='fates_elmap_levelpft', xtype=ncd_int, dim1name='fates_levelpft', & + long_name='FATES element map into element x pft ', units='-', ncid=nfid(t)) + call ncd_defvar(varname='fates_pftmap_levelpft', xtype=ncd_int, dim1name='fates_levelpft', & + long_name='FATES pft map into element x pft', units='-', ncid=nfid(t)) + call ncd_defvar(varname='fates_elmap_levelcwd', xtype=ncd_int, dim1name='fates_levelcwd', & + long_name='FATES element map into element x cwd', units='-', ncid=nfid(t)) + call ncd_defvar(varname='fates_cwdmap_levelcwd', xtype=ncd_int, dim1name='fates_levelcwd', & + long_name='FATES cwd map into element x cwd', units='-', ncid=nfid(t)) + call ncd_defvar(varname='fates_elmap_levelage', xtype=ncd_int, dim1name='fates_levelage', & + long_name='FATES element map into age x pft', units='-', ncid=nfid(t)) + call ncd_defvar(varname='fates_agemap_levelage', xtype=ncd_int, dim1name='fates_levelage', & + long_name='FATES element map into age x pft', units='-', ncid=nfid(t)) end if @@ -2635,7 +2672,14 @@ subroutine htape_timeconst(t, mode) call ncd_io(varname='fates_agmap_levscagpft',data=fates_hdim_agmap_levscagpft, ncid=nfid(t), flag='write') call ncd_io(varname='fates_pftmap_levscagpft',data=fates_hdim_pftmap_levscagpft, ncid=nfid(t), flag='write') call ncd_io(varname='fates_pftmap_levagepft',data=fates_hdim_pftmap_levagepft, ncid=nfid(t), flag='write') - call ncd_io(varname='fates_agmap_levagepft',data=fates_hdim_agmap_levagepft, ncid=nfid(t), flag='write') + call ncd_io(varname='fates_agmap_levagepft',data=fates_hdim_agmap_levagepft, ncid=nfid(t), flag='write') + call ncd_io(varname='fates_levelem',data=fates_hdim_levelem, ncid=nfid(t),flag='write') + call ncd_io(varname='fates_elmap_levelpft',data=fates_hdim_elmap_levelpft, ncid=nfid(t),flag='write') + call ncd_io(varname='fates_pftmap_levelpft',data=fates_hdim_pftmap_levelpft, ncid=nfid(t),flag='write') + call ncd_io(varname='fates_elmap_levelcwd',data=fates_hdim_elmap_levelcwd, ncid=nfid(t),flag='write') + call ncd_io(varname='fates_cwdmap_levelcwd',data=fates_hdim_cwdmap_levelcwd, ncid=nfid(t),flag='write') + call ncd_io(varname='fates_elmap_levelage',data=fates_hdim_elmap_levelage, ncid=nfid(t),flag='write') + call ncd_io(varname='fates_agemap_levelage',data=fates_hdim_agemap_levelage, ncid=nfid(t),flag='write') end if endif @@ -2881,6 +2925,7 @@ subroutine hfields_write(t, mode) integer :: num2d ! hbuf second dimension size integer :: nt ! time index integer :: ier ! error status + integer :: numdims ! number of dimensions character(len=avgflag_strlen) :: avgflag ! time averaging flag character(len=max_chars) :: long_name! long name character(len=max_chars) :: units ! units @@ -2924,6 +2969,7 @@ subroutine hfields_write(t, mode) end1d_out = tape(t)%hlist(f)%field%end1d_out num1d_out = tape(t)%hlist(f)%field%num1d_out type2d = tape(t)%hlist(f)%field%type2d + numdims = tape(t)%hlist(f)%field%numdims num2d = tape(t)%hlist(f)%field%num2d nt = tape(t)%ntimes @@ -2956,7 +3002,7 @@ subroutine hfields_write(t, mode) endif if (dim2name == 'undefined') then - if (num2d == 1) then + if (numdims == 1) then call ncd_defvar(ncid=nfid(t), varname=varname, xtype=tape(t)%ncprec, & dim1name=dim1name, dim2name='time', & long_name=long_name, units=units, cell_method=avgstr, & @@ -2968,7 +3014,7 @@ subroutine hfields_write(t, mode) missing_value=spval, fill_value=spval) end if else - if (num2d == 1) then + if (numdims == 1) then call ncd_defvar(ncid=nfid(t), varname=varname, xtype=tape(t)%ncprec, & dim1name=dim1name, dim2name=dim2name, dim3name='time', & long_name=long_name, units=units, cell_method=avgstr, & @@ -2989,7 +3035,7 @@ subroutine hfields_write(t, mode) ! Allocate dynamic memory - if (num2d == 1) then + if (numdims == 1) then allocate(hist1do(beg1d_out:end1d_out), stat=ier) if (ier /= 0) then write(iulog,*) trim(subname),' ERROR: allocation' @@ -3000,7 +3046,7 @@ subroutine hfields_write(t, mode) ! Write history output. Always output land and ocean runoff on xy grid. - if (num2d == 1) then + if (numdims == 1) then call ncd_io(flag='write', varname=varname, & dim1name=type1d_out, data=hist1do, ncid=nfid(t), nt=nt) else @@ -3011,7 +3057,7 @@ subroutine hfields_write(t, mode) ! Deallocate dynamic memory - if (num2d == 1) then + if (numdims == 1) then deallocate(hist1do) end if @@ -4745,10 +4791,11 @@ subroutine hist_addfld1d (fname, units, avgflag, long_name, type1d_out, & ! Add field to masterlist - call masterlist_addfld (fname=trim(fname), type1d=l_type1d, type1d_out=l_type1d_out, & - type2d='unset', num2d=1, & - units=units, avgflag=avgflag, long_name=long_name, hpindex=hpindex, & - p2c_scale_type=scale_type_p2c, c2l_scale_type=scale_type_c2l, l2g_scale_type=scale_type_l2g) + call masterlist_addfld (fname=trim(fname), numdims=1, type1d=l_type1d, & + type1d_out=l_type1d_out, type2d='unset', num2d=1, & + units=units, avgflag=avgflag, long_name=long_name, hpindex=hpindex, & + p2c_scale_type=scale_type_p2c, c2l_scale_type=scale_type_c2l, & + l2g_scale_type=scale_type_l2g) l_default = 'active' if (present(default)) then @@ -4864,7 +4911,7 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, case ('fates_levscls') num2d = nlevsclass case ('fates_levpft') - num2d = numpft_ed + num2d = numpft_fates case ('fates_levage') num2d = nlevage case ('fates_levheight') @@ -4874,23 +4921,31 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, case ('fates_levcwdsc') num2d = ncwd case ('fates_levscpf') - num2d = nlevsclass*numpft_ed + num2d = nlevsclass*numpft_fates case ('fates_levscag') num2d = nlevsclass*nlevage case ('fates_levscagpf') - num2d = nlevsclass*nlevage*numpft_ed + num2d = nlevsclass*nlevage*numpft_fates case ('fates_levagepft') - num2d = nlevage*numpft_ed + num2d = nlevage*numpft_fates case ('fates_levcan') num2d = nclmax case ('fates_levcnlf') num2d = nlevleaf * nclmax case ('fates_levcnlfpf') - num2d = nlevleaf * nclmax * numpft_ed + num2d = nlevleaf * nclmax * numpft_fates case ('ltype') num2d = max_lunit case ('natpft') num2d = natpft_size + case ('fates_levelem') + num2d = num_elements_fates + case ('fates_levelpft') + num2d = num_elements_fates*numpft_fates + case ('fates_levelcwd') + num2d = num_elements_fates*ncwd + case ('fates_levelage') + num2d = num_elements_fates*nlevage case('cft') if (cft_size > 0) then num2d = cft_size @@ -5052,12 +5107,12 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, ! Add field to masterlist - call masterlist_addfld (fname=trim(fname), type1d=l_type1d, type1d_out=l_type1d_out, & - type2d=type2d, num2d=num2d, & - units=units, avgflag=avgflag, long_name=long_name, hpindex=hpindex, & - p2c_scale_type=scale_type_p2c, c2l_scale_type=scale_type_c2l, l2g_scale_type=scale_type_l2g, & - no_snow_behavior=no_snow_behavior) - + call masterlist_addfld (fname=trim(fname), numdims=2, type1d=l_type1d, & + type1d_out=l_type1d_out, type2d=type2d, num2d=num2d, & + units=units, avgflag=avgflag, long_name=long_name, hpindex=hpindex, & + p2c_scale_type=scale_type_p2c, c2l_scale_type=scale_type_c2l, & + l2g_scale_type=scale_type_l2g, no_snow_behavior=no_snow_behavior) + l_default = 'active' if (present(default)) then l_default = default diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 84c4e5901f..090cd2826e 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -107,8 +107,8 @@ module CLMFatesInterfaceMod use FatesHistoryInterfaceMod, only : fates_history_interface_type use FatesRestartInterfaceMod, only : fates_restart_interface_type - use ChecksBalancesMod , only : SummarizeNetFluxes, FATES_BGC_Carbon_BalanceCheck use EDTypesMod , only : ed_patch_type + use EDTypesMod , only : num_elements use FatesInterfaceMod , only : hlm_numlevgrnd use EDMainMod , only : ed_ecosystem_dynamics use EDMainMod , only : ed_update_site @@ -123,7 +123,7 @@ module CLMFatesInterfaceMod use EDCanopyStructureMod , only : canopy_summarization, update_hlm_dynamics use FatesPlantRespPhotosynthMod, only : FatesPlantRespPhotosynthDrive use EDAccumulateFluxesMod , only : AccumulateFluxes_ED - use EDPhysiologyMod , only : flux_into_litter_pools + use EDPhysiologyMod , only : FluxIntoLitterPools use FatesPlantHydraulicsMod, only : hydraulics_drive use FatesPlantHydraulicsMod, only : HydrSiteColdStart use FatesPlantHydraulicsMod, only : InitHydrSites @@ -688,7 +688,7 @@ subroutine dynamics_driv(this, nc, bounds_clump, & ! call subroutine to aggregate fates litter output fluxes and ! package them for handing across interface - call flux_into_litter_pools(this%fates(nc)%nsites, & + call FluxIntoLitterPools(this%fates(nc)%nsites, & this%fates(nc)%sites, & this%fates(nc)%bc_in, & this%fates(nc)%bc_out) @@ -709,11 +709,14 @@ subroutine dynamics_driv(this, nc, bounds_clump, & nld_si = this%fates(nc)%bc_in(s)%nlevdecomp soilbiogeochem_carbonflux_inst%FATES_c_to_litr_lab_c_col(c,1:nld_si) = & - this%fates(nc)%bc_out(s)%FATES_c_to_litr_lab_c_col(1:nld_si) + this%fates(nc)%bc_out(s)%litt_flux_lab_c_si(1:nld_si) + soilbiogeochem_carbonflux_inst%FATES_c_to_litr_cel_c_col(c,1:nld_si) = & - this%fates(nc)%bc_out(s)%FATES_c_to_litr_cel_c_col(1:nld_si) + this%fates(nc)%bc_out(s)%litt_flux_cel_c_si(1:nld_si) + soilbiogeochem_carbonflux_inst%FATES_c_to_litr_lig_c_col(c,1:nld_si) = & - this%fates(nc)%bc_out(s)%FATES_c_to_litr_lig_c_col(1:nld_si) + this%fates(nc)%bc_out(s)%litt_flux_lig_c_si(1:nld_si) + end do @@ -1226,11 +1229,12 @@ subroutine init_coldstart(this, waterstate_inst, canopystate_inst, soilstate_ins call get_clump_bounds(nc, bounds_clump) do s = 1,this%fates(nc)%nsites - call init_site_vars(this%fates(nc)%sites(s)) + call init_site_vars(this%fates(nc)%sites(s),this%fates(nc)%bc_in(s) ) call zero_site(this%fates(nc)%sites(s)) end do - call set_site_properties(this%fates(nc)%nsites, this%fates(nc)%sites) + call set_site_properties(this%fates(nc)%nsites, & + this%fates(nc)%sites) ! ---------------------------------------------------------------------------- ! Initialize Hydraulics Code if turned on @@ -1301,7 +1305,7 @@ subroutine init_coldstart(this, waterstate_inst, canopystate_inst, soilstate_ins end if end do !$OMP END PARALLEL DO - + end subroutine init_coldstart ! ====================================================================================== @@ -1878,30 +1882,14 @@ subroutine wrap_bgc_summary(this, nc, soilbiogeochem_carbonflux_inst, & this%fates(nc)%bc_in(s)%tot_somc = totsomc(c) this%fates(nc)%bc_in(s)%tot_litc = totlitc(c) end do - - is_beg_day = is_beg_curr_day() - dtime = get_step_size() - nstep = get_nstep() - - call SummarizeNetFluxes(this%fates(nc)%nsites, & - this%fates(nc)%sites, & - this%fates(nc)%bc_in, & - is_beg_day) - - call FATES_BGC_Carbon_Balancecheck(this%fates(nc)%nsites, & - this%fates(nc)%sites, & - this%fates(nc)%bc_in, & - is_beg_day, & - dtime, nstep) - ! Update history variables that track these variables call this%fates_hist%update_history_cbal(nc, & - this%fates(nc)%nsites, & - this%fates(nc)%sites) + this%fates(nc)%nsites, & + this%fates(nc)%sites, & + this%fates(nc)%bc_in) - end associate end subroutine wrap_bgc_summary @@ -1954,7 +1942,8 @@ subroutine init_history_io(this,bounds_proc) use FatesIOVariableKindMod, only : site_fuel_r8, site_cwdsc_r8, site_scag_r8 use FatesIOVariableKindMod, only : site_scagpft_r8, site_agepft_r8 use FatesIOVariableKindMod, only : site_can_r8, site_cnlf_r8, site_cnlfpft_r8 - use FatesIOVariableKindMod, only : site_height_r8 + use FatesIOVariableKindMod, only : site_height_r8, site_elem_r8, site_elpft_r8 + use FatesIOVariableKindMod, only : site_elcwd_r8, site_elage_r8 use FatesIODimensionsMod, only : fates_bounds_type @@ -2075,151 +2064,29 @@ subroutine init_history_io(this,bounds_proc) default=trim(vdefault), & set_lake=0._r8,set_urb=0._r8) - case(patch_ground_r8) + case(patch_ground_r8, patch_size_pft_r8) + d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index dim2name = this%fates_hist%dim_bounds(d_index)%name call hist_addfld2d(fname=trim(vname),units=trim(vunits), & ! <--- addfld2d type2d=trim(dim2name), & ! <--- type2d avgflag=trim(vavgflag),long_name=trim(vlong), & ptr_patch=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) + default=trim(vdefault)) - case(patch_size_pft_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_patch=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_ground_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_size_pft_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_size_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_pft_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_age_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_height_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_fuel_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_cwdsc_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_can_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_cnlf_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_cnlfpft_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_scag_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_scagpft_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_agepft_r8) + case(site_ground_r8, site_size_pft_r8, site_size_r8, site_pft_r8, & + site_age_r8, site_height_r8, site_fuel_r8, site_cwdsc_r8, & + site_can_r8,site_cnlf_r8, site_cnlfpft_r8, site_scag_r8, & + site_scagpft_r8, site_agepft_r8, site_elem_r8, site_elpft_r8, & + site_elcwd_r8, site_elage_r8) + d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index dim2name = this%fates_hist%dim_bounds(d_index)%name call hist_addfld2d(fname=trim(vname),units=trim(vunits), & type2d=trim(dim2name), & avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) + ptr_col=this%fates_hist%hvars(ivar)%r82d, & + default=trim(vdefault)) case default write(iulog,*) 'A FATES iotype was created that was not registerred' @@ -2257,6 +2124,27 @@ subroutine init_soil_depths(this, nc) this%fates(nc)%bc_in(s)%z_sisl(1:nlevsoil) = col%z(c,1:nlevsoil) this%fates(nc)%bc_in(s)%dz_decomp_sisl(1:nlevdecomp) = & dzsoi_decomp(1:nlevdecomp) + + if (use_vertsoilc) then + do j=1,nlevsoil + this%fates(nc)%bc_in(s)%decomp_id(j) = j + ! Check to make sure that dz = dz_decomp_sisl when vertical soil dynamics + ! are active + if(abs(this%fates(nc)%bc_in(s)%dz_decomp_sisl(j)-this%fates(nc)%bc_in(s)%dz_sisl(j))>1.e-10_r8)then + write(iulog,*) 'when vertical soil decomp dynamics are on' + write(iulog,*) 'fates assumes that the decomposition depths equal the soil depths' + write(iulog,*) 'layer: ',j + write(iulog,*) 'dz_decomp_sisl(j): ',this%fates(nc)%bc_in(s)%dz_decomp_sisl(j) + write(iulog,*) 'dz_sisl(j): ',this%fates(nc)%bc_in(s)%dz_sisl(j) + call endrun(msg=errMsg(sourcefile, __LINE__)) + end if + end do + else + do j=1,nlevsoil + this%fates(nc)%bc_in(s)%decomp_id(j) = 1 + end do + end if + end do return @@ -2442,10 +2330,11 @@ subroutine hlm_bounds_to_fates_bounds(hlm, fates) use FatesIODimensionsMod, only : fates_bounds_type use FatesInterfaceMod, only : nlevsclass, nlevage use FatesInterfaceMod, only : nlevheight - use EDtypesMod, only : nfsc, ncwd - use EDtypesMod, only : nlevleaf, nclmax + use EDtypesMod, only : nfsc + use FatesLitterMod, only : ncwd + use EDtypesMod, only : nlevleaf, nclmax use FatesInterfaceMod, only : numpft_fates => numpft - use clm_varpar, only : nlevgrnd + use clm_varpar, only : nlevgrnd implicit none @@ -2502,6 +2391,19 @@ subroutine hlm_bounds_to_fates_bounds(hlm, fates) fates%cnlfpft_begin = 1 fates%cnlfpft_end = nlevleaf * nclmax * numpft_fates + + fates%elem_begin = 1 + fates%elem_end = num_elements + + fates%elpft_begin = 1 + fates%elpft_end = num_elements * numpft_fates + + fates%elcwd_begin = 1 + fates%elcwd_end = num_elements * ncwd + + fates%elage_begin = 1 + fates%elage_end = num_elements * nlevage + end subroutine hlm_bounds_to_fates_bounds diff --git a/test/tools/test_driver.sh b/test/tools/test_driver.sh index 39b945fcdc..0cd322b9d2 100755 --- a/test/tools/test_driver.sh +++ b/test/tools/test_driver.sh @@ -40,15 +40,15 @@ input_file="tests_pretag_cheyenne_nompi" c_threads=36 -export INITMODULES="/glade/u/apps/ch/opt/lmod/7.2.1/lmod/lmod/init/sh" +export INITMODULES="/glade/u/apps/ch/opt/lmod/8.1.7/lmod/lmod/init/sh" . \$INITMODULES module purge -module load ncarenv/1.0 -module load intel/17.0.1 +module load ncarenv +module load intel module load mkl -module load ncarcompilers/0.3.5 -module load netcdf/4.4.1.1 +module load ncarcompilers +module load netcdf module load nco module load python @@ -88,7 +88,7 @@ EOF ;; ## DAV cluster - geyser* | caldera* | pronghorn*) + casper* | pronghorn*) submit_script="test_driver_dav${cur_time}.sh" ##vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv writing to batch script vvvvvvvvvvvvvvvvvvv @@ -101,16 +101,16 @@ input_file="tests_posttag_dav_mpi" c_threads=36 -export INITMODULES="/glade/u/apps/ch/opt/lmod/7.2.1/lmod/lmod/init/sh" +export INITMODULES="/glade/u/apps/ch/opt/lmod/8.1.7/lmod/lmod/init/sh" . \$INITMODULES module purge -module load ncarenv/1.0 -module load intel/12.1.5 +module load ncarenv +module load intel module load mkl module load ncarcompilers -module load netcdf/4.3.3.1 -module load mpich-slurm/3.2.1 +module load netcdf +module load openmpi module load nco module load python @@ -210,9 +210,9 @@ export INITMODULES="/usr/share/Modules/init/sh" . \$INITMODULES module purge -module load compiler/intel/18.0.3 -module load tool/nco/4.7.5 -module load tool/netcdf/4.6.1/intel +module load compiler/intel +module load tool/nco +module load tool/netcdf export NETCDF_DIR=\$NETCDF_PATH export INC_NETCDF=\${NETCDF_PATH}/include @@ -290,9 +290,9 @@ export INITMODULES="/usr/share/Modules/init/sh" . \$INITMODULES module purge -module load compiler/intel/19.0.1 -module load tool/nco/4.7.5 -module load tool/netcdf/4.6.1/intel +module load compiler/intel +module load tool/nco +module load tool/netcdf export NETCDF_DIR=\$NETCDF_PATH export INC_NETCDF=\${NETCDF_PATH}/include diff --git a/tools/mkmapdata/mknoocnmap.pl b/tools/mkmapdata/mknoocnmap.pl index 67e65e6a70..5438c8bcd3 100755 --- a/tools/mkmapdata/mknoocnmap.pl +++ b/tools/mkmapdata/mknoocnmap.pl @@ -256,13 +256,19 @@ sub absolute_path { print "\n\nCreate SCRIP grid and mapping files for a single-point\n"; } # land grid... +my $GITDES = `cd $scrdir; git describe; cd -`; +$GITDES =~ s/\n//g; my $grddir = absolute_path( "$scrdir/../mkmapgrids" ); -my $grid1 = "$grddir/SCRIPgrid_${name}_nomask_c${cdate}.nc"; +my $cwd = getcwd(); +my $datdir = $grddir; +if ( $cwd ne $scrdir ) { + $datdir = $cwd; +} +my $grid1 = "$datdir/SCRIPgrid_${name}_nomask_c${cdate}.nc"; my $cmdenv = "env S_LAT=$S_lat W_LON=$W_lon N_LAT=$N_lat E_LON=$E_lon " . - "NX=$nx NY=$ny PTNAME=$name $print "; + "NX=$nx NY=$ny PTNAME=$name GITDES=$GITDES $print "; -chdir( "$grddir" ); -my $cmd = "$cmdenv GRIDFILE=$grid1 ncl mkscripgrid.ncl"; +my $cmd = "$cmdenv GRIDFILE=$grid1 ncl $scrdir/../mkmapgrids/mkscripgrid.ncl"; if ( $printlev > 0 ) { print "Create land SCRIP gridfile\n"; print "Execute: $cmd\n"; @@ -270,8 +276,8 @@ sub absolute_path { system( $cmd ); # ocean grid... -my $grid2 = "$grddir/SCRIPgrid_${name}_noocean_c${cdate}.nc"; -my $cmd = "$cmdenv GRIDFILE=$grid2 IMASK=0 ncl mkscripgrid.ncl"; +my $grid2 = "$datdir/SCRIPgrid_${name}_noocean_c${cdate}.nc"; +my $cmd = "$cmdenv GRIDFILE=$grid2 IMASK=0 ncl $scrdir/../mkmapgrids/mkscripgrid.ncl"; if ( $printlev > 0 ) { print "Create ocean SCRIP gridfile\n"; print "Execute: $cmd\n"; @@ -281,10 +287,9 @@ sub absolute_path { # Now create a unity mapping between the two... # Note reversal of grid1 & grid2, because we want an ocean -> land # mapping file -chdir( "$scrdir" ); -my $mapfile = "map_${name}_noocean_to_${name}_nomask_aave_da_${cdate}.nc"; +my $mapfile = "$datdir/map_${name}_noocean_to_${name}_nomask_aave_da_${cdate}.nc"; my $cmd = "env GRIDFILE1=$grid2 GRIDFILE2=$grid1 MAPFILE=$mapfile " . - "$print ncl $scrdir/mkunitymap.ncl"; + "GITDES=$GITDES $print ncl $scrdir/mkunitymap.ncl"; if ( $printlev > 0 ) { print "Create unity mapping file between the two gridfile\n"; diff --git a/tools/mkmapdata/mkunitymap.ncl b/tools/mkmapdata/mkunitymap.ncl index ce0c17f988..7570f7eedd 100644 --- a/tools/mkmapdata/mkunitymap.ncl +++ b/tools/mkmapdata/mkunitymap.ncl @@ -23,6 +23,8 @@ begin print_str = getenv("PRINT"); ; Do Extra printing for debugging + gitdescribe = getenv("GITDES"); ; Git describe from the source clone + if ( ismissing(gridfile1) )then print( "ERROR: GRIDFILE1 is missing!" ); exit @@ -45,6 +47,10 @@ begin end if end if + if ( ismissing(gitdescribe) )then + gitdescribe = systemfunc( "git describe" ) + end if + ; ; Open up the input grid files ; @@ -134,7 +140,7 @@ begin nc@grid_file_dst = gridfile2; nc@title = "SCRIP mapping file between identical grids without ocean"; nc@history = ldate+": create using mkunitymap.ncl"; - nc@Version = systemfunc( "git describe" ); + nc@Version = gitdescribe; ; ; Fraction diff --git a/tools/mkmapgrids/mkscripgrid.ncl b/tools/mkmapgrids/mkscripgrid.ncl index 0bfb26671c..65b9306f2d 100644 --- a/tools/mkmapgrids/mkscripgrid.ncl +++ b/tools/mkmapgrids/mkscripgrid.ncl @@ -36,6 +36,8 @@ begin outfilename = getenv("GRIDFILE"); ; Get filename from env variable + gitdescribe = getenv("GITDES"); ; Git describe from the source clone + if ( ismissing(nx) )then nx = 1; end if @@ -82,6 +84,10 @@ begin end if end if + if ( ismissing(gitdescribe) )then + gitdescribe = systemfunc( "git describe" ) + end if + system( "/bin/rm -f "+outfilename ); if ( printn )then print( "output file: "+outfilename ); @@ -156,7 +162,7 @@ end nc = addfile( outfilename, "w" ); nc@history = ldate+": create using mkscripgrid.ncl"; nc@comment = "Ocean is assumed to non-existant at this point"; - nc@Version = systemfunc( "git describe" ); + nc@Version = gitdescribe; if ( printn )then print( "================================================================================================" ); print( "Successfully created SCRIP grid file: "+outfilename);