From 64586e91f6cac81148f875a08238d8339a99932a Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Wed, 27 Feb 2019 10:02:49 -0800 Subject: [PATCH 01/62] Passing bc_in to fates set_site_properties for initializatoin purposes --- src/utils/clmfates_interfaceMod.F90 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 84c4e5901f..79f719515d 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -1230,7 +1230,9 @@ subroutine init_coldstart(this, waterstate_inst, canopystate_inst, soilstate_ins 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, & + this%fates(nc)%bc_in) ! ---------------------------------------------------------------------------- ! Initialize Hydraulics Code if turned on From 824835ceef9bbb444caed453c8be86f1d8cdf22e Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Tue, 5 Mar 2019 18:03:48 -0800 Subject: [PATCH 02/62] Adding decomp to soil layer mapping table --- src/utils/clmfates_interfaceMod.F90 | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 84c4e5901f..87acba3fe9 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -2257,6 +2257,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 From 0a24f4bc069bef7f901239946ca1fa1c41746949 Mon Sep 17 00:00:00 2001 From: ckoven Date: Tue, 29 May 2018 11:12:30 -0600 Subject: [PATCH 03/62] applied changes in ctsm github issue #85 to fix mfilt error --- src/main/controlMod.F90 | 4 +--- src/main/histFileMod.F90 | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index 91f10e2828..dd6d37ed20 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -323,9 +323,7 @@ subroutine control_init( ) ! History and restart files do i = 1, max_tapes - if (hist_nhtfrq(i) == 0) then - hist_mfilt(i) = 1 - else if (hist_nhtfrq(i) < 0) then + if (hist_nhtfrq(i) < 0) then hist_nhtfrq(i) = nint(-hist_nhtfrq(i)*SHR_CONST_CDAY/(24._r8*dtime)) endif end do diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 0aaa2afae5..31a3d13f1d 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -66,7 +66,7 @@ module histFileMod integer, public :: & hist_ndens(max_tapes) = 2 ! namelist: output density of netcdf history files integer, public :: & - hist_mfilt(max_tapes) = 30 ! namelist: number of time samples per tape + hist_mfilt(max_tapes) = (/ 1, (30, ni=2, max_tapes/) ! namelist: number of time samples per tape logical, public :: & hist_dov2xy(max_tapes) = (/.true.,(.true.,ni=2,max_tapes)/) ! namelist: true=> do grid averaging integer, public :: & From b9c92b7ca189a91d9b14720b3b466c62e03db812 Mon Sep 17 00:00:00 2001 From: ckoven Date: Tue, 29 May 2018 11:49:34 -0600 Subject: [PATCH 04/62] compile-time bugfix on prior --- src/main/histFileMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 31a3d13f1d..74b7aeea24 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -66,7 +66,7 @@ module histFileMod integer, public :: & hist_ndens(max_tapes) = 2 ! namelist: output density of netcdf history files integer, public :: & - hist_mfilt(max_tapes) = (/ 1, (30, ni=2, max_tapes/) ! namelist: number of time samples per tape + hist_mfilt(max_tapes) = (/ 1, (30, ni=2, max_tapes)/) ! namelist: number of time samples per tape logical, public :: & hist_dov2xy(max_tapes) = (/.true.,(.true.,ni=2,max_tapes)/) ! namelist: true=> do grid averaging integer, public :: & From 395ab0ef241cfc9b37f612b7844f9e3240d79625 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Thu, 4 Apr 2019 19:00:30 -0600 Subject: [PATCH 05/62] Using temporary testing parameter file location for fates, set z0m and displa from FATES as constant. --- bld/namelist_files/namelist_defaults_clm4_5.xml | 4 +++- cime_config/testdefs/testlist_clm.xml | 2 +- src/biogeophys/CanopyTemperatureMod.F90 | 9 ++++++--- src/utils/clmfates_interfaceMod.F90 | 5 +++++ 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_clm4_5.xml b/bld/namelist_files/namelist_defaults_clm4_5.xml index d0522d97cc..c811f8b0d4 100644 --- a/bld/namelist_files/namelist_defaults_clm4_5.xml +++ b/bld/namelist_files/namelist_defaults_clm4_5.xml @@ -355,7 +355,9 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/fates_params_default_2trop.c190205.nc + +/glade/u/home/rgknox/ctsm/src/fates/parameter_files/fates_params_12blt_api.7.2.0.nc + diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 56aefdaf5c..5cc29275ce 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1965,7 +1965,7 @@ - + diff --git a/src/biogeophys/CanopyTemperatureMod.F90 b/src/biogeophys/CanopyTemperatureMod.F90 index 97fc45884f..8f26e9dde7 100644 --- a/src/biogeophys/CanopyTemperatureMod.F90 +++ b/src/biogeophys/CanopyTemperatureMod.F90 @@ -400,15 +400,18 @@ subroutine CanopyTemperature(bounds, & ! of its dynamics call. If and when crops are ! enabled simultaneously with FATES, we will ! have to apply a filter here. - if(use_fates) then - call clm_fates%TransferZ0mDisp(bounds,frictionvel_inst,canopystate_inst) - end if +! if(use_fates) then +! call clm_fates%TransferZ0mDisp(bounds,frictionvel_inst,canopystate_inst) +! end if do fp = 1,num_nolakep p = filter_nolakep(fp) if( .not.(patch%is_fates(p))) then z0m(p) = z0mr(patch%itype(p)) * htop(p) displa(p) = displar(patch%itype(p)) * htop(p) + else + z0m(p) = 1.0_r8 + displa(p) = 10.0_r8 end if end do diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 84c4e5901f..0ec9d2ca3b 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -1931,6 +1931,11 @@ subroutine TransferZ0mDisp(this,bounds_clump,frictionvel_inst,canopystate_inst) frictionvel_inst%z0m_patch(col%patchi(c)+1:col%patchf(c)) = 0.0_r8 canopystate_inst%displa_patch(col%patchi(c)+1:col%patchf(c)) = 0.0_r8 + if(this%fates(ci)%sites(s)%youngest_patch%patchno<1 .or. this%fates(ci)%sites(s)%youngest_patch%patchno>14)then + write(iulog,*) 'weird patch numbers',this%fates(ci)%sites(s)%youngest_patch%patchno + call endrun(msg=errMsg(sourcefile, __LINE__)) + end if + do ifp = 1, this%fates(ci)%sites(s)%youngest_patch%patchno p = ifp+col%patchi(c) frictionvel_inst%z0m_patch(p) = this%fates(ci)%bc_out(s)%z0m_pa(ifp) From 645e52097b4c07f07d66c3b913880ceba3f7a1c3 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Fri, 5 Apr 2019 14:30:09 -0600 Subject: [PATCH 06/62] Updated temporary fate default file location --- bld/namelist_files/namelist_defaults_clm4_5.xml | 2 +- src/biogeophys/CanopyFluxesMod.F90 | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_clm4_5.xml b/bld/namelist_files/namelist_defaults_clm4_5.xml index c811f8b0d4..eb7b827a1b 100644 --- a/bld/namelist_files/namelist_defaults_clm4_5.xml +++ b/bld/namelist_files/namelist_defaults_clm4_5.xml @@ -356,7 +356,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -/glade/u/home/rgknox/ctsm/src/fates/parameter_files/fates_params_12blt_api.7.2.0.nc +/glade/u/home/rgknox/ctsm/src/fates/parameter_files/fates_params_api.7.2.0.nc diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 7c9feb8a25..42e403b5ec 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 From 2b46317ea650942d97cf6e856bb45cc7c62e0b1e Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Sat, 6 Apr 2019 14:23:44 -0600 Subject: [PATCH 07/62] update default file location to fates api 7.2.0 --- bld/namelist_files/namelist_defaults_clm4_5.xml | 4 +--- src/biogeophys/CanopyTemperatureMod.F90 | 9 +++------ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_clm4_5.xml b/bld/namelist_files/namelist_defaults_clm4_5.xml index eb7b827a1b..2e8104f944 100644 --- a/bld/namelist_files/namelist_defaults_clm4_5.xml +++ b/bld/namelist_files/namelist_defaults_clm4_5.xml @@ -355,9 +355,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). - -/glade/u/home/rgknox/ctsm/src/fates/parameter_files/fates_params_api.7.2.0.nc - +lnd/clm2/paramdata/fates_params_api.7.2.0.nc diff --git a/src/biogeophys/CanopyTemperatureMod.F90 b/src/biogeophys/CanopyTemperatureMod.F90 index 8f26e9dde7..97fc45884f 100644 --- a/src/biogeophys/CanopyTemperatureMod.F90 +++ b/src/biogeophys/CanopyTemperatureMod.F90 @@ -400,18 +400,15 @@ subroutine CanopyTemperature(bounds, & ! of its dynamics call. If and when crops are ! enabled simultaneously with FATES, we will ! have to apply a filter here. -! if(use_fates) then -! call clm_fates%TransferZ0mDisp(bounds,frictionvel_inst,canopystate_inst) -! end if + if(use_fates) then + call clm_fates%TransferZ0mDisp(bounds,frictionvel_inst,canopystate_inst) + end if do fp = 1,num_nolakep p = filter_nolakep(fp) if( .not.(patch%is_fates(p))) then z0m(p) = z0mr(patch%itype(p)) * htop(p) displa(p) = displar(patch%itype(p)) * htop(p) - else - z0m(p) = 1.0_r8 - displa(p) = 10.0_r8 end if end do From 3439da7e07ee6174229568bae6bae148b550ed9d Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Sat, 6 Apr 2019 14:50:03 -0600 Subject: [PATCH 08/62] Removed temporary in-code diagnostic in the fates interface --- src/utils/clmfates_interfaceMod.F90 | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 0ec9d2ca3b..84c4e5901f 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -1931,11 +1931,6 @@ subroutine TransferZ0mDisp(this,bounds_clump,frictionvel_inst,canopystate_inst) frictionvel_inst%z0m_patch(col%patchi(c)+1:col%patchf(c)) = 0.0_r8 canopystate_inst%displa_patch(col%patchi(c)+1:col%patchf(c)) = 0.0_r8 - if(this%fates(ci)%sites(s)%youngest_patch%patchno<1 .or. this%fates(ci)%sites(s)%youngest_patch%patchno>14)then - write(iulog,*) 'weird patch numbers',this%fates(ci)%sites(s)%youngest_patch%patchno - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - do ifp = 1, this%fates(ci)%sites(s)%youngest_patch%patchno p = ifp+col%patchi(c) frictionvel_inst%z0m_patch(p) = this%fates(ci)%bc_out(s)%z0m_pa(ifp) From c56da1833522fcfe01fa797739b12308064afb18 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Tue, 9 Apr 2019 15:29:56 -0600 Subject: [PATCH 09/62] Updated the fates default parameter file to use description and date as well as the tag. Added the long hydro test to expected fails. --- bld/namelist_files/namelist_defaults_clm4_5.xml | 2 +- cime_config/testdefs/ExpectedTestFails.xml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_clm4_5.xml b/bld/namelist_files/namelist_defaults_clm4_5.xml index 2e8104f944..979aa29bb7 100644 --- a/bld/namelist_files/namelist_defaults_clm4_5.xml +++ b/bld/namelist_files/namelist_defaults_clm4_5.xml @@ -355,7 +355,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/fates_params_api.7.2.0.nc +lnd/clm2/paramdata/fates_params_api.7.2.0_12pft_c190409.nc diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml index ff9e56cd06..3ab5e7cc64 100644 --- a/cime_config/testdefs/ExpectedTestFails.xml +++ b/cime_config/testdefs/ExpectedTestFails.xml @@ -14,5 +14,6 @@ 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 SMS_Lm3_D_Mmpi-serial.1x1_brazil.I2000Clm50FatesCruGs.cheyenne_intel.clm-FatesHydro RUN From 6ae74215654996d9c6a6395c5e7a541278dbe60c Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Tue, 9 Apr 2019 22:59:28 -0600 Subject: [PATCH 10/62] Extended wallime of the fates ly2 1x1 brazil smoke test on cheyenne --- cime_config/testdefs/testlist_clm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 5cc29275ce..f2632b2fe8 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1965,7 +1965,7 @@ - + From e580a8908bbf7cc6c0d8fde85b964fc699dde16a Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Wed, 10 Apr 2019 13:41:53 -0600 Subject: [PATCH 11/62] Reduced 2 year fates test to 13 months --- cime_config/testdefs/testlist_clm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index f2632b2fe8..0fc19a16d3 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1959,7 +1959,7 @@ - + From 2cb96c6577ebf9065e17946294b80071dbfe49d8 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Wed, 10 Apr 2019 17:02:49 -0600 Subject: [PATCH 12/62] Updated fates tag in externals --- Externals_CLM.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index eaf16ffd2c..32431cb476 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -2,7 +2,7 @@ local_path = src/fates protocol = git repo_url = https://github.com/NGEET/fates -tag = sci.1.23.0_api.7.1.0 +tag = sci.1.26.1_api.7.2.0 required = True [PTCLM] From 9ee0e92298fdd88fd866b5345bdf819862dfb0d7 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Thu, 11 Apr 2019 10:51:41 -0700 Subject: [PATCH 13/62] update fates output flux variable names --- src/utils/clmfates_interfaceMod.F90 | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 79f719515d..41a561e2ee 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -109,6 +109,7 @@ module CLMFatesInterfaceMod 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 @@ -709,11 +710,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 @@ -2504,6 +2508,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 From 55129b8fa8f5e923be5f5f78e23e1a6819862083 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Thu, 18 Apr 2019 17:29:06 -0700 Subject: [PATCH 14/62] Changed call to fates routine FluxIntoLitterPools --- src/utils/clmfates_interfaceMod.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 87acba3fe9..42d2ae2457 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -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) From 306599f95f721f0f4078e2c476e3382b44e1cd17 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Tue, 23 Apr 2019 14:02:14 -0700 Subject: [PATCH 15/62] Removed some outdated mass balance accounting code in fates interface --- src/utils/clmfates_interfaceMod.F90 | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 47798e4b53..d369ed0b9e 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -107,7 +107,6 @@ 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 @@ -1884,29 +1883,6 @@ 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) - end associate end subroutine wrap_bgc_summary From a40df0c24ecd45c19ccb90eed7dab502fc4a3ada Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Mon, 6 May 2019 13:50:15 -0700 Subject: [PATCH 16/62] Fates: updating history dimensions for multi-element, fixed a dimension check --- src/main/histFileMod.F90 | 67 +++++++++--- src/utils/clmfates_interfaceMod.F90 | 155 ++++------------------------ 2 files changed, 75 insertions(+), 147 deletions(-) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 74b7aeea24..1aa2bead57 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -25,7 +25,8 @@ module histFileMod use FatesInterfaceMod , only : nlevsclass, nlevage use FatesInterfaceMod , only : nlevheight use EDTypesMod , only : nfsc, ncwd - use FatesInterfaceMod , only : numpft_ed => numpft + use EDTypesMod , only : num_elements_fates => num_elements + use FatesInterfaceMod , only : numpft_fates => numpft use ncdio_pio ! @@ -2056,18 +2057,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 @@ -2502,6 +2507,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 @@ -2598,6 +2612,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', 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_levage', & + long_name='FATES element map into age x pft', units='-', ncid=nfid(t)) end if @@ -2633,7 +2661,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 @@ -4786,7 +4821,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') @@ -4796,23 +4831,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 diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index d369ed0b9e..520acfa5dc 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -1884,6 +1884,12 @@ subroutine wrap_bgc_summary(this, nc, soilbiogeochem_carbonflux_inst, & this%fates(nc)%bc_in(s)%tot_litc = totlitc(c) end do + ! 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)%bc_in) + end associate end subroutine wrap_bgc_summary @@ -1936,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 @@ -2057,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' @@ -2245,7 +2130,7 @@ subroutine init_soil_depths(this, nc) 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 + 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 From c082bfea39fc69ff45beb099d8c39f6a46956730 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Mon, 6 May 2019 20:50:47 -0700 Subject: [PATCH 17/62] Updated site intiailization in fates --- src/utils/clmfates_interfaceMod.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 520acfa5dc..a4ee325a48 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -1229,7 +1229,7 @@ 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 @@ -1306,7 +1306,7 @@ subroutine init_coldstart(this, waterstate_inst, canopystate_inst, soilstate_ins end if end do !$OMP END PARALLEL DO - + end subroutine init_coldstart ! ====================================================================================== From afb4497ad7354d3b6eb09b39d7e21396e1daa1fb Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Tue, 7 May 2019 16:51:03 -0700 Subject: [PATCH 18/62] fates: fixed an incorrect dimension in fates history writing --- src/main/histFileMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 1aa2bead57..bca6de08b4 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -2624,7 +2624,7 @@ subroutine htape_timeconst(t, mode) 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_levage', & + 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 From ebd16eec60f440a46b9068bd467e0f269a0abac1 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Mon, 13 May 2019 14:54:25 -0600 Subject: [PATCH 19/62] Updates the default fates parameter file (backwards compatible). --- bld/namelist_files/namelist_defaults_clm4_5.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_clm4_5.xml b/bld/namelist_files/namelist_defaults_clm4_5.xml index 979aa29bb7..27acd68256 100644 --- a/bld/namelist_files/namelist_defaults_clm4_5.xml +++ b/bld/namelist_files/namelist_defaults_clm4_5.xml @@ -355,7 +355,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/fates_params_api.7.2.0_12pft_c190409.nc +lnd/clm2/paramdata/fates_params_api.7.2.1_12pft_c190513.nc From 4b21a1318d0c2e13c72cb0ffc5beb5a1912c6a1b Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Tue, 14 May 2019 17:51:27 -0700 Subject: [PATCH 20/62] Adding history field_info member numdims, which will allow 2nd dimensions of 1. --- src/main/histFileMod.F90 | 49 ++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index bca6de08b4..9375225d2f 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -192,6 +192,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 @@ -307,7 +310,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) @@ -323,6 +326,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 @@ -401,6 +405,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 @@ -1055,6 +1060,7 @@ 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)"] !----------------------------------------------------------------------- @@ -1062,10 +1068,12 @@ subroutine hist_update_hbuf(bounds) do t = 1,ntapes !$OMP PARALLEL DO PRIVATE (f, num2d) 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 @@ -2613,7 +2621,7 @@ subroutine htape_timeconst(t, mode) 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', ncid=nfid(t)) + 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', & @@ -2914,6 +2922,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 @@ -2957,6 +2966,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 @@ -2989,7 +2999,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, & @@ -3001,7 +3011,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, & @@ -3022,7 +3032,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' @@ -3033,7 +3043,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 @@ -3044,7 +3054,7 @@ subroutine hfields_write(t, mode) ! Deallocate dynamic memory - if (num2d == 1) then + if (numdims == 1) then deallocate(hist1do) end if @@ -4702,10 +4712,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 @@ -5017,12 +5028,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 From 9a7fae3a6775ee167b0f775059dcfa1d671bee40 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Wed, 15 May 2019 15:04:10 -0600 Subject: [PATCH 21/62] Updated to default file api7.2.2 --- bld/namelist_files/namelist_defaults_clm4_5.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_clm4_5.xml b/bld/namelist_files/namelist_defaults_clm4_5.xml index 27acd68256..392a556a0d 100644 --- a/bld/namelist_files/namelist_defaults_clm4_5.xml +++ b/bld/namelist_files/namelist_defaults_clm4_5.xml @@ -355,7 +355,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/fates_params_api.7.2.1_12pft_c190513.nc +lnd/clm2/paramdata/fates_params_api.7.2.2_12pft_c190513.nc From 67671482d9200f59620f09be828dc2c4bfaedb38 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Wed, 15 May 2019 15:33:16 -0600 Subject: [PATCH 22/62] Updated default fates param file --- bld/namelist_files/namelist_defaults_clm4_5.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_clm4_5.xml b/bld/namelist_files/namelist_defaults_clm4_5.xml index 392a556a0d..c9098697b6 100644 --- a/bld/namelist_files/namelist_defaults_clm4_5.xml +++ b/bld/namelist_files/namelist_defaults_clm4_5.xml @@ -355,7 +355,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/fates_params_api.7.2.2_12pft_c190513.nc +lnd/clm2/paramdata/fates_params_api.7.2.2_12pft_c190515.nc From d878635ec6b1dd6aa20e986d3133e43abf5e6e7d Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Sun, 19 May 2019 13:54:07 -0700 Subject: [PATCH 23/62] fates multi-element, updated arguments to set_site_properties --- src/utils/clmfates_interfaceMod.F90 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index a4ee325a48..7e35b2a702 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -1234,8 +1234,7 @@ subroutine init_coldstart(this, waterstate_inst, canopystate_inst, soilstate_ins end do call set_site_properties(this%fates(nc)%nsites, & - this%fates(nc)%sites, & - this%fates(nc)%bc_in) + this%fates(nc)%sites) ! ---------------------------------------------------------------------------- ! Initialize Hydraulics Code if turned on From 5acdd7b39dcb9fc2c4444b4245fdfdf9c60fd3bd Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Fri, 31 May 2019 11:32:09 -0600 Subject: [PATCH 24/62] Update hooks for fates sci1.27.1_api7.3.0 --- Externals_CLM.cfg | 2 +- bld/namelist_files/namelist_defaults_clm4_5.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index 32431cb476..b440c99ea3 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -2,7 +2,7 @@ local_path = src/fates protocol = git repo_url = https://github.com/NGEET/fates -tag = sci.1.26.1_api.7.2.0 +tag = sci.1.27.1_api.7.3.0 required = True [PTCLM] diff --git a/bld/namelist_files/namelist_defaults_clm4_5.xml b/bld/namelist_files/namelist_defaults_clm4_5.xml index c9098697b6..bfd5b7ce2d 100644 --- a/bld/namelist_files/namelist_defaults_clm4_5.xml +++ b/bld/namelist_files/namelist_defaults_clm4_5.xml @@ -355,7 +355,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/fates_params_api.7.2.2_12pft_c190515.nc +lnd/clm2/paramdata/fates_params_api.7.3.0_12pft_c190530.nc From de7dcb0e87296a3fc505a1afc92b40cd989abeb3 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Tue, 18 Jun 2019 11:40:44 -0700 Subject: [PATCH 25/62] fates multi-element: we moved ncwd to a new module, now pointing to correct place. --- src/main/histFileMod.F90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 9375225d2f..822dc249ce 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -24,7 +24,8 @@ module histFileMod use EDTypesMod , only : nlevleaf use FatesInterfaceMod , only : nlevsclass, nlevage use FatesInterfaceMod , only : nlevheight - use EDTypesMod , only : nfsc, ncwd + 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 From 946519e0e5cfe70e3b094d07d166e32357436cf1 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Tue, 18 Jun 2019 12:00:05 -0700 Subject: [PATCH 26/62] fates-multi-element: pointing to correct location of ncwd --- src/utils/clmfates_interfaceMod.F90 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 7e35b2a702..d1d3d45308 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -2329,10 +2329,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 From cc0b01b47294b359710a4c828193fb384bf45987 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Tue, 30 Jul 2019 14:21:45 -0700 Subject: [PATCH 27/62] fixes to transpiration boundary condition to FATES-HYDRO. --- src/biogeophys/CanopyFluxesMod.F90 | 2 +- src/utils/clmfates_interfaceMod.F90 | 37 +++++++++++++++++++++++++---- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 42e403b5ec..862a7248df 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -1266,7 +1266,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, call clm_fates%wrap_accumulatefluxes(nc,fn,filterp(1:fn)) - call clm_fates%wrap_hydraulics_drive(bounds,nc,soilstate_inst, & + call clm_fates%wrap_hydraulics_drive(bounds,nc,fn,filterp(1:fn),soilstate_inst, & waterstate_inst,waterflux_inst,solarabs_inst,energyflux_inst) else diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 84c4e5901f..2c9ae8b53d 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -1419,6 +1419,13 @@ subroutine prep_canopyfluxes(this, nc, fn, filterp, photosyns_inst) do s = 1, this%fates(nc)%nsites ! filter flag == 1 means that this patch has not been called for photosynthesis this%fates(nc)%bc_in(s)%filter_photo_pa(:) = 1 + + ! set transpiration input boundary condition to zero. The exposed + ! vegetation filter may not even call every patch. + + this%fates(nc)%bc_in(s)%qflx_transp_pa(:) = 0._r8 + + end do end subroutine prep_canopyfluxes @@ -2343,6 +2350,7 @@ end subroutine ComputeRootSoilFlux ! ====================================================================================== subroutine wrap_hydraulics_drive(this, bounds_clump, nc, & + fn, filterp, & soilstate_inst, waterstate_inst, waterflux_inst, & solarabs_inst, energyflux_inst) @@ -2351,6 +2359,8 @@ subroutine wrap_hydraulics_drive(this, bounds_clump, nc, & class(hlm_fates_interface_type), intent(inout) :: this type(bounds_type),intent(in) :: bounds_clump integer,intent(in) :: nc + integer, intent(in) :: fn + integer, intent(in) :: filterp(fn) type(soilstate_type) , intent(inout) :: soilstate_inst type(waterstate_type) , intent(inout) :: waterstate_inst type(waterflux_type) , intent(inout) :: waterflux_inst @@ -2361,6 +2371,7 @@ subroutine wrap_hydraulics_drive(this, bounds_clump, nc, & integer :: s integer :: c integer :: j + integer :: f ! loop index for the patch filter integer :: ifp integer :: p integer :: nlevsoil @@ -2397,12 +2408,28 @@ subroutine wrap_hydraulics_drive(this, bounds_clump, nc, & soilstate_inst%eff_porosity_col(c,1:nlevsoil) do ifp = 1, this%fates(nc)%sites(s)%youngest_patch%patchno - p = ifp+col%patchi(c) - this%fates(nc)%bc_in(s)%swrad_net_pa(ifp) = solarabs_inst%fsa_patch(p) - this%fates(nc)%bc_in(s)%lwrad_net_pa(ifp) = energyflux_inst%eflx_lwrad_net_patch(p) - this%fates(nc)%bc_in(s)%qflx_transp_pa(ifp) = waterflux_inst%qflx_tran_veg_patch(p) + p = ifp+col%patchi(c) + ! fsa_patch was filled on the nourban_pa filter, which should cover + ! all fates patches. + ! These are not currently used anyway (RGK 07/30/19) + this%fates(nc)%bc_in(s)%swrad_net_pa(ifp) = solarabs_inst%fsa_patch(p) + this%fates(nc)%bc_in(s)%lwrad_net_pa(ifp) = energyflux_inst%eflx_lwrad_net_patch(p) end do - end do + + end do + + + ! The exposed vegetation filter "filterp" dictates which patches + ! had their transpiration updated during canopy_fluxes(). Patches + ! not in the filter had been zero'd during prep_canopyfluxes(). + + do f = 1,fn + p = filterp(f) + c = patch%column(p) + s = this%f2hmap(nc)%hsites(c) + ifp = p - col%patchi(c) + this%fates(nc)%bc_in(s)%qflx_transp_pa(ifp) = waterflux_inst%qflx_tran_veg_patch(p) + end do ! Call Fates Hydraulics ! ------------------------------------------------------------------------------------ From 4e50a445db9f40c7590b49cbc11f81025c30bc3a Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Thu, 1 Aug 2019 13:34:44 -0600 Subject: [PATCH 28/62] Updated FATES testmods_dirs to reflect changes in history variables. --- cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm | 8 +++++--- .../testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm | 4 +++- .../testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm | 2 +- .../testdefs/testmods_dirs/clm/FatesShortList/user_nl_clm | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) 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' From 90c01807431a4a71edde29e5968888f29bfa38a8 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Tue, 20 Aug 2019 11:29:46 -0700 Subject: [PATCH 29/62] created new procedure to condense setting FATES time --- src/utils/clmfates_interfaceMod.F90 | 113 ++++++++++++++++++---------- 1 file changed, 75 insertions(+), 38 deletions(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 84c4e5901f..925c9b30f5 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -197,6 +197,11 @@ module CLMFatesInterfaceMod ! developer will at least question its usage (RGK) private :: hlm_bounds_to_fates_bounds + ! ThGetAndSetFatesTimeis function is used to get the current time from the CIME + ! time procedures and then set to the fates global time variables during restart, + ! init_coldstart, and dynamics_driv function calls + private :: GetAndSetTime + logical :: debug = .false. character(len=*), parameter, private :: sourcefile = & @@ -513,11 +518,11 @@ subroutine init(this, bounds_proc ) call FatesReportParameters(masterproc) end subroutine init - - ! =================================================================================== - - subroutine check_hlm_active(this, nc, bounds_clump) - +init +init================================= +init +init +init ! --------------------------------------------------------------------------------- ! This subroutine is not currently used. It is just a utility that may come ! in handy when we have dynamic sites in FATES @@ -579,22 +584,9 @@ subroutine dynamics_driv(this, nc, bounds_clump, & integer :: c ! column index (HLM) integer :: ifp ! patch index integer :: p ! HLM patch index - integer :: yr ! year (0, ...) - integer :: mon ! month (1, ..., 12) - integer :: day ! day of month (1, ..., 31) - integer :: sec ! seconds of the day integer :: nlevsoil ! number of soil layers at the site integer :: nld_si ! site specific number of decomposition layers - integer :: current_year - integer :: current_month - integer :: current_day - integer :: current_tod - integer :: current_date - integer :: jan01_curr_year - integer :: reference_date - integer :: days_per_year - real(r8) :: model_day - real(r8) :: day_of_year + !----------------------------------------------------------------------- ! --------------------------------------------------------------------------------- @@ -606,24 +598,8 @@ subroutine dynamics_driv(this, nc, bounds_clump, & ! and it keeps all the boundaries in one location ! --------------------------------------------------------------------------------- - days_per_year = get_days_per_year() - call get_curr_date(current_year,current_month,current_day,current_tod) - current_date = current_year*10000 + current_month*100 + current_day - jan01_curr_year = current_year*10000 + 100 + 1 - - call get_ref_date(yr, mon, day, sec) - reference_date = yr*10000 + mon*100 + day - - call timemgr_datediff(reference_date, sec, current_date, current_tod, model_day) - - call timemgr_datediff(jan01_curr_year,0,current_date,sec,day_of_year) - - call SetFatesTime(current_year, current_month, & - current_day, current_tod, & - current_date, reference_date, & - model_day, floor(day_of_year), & - days_per_year, 1.0_r8/dble(days_per_year)) - + ! Set the FATES global time and date variables + call GetAndSetTime do s=1,this%fates(nc)%nsites @@ -1173,7 +1149,8 @@ subroutine restart( this, bounds_proc, ncid, flag, waterstate_inst, & this%fates(nc)%sites, & this%fates(nc)%bc_out) - + ! Set the FATES global time and date variables + !call GetAndSetTime ! ------------------------------------------------------------------------ ! Update history IO fields that depend on ecosystem dynamics @@ -1289,6 +1266,9 @@ subroutine init_coldstart(this, waterstate_inst, canopystate_inst, soilstate_ins call this%wrap_update_hlmfates_dyn(nc,bounds_clump, & waterstate_inst,canopystate_inst,frictionvel_inst) + ! Set the FATES global time and date variables + !call GetAndSetTime + ! ------------------------------------------------------------------------ ! Update history IO fields that depend on ecosystem dynamics ! ------------------------------------------------------------------------ @@ -2505,4 +2485,61 @@ subroutine hlm_bounds_to_fates_bounds(hlm, fates) end subroutine hlm_bounds_to_fates_bounds + ! ====================================================================================== + + subroutine GetAndSetTime() + + ! CLM MODULES + use clm_time_manager , only : get_days_per_year, & + get_curr_date, & + get_ref_date, & + timemgr_datediff, & + + ! FATES MODULES + use FatesInterfaceMod , only : SetFatesTime + + ! LOCAL VARIABLES + integer :: yr ! year (0, ...) + integer :: mon ! month (1, ..., 12) + integer :: day ! day of month (1, ..., 31) + integer :: sec ! seconds of the day + integer :: current_year + integer :: current_month + integer :: current_day + integer :: current_tod + integer :: current_date + integer :: jan01_curr_year + integer :: reference_date + integer :: days_per_year + real(r8) :: model_day + real(r8) :: day_of_year + + + ! Get the current date and determine the set the start of the current year + call get_curr_date(current_year,current_month,current_day,current_tod) + current_date = current_year*10000 + current_month*100 + current_day + jan01_curr_year = current_year*10000 + 100 + 1 + + ! Get the reference date components and compute the date + call get_ref_date(yr, mon, day, sec) + reference_date = yr*10000 + mon*100 + day + + ! Get the defined number of days per year + days_per_year = get_days_per_year() + + ! Determine the model day + call timemgr_datediff(reference_date, sec, current_date, current_tod, model_day) + + ! Determine the current DOY + call timemgr_datediff(jan01_curr_year,0,current_date,sec,day_of_year) + + ! Set the FATES global time variables + call SetFatesTime(current_year, current_month, & + current_day, current_tod, & + current_date, reference_date, & + model_day, floor(day_of_year), & + days_per_year, 1.0_r8/dble(days_per_year)) + + end subroutine GetAndSetTime + end module CLMFatesInterfaceMod From 31ce51c67e8058acc1e0cefa6aacdfd08c4a6f29 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Tue, 20 Aug 2019 12:38:42 -0700 Subject: [PATCH 30/62] fixing accidental deletion --- src/utils/clmfates_interfaceMod.F90 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 925c9b30f5..5f542e5cb7 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -518,11 +518,11 @@ subroutine init(this, bounds_proc ) call FatesReportParameters(masterproc) end subroutine init -init -init================================= -init -init -init + + ! =================================================================================== + + subroutine check_hlm_active(this, nc, bounds_clump) + ! --------------------------------------------------------------------------------- ! This subroutine is not currently used. It is just a utility that may come ! in handy when we have dynamic sites in FATES From d8003c32262086441927faf7b2e24d62bad316fe Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Tue, 20 Aug 2019 13:20:15 -0700 Subject: [PATCH 31/62] Correcting small error --- src/utils/clmfates_interfaceMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 5f542e5cb7..7f1be3fa27 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -2493,7 +2493,7 @@ subroutine GetAndSetTime() use clm_time_manager , only : get_days_per_year, & get_curr_date, & get_ref_date, & - timemgr_datediff, & + timemgr_datediff ! FATES MODULES use FatesInterfaceMod , only : SetFatesTime From 320a80dc9858d79a9f89d3ea580faf6261a08229 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Mon, 26 Aug 2019 12:36:48 -0600 Subject: [PATCH 32/62] fates_next_api: udpated tag to fates api 8.0.0 --- Externals_CLM.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index b440c99ea3..9e1fae0333 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -2,7 +2,7 @@ local_path = src/fates protocol = git repo_url = https://github.com/NGEET/fates -tag = sci.1.27.1_api.7.3.0 +tag = sci.1.30.0_api.8.0.0 required = True [PTCLM] From cd30b77bc5f322df903d1ac60a0427ec7fafee10 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Tue, 27 Aug 2019 14:25:49 -0700 Subject: [PATCH 33/62] adding in GetAndSet procedure call --- src/utils/clmfates_interfaceMod.F90 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 7f1be3fa27..f2d5d557cd 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -197,7 +197,7 @@ module CLMFatesInterfaceMod ! developer will at least question its usage (RGK) private :: hlm_bounds_to_fates_bounds - ! ThGetAndSetFatesTimeis function is used to get the current time from the CIME + ! The GetAndSetFatesTimeis function is used to get the current time from the CIME ! time procedures and then set to the fates global time variables during restart, ! init_coldstart, and dynamics_driv function calls private :: GetAndSetTime @@ -1149,9 +1149,6 @@ subroutine restart( this, bounds_proc, ncid, flag, waterstate_inst, & this%fates(nc)%sites, & this%fates(nc)%bc_out) - ! Set the FATES global time and date variables - !call GetAndSetTime - ! ------------------------------------------------------------------------ ! Update history IO fields that depend on ecosystem dynamics ! ------------------------------------------------------------------------ @@ -1193,6 +1190,10 @@ subroutine init_coldstart(this, waterstate_inst, canopystate_inst, soilstate_ins integer :: s integer :: c + + ! Set the FATES global time and date variables + call GetAndSetTime + nclumps = get_proc_clumps() !$OMP PARALLEL DO PRIVATE (nc,bounds_clump,s,c,j,vol_ice,eff_porosity) From ca0be0736eae27389e3d4f7b92d053ad64a2810b Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Thu, 3 Oct 2019 13:47:15 -0700 Subject: [PATCH 34/62] adding GetandSetTime to restart subroutine --- src/utils/clmfates_interfaceMod.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index f2d5d557cd..3ac39debf5 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -962,6 +962,9 @@ subroutine restart( this, bounds_proc, ncid, flag, waterstate_inst, & ! I think that is it... ! --------------------------------------------------------------------------------- + ! Set the FATES global time and date variables + call GetAndSetTime + if(.not.initialized) then initialized=.true. @@ -1267,9 +1270,6 @@ subroutine init_coldstart(this, waterstate_inst, canopystate_inst, soilstate_ins call this%wrap_update_hlmfates_dyn(nc,bounds_clump, & waterstate_inst,canopystate_inst,frictionvel_inst) - ! Set the FATES global time and date variables - !call GetAndSetTime - ! ------------------------------------------------------------------------ ! Update history IO fields that depend on ecosystem dynamics ! ------------------------------------------------------------------------ From ac16068ef6a75ecf5ee344d24c2e3cbadaa014c7 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Fri, 11 Oct 2019 11:26:59 -0700 Subject: [PATCH 35/62] removing calls to GetandSet in restart and cold_init subroutines. First appears to be not necessary and second screws up the cold start --- src/utils/clmfates_interfaceMod.F90 | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 6079a7017a..3c81cf928b 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -965,9 +965,6 @@ subroutine restart( this, bounds_proc, ncid, flag, waterstate_inst, & ! I think that is it... ! --------------------------------------------------------------------------------- - ! Set the FATES global time and date variables - call GetAndSetTime - if(.not.initialized) then initialized=.true. @@ -1197,9 +1194,6 @@ subroutine init_coldstart(this, waterstate_inst, canopystate_inst, soilstate_ins integer :: c - ! Set the FATES global time and date variables - call GetAndSetTime - nclumps = get_proc_clumps() !$OMP PARALLEL DO PRIVATE (nc,bounds_clump,s,c,j,vol_ice,eff_porosity) From 4adf9863c04f1f9e3985ca0c5eac9e96abe40915 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Tue, 12 Nov 2019 13:34:39 -0800 Subject: [PATCH 36/62] Revert "removing calls to GetandSet in restart and cold_init subroutines. First appears to be not necessary and second screws up the cold start" This reverts commit ac16068ef6a75ecf5ee344d24c2e3cbadaa014c7. --- src/utils/clmfates_interfaceMod.F90 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 3c81cf928b..6079a7017a 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -965,6 +965,9 @@ subroutine restart( this, bounds_proc, ncid, flag, waterstate_inst, & ! I think that is it... ! --------------------------------------------------------------------------------- + ! Set the FATES global time and date variables + call GetAndSetTime + if(.not.initialized) then initialized=.true. @@ -1194,6 +1197,9 @@ subroutine init_coldstart(this, waterstate_inst, canopystate_inst, soilstate_ins integer :: c + ! Set the FATES global time and date variables + call GetAndSetTime + nclumps = get_proc_clumps() !$OMP PARALLEL DO PRIVATE (nc,bounds_clump,s,c,j,vol_ice,eff_porosity) From d387bd715ad1b58f24ca41f9065190fc485b67b4 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 19 Nov 2019 11:09:58 -0700 Subject: [PATCH 37/62] Apply changes to update to latest fates_next_api apply this diff rgknox/fates_next_api_5.0.21...escomp/fates_next_api This updates fates from sci.1.27.1_api.7.3.0 to sci.1.30.0_api.8.0.0. --- Externals_CLM.cfg | 4 +- .../testmods_dirs/clm/Fates/user_nl_clm | 8 +- .../clm/FatesAllVars/user_nl_clm | 4 +- .../clm/FatesColdDef/user_nl_clm | 2 +- .../clm/FatesShortList/user_nl_clm | 2 +- src/main/histFileMod.F90 | 117 ++++++--- src/utils/clmfates_interfaceMod.F90 | 233 +++++------------- 7 files changed, 165 insertions(+), 205 deletions(-) diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index 23d74d10e2..b1436326b1 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -1,8 +1,8 @@ [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] 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/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index b1df43d6b4..e1c16415e3 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,6 +1063,7 @@ 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)"] !----------------------------------------------------------------------- @@ -1063,10 +1071,12 @@ subroutine hist_update_hbuf(bounds) do t = 1,ntapes !$OMP PARALLEL DO PRIVATE (f, num2d) 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..d1d3d45308 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,13 @@ 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 +1941,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 +2063,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 +2123,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 +2329,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 +2390,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 From 13fb2731cfef0a5bec1e2b443ffea2c43ebc2d48 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 19 Nov 2019 14:11:02 -0700 Subject: [PATCH 38/62] Update fates paramfile to one being pointed to on fates_next_api branch --- bld/namelist_files/namelist_defaults_clm4_5.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_clm4_5.xml b/bld/namelist_files/namelist_defaults_clm4_5.xml index 01384e9e6f..90946cd240 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.7.3.0_12pft_c190530.nc From 7e8e51c240d04973d948c03f926ca8c031dbcfc1 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 19 Nov 2019 14:36:21 -0700 Subject: [PATCH 39/62] Add note about expected fail --- cime_config/testdefs/ExpectedTestFails.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml index 9be3edee3b..250e24fb1f 100644 --- a/cime_config/testdefs/ExpectedTestFails.xml +++ b/cime_config/testdefs/ExpectedTestFails.xml @@ -11,6 +11,7 @@ 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 From fb4d55398d6a55c406c138cde6c5291cf6e15fcc Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 19 Nov 2019 16:43:21 -0700 Subject: [PATCH 40/62] Update change files --- doc/.ChangeLog_template | 6 +-- doc/ChangeSum | 1 + doc/release-clm5.0.ChangeLog | 88 ++++++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+), 3 deletions(-) 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..8008353413 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ +release-clm5.0.30 erik 11/19/2019 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..1a93c93ce8 100644 --- a/doc/release-clm5.0.ChangeLog +++ b/doc/release-clm5.0.ChangeLog @@ -1,4 +1,92 @@ =============================================================== +Tag name: release-clm5.0.30 +Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) +Date: Tue Nov 19 16:34:38 MST 2019 +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. + +CTSM Master Tag This Corresponds To: ctsm1.0.dev025 (with many other changes) + +Summary of changes: +------------------- + +Issues fixed (include CTSM Issue #): None + +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 - NOT run + + PTCLM testing (components/clm/tools/shared/PTCLM/test): + + cheyenne - NOT run + + 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: FATES updated + + cism: release-cesm2.0.04 + rtm: release-cesm2.0.03 + mosart: release-cesm2.0.03 + cime: cim5.6.25 + FATES: sci.1.30.0_api.8.0.0 + PTCLM: PTCLM2_180611 + +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 From 8dce9a6c9f3788792456c34890967a98293dd983 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Fri, 13 Dec 2019 14:09:44 -0700 Subject: [PATCH 41/62] Updated default fates parameter file for new api 7.4.0 format. --- bld/namelist_files/namelist_defaults_clm4_5.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_clm4_5.xml b/bld/namelist_files/namelist_defaults_clm4_5.xml index bfd5b7ce2d..709bea253e 100644 --- a/bld/namelist_files/namelist_defaults_clm4_5.xml +++ b/bld/namelist_files/namelist_defaults_clm4_5.xml @@ -355,7 +355,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/fates_params_api.7.3.0_12pft_c190530.nc +lnd/clm2/paramdata/fates_params_api.7.4.0_12pft_c191213.nc From 76d28ae8b1ce271d5697690b1324dd49b8ece955 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Fri, 13 Dec 2019 14:19:06 -0700 Subject: [PATCH 42/62] corrected wrong fates api, we are on 8.1 not 7.4. --- bld/namelist_files/namelist_defaults_clm4_5.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_clm4_5.xml b/bld/namelist_files/namelist_defaults_clm4_5.xml index 709bea253e..5b518ec6b6 100644 --- a/bld/namelist_files/namelist_defaults_clm4_5.xml +++ b/bld/namelist_files/namelist_defaults_clm4_5.xml @@ -355,7 +355,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/fates_params_api.7.4.0_12pft_c191213.nc +lnd/clm2/paramdata/fates_params_api.8.1.0_12pft_c191213.nc From 020a0a309f61dcb428cfff6eb9c626050cbc91d1 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Mon, 16 Dec 2019 13:32:52 -0800 Subject: [PATCH 43/62] updating GetandSetTime function comment referencing correct time function source --- src/utils/clmfates_interfaceMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 6079a7017a..803c298d37 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -197,7 +197,7 @@ module CLMFatesInterfaceMod ! developer will at least question its usage (RGK) private :: hlm_bounds_to_fates_bounds - ! The GetAndSetFatesTimeis function is used to get the current time from the CIME + ! The GetAndSetFatesTime function is used to get the current time from the CLM ! time procedures and then set to the fates global time variables during restart, ! init_coldstart, and dynamics_driv function calls private :: GetAndSetTime From f6f871b0cfc6fc14a07f363c726400bb76fd84bf Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Mon, 16 Dec 2019 13:36:33 -0800 Subject: [PATCH 44/62] fixing comment typo --- src/utils/clmfates_interfaceMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 803c298d37..9986fb5e74 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -197,7 +197,7 @@ module CLMFatesInterfaceMod ! developer will at least question its usage (RGK) private :: hlm_bounds_to_fates_bounds - ! The GetAndSetFatesTime function is used to get the current time from the CLM + ! The GetAndSetTime function is used to get the current time from the CLM ! time procedures and then set to the fates global time variables during restart, ! init_coldstart, and dynamics_driv function calls private :: GetAndSetTime From 56c334efe002fd2c7c25985ef0863abfadd83864 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Mon, 16 Dec 2019 15:36:19 -0700 Subject: [PATCH 45/62] Updated default fates parameter file again after some new changes. --- bld/namelist_files/namelist_defaults_clm4_5.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_clm4_5.xml b/bld/namelist_files/namelist_defaults_clm4_5.xml index 5b518ec6b6..117bb75171 100644 --- a/bld/namelist_files/namelist_defaults_clm4_5.xml +++ b/bld/namelist_files/namelist_defaults_clm4_5.xml @@ -355,7 +355,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/fates_params_api.8.1.0_12pft_c191213.nc +lnd/clm2/paramdata/fates_params_api.8.1.0_12pft_c191216.nc From eac0131912254457e3c619cd77e8dcffa419037f Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Tue, 17 Dec 2019 17:38:10 -0700 Subject: [PATCH 46/62] Updated fates default filename, again, for new parameters --- bld/namelist_files/namelist_defaults_clm4_5.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_clm4_5.xml b/bld/namelist_files/namelist_defaults_clm4_5.xml index 117bb75171..95242dc7d8 100644 --- a/bld/namelist_files/namelist_defaults_clm4_5.xml +++ b/bld/namelist_files/namelist_defaults_clm4_5.xml @@ -355,7 +355,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/fates_params_api.8.1.0_12pft_c191216.nc +lnd/clm2/paramdata/fates_params_api.8.1.0_12pft_c191217.nc From 195c9b2e6993cbad7d8a13cd68243187a2c8ca18 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Fri, 3 Jan 2020 12:56:10 -0700 Subject: [PATCH 47/62] Updated fates default file to newer version of api 8.1 --- bld/namelist_files/namelist_defaults_clm4_5.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_clm4_5.xml b/bld/namelist_files/namelist_defaults_clm4_5.xml index 95242dc7d8..7ff499fe39 100644 --- a/bld/namelist_files/namelist_defaults_clm4_5.xml +++ b/bld/namelist_files/namelist_defaults_clm4_5.xml @@ -355,7 +355,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/fates_params_api.8.1.0_12pft_c191217.nc +lnd/clm2/paramdata/fates_params_api.8.1.0_12pft_c200103.nc From 5d57fffd65b11658842660eac3e370c3b2f8fe55 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Sat, 4 Jan 2020 12:00:37 -0700 Subject: [PATCH 48/62] Updated fates tag to match api 8.1.0 --- Externals_CLM.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index 9e1fae0333..23deb68027 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -2,7 +2,7 @@ local_path = src/fates protocol = git repo_url = https://github.com/NGEET/fates -tag = sci.1.30.0_api.8.0.0 +tag = sci.1.31.1_api.8.1.0 required = True [PTCLM] From f9c1c88f7522194c8a275d4e5f334e28906f99b2 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 13 Jan 2020 15:39:24 -0700 Subject: [PATCH 49/62] Update externals for rtm mosart and cime --- Externals.cfg | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index 08a6d0695e..395d2f70a1 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -15,22 +15,22 @@ 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/ekluzek/rtm +branch = release-cesm2.0 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/ekluzek/mosart +branch = release-cesm2.0 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] From a7eab48e1eeec701bb8e96079c32e5d38bdeaa60 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 13 Jan 2020 15:58:39 -0700 Subject: [PATCH 50/62] Also add a check for gridcell weights, fixing #847 --- src/biogeophys/SoilMoistureStreamMod.F90 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 From 34ba59ab268e28fa1f9e33dbe1886f69fbc013a2 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 14 Jan 2020 13:32:55 -0700 Subject: [PATCH 51/62] Update to RTM and MOSART tags, rather than branch, and uppercase ESCOMP modules as they are now all handled that way --- Externals.cfg | 10 +++++----- Externals_CLM.cfg | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index 395d2f70a1..da82eb82b7 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -7,7 +7,7 @@ required = True [cism] local_path = components/cism protocol = git -repo_url = https://github.com/ESCOMP/cism-wrapper +repo_url = https://github.com/ESCOMP/CISM-wrapper tag = release-cesm2.0.04 externals = Externals_CISM.cfg required = True @@ -15,15 +15,15 @@ required = True [rtm] local_path = components/rtm protocol = git -repo_url = https://github.com/ekluzek/rtm -branch = release-cesm2.0 +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/ekluzek/mosart -branch = release-cesm2.0 +repo_url = https://github.com/ESCOMP/MOSART +tag = release-cesm2.0.04 required = True [cime] diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index b1436326b1..c289adec62 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -8,7 +8,7 @@ required = True [PTCLM] local_path = tools/PTCLM protocol = git -repo_url = https://github.com/ESCOMP/ptclm +repo_url = https://github.com/ESCOMP/PTCLM tag = PTCLM2_180611 required = True From 9a10f7b0650b63085a2ffcf6ace1b8b9aeb3738d Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 14 Jan 2020 15:56:02 -0700 Subject: [PATCH 52/62] Remove the non-fates test with the land-ice model from the fates test list, and add a comment for the remaining non-fates test in the fates test list to say, that it's just there to ensure that any changes for fates won't mess up the mainline model without fates --- cime_config/testdefs/testlist_clm.xml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index d16728194c..97ced69e17 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1882,15 +1882,6 @@ - - - - - - - - - @@ -1898,6 +1889,7 @@ + From 0569c62c759de39098f0680216f65b7d23420178 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 16 Jan 2020 15:25:37 -0700 Subject: [PATCH 53/62] Backup fates update to sci.1.30.0_api.8.0.0 rather than very latest of sci.1.31.1_api.8.1.0 --- Externals_CLM.cfg | 2 +- .../namelist_defaults_clm4_5.xml | 2 +- cime_config/testdefs/ExpectedTestFails.xml | 2 + src/biogeophys/CanopyFluxesMod.F90 | 2 +- src/utils/clmfates_interfaceMod.F90 | 143 +++++------------- 5 files changed, 44 insertions(+), 107 deletions(-) diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index 170f5f5d3a..c289adec62 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -2,7 +2,7 @@ local_path = src/fates protocol = git repo_url = https://github.com/NGEET/fates -tag = sci.1.31.1_api.8.1.0 +tag = sci.1.30.0_api.8.0.0 required = True [PTCLM] diff --git a/bld/namelist_files/namelist_defaults_clm4_5.xml b/bld/namelist_files/namelist_defaults_clm4_5.xml index 3aac2ffefc..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_api.8.1.0_12pft_c200103.nc +lnd/clm2/paramdata/fates_params_api.8.0.0_12pft_c191216.nc diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml index f13846af5f..9f41cc2e52 100644 --- a/cime_config/testdefs/ExpectedTestFails.xml +++ b/cime_config/testdefs/ExpectedTestFails.xml @@ -14,7 +14,9 @@ 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 ERS_D_Ld5.1x1_brazil.I2000Clm50FatesCruGs.izumi_nag.clm-FatesHydro RUN 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/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index b2673f6bec..5890ad9869 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -1277,7 +1277,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, call clm_fates%wrap_accumulatefluxes(nc,fn,filterp(1:fn)) - call clm_fates%wrap_hydraulics_drive(bounds,nc,fn,filterp(1:fn),soilstate_inst, & + call clm_fates%wrap_hydraulics_drive(bounds,nc,soilstate_inst, & waterstate_inst,waterflux_inst,solarabs_inst,energyflux_inst) else diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 69a64ca020..090cd2826e 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -197,11 +197,6 @@ module CLMFatesInterfaceMod ! developer will at least question its usage (RGK) private :: hlm_bounds_to_fates_bounds - ! The GetAndSetTime function is used to get the current time from the CLM - ! time procedures and then set to the fates global time variables during restart, - ! init_coldstart, and dynamics_driv function calls - private :: GetAndSetTime - logical :: debug = .false. character(len=*), parameter, private :: sourcefile = & @@ -584,9 +579,22 @@ subroutine dynamics_driv(this, nc, bounds_clump, & integer :: c ! column index (HLM) integer :: ifp ! patch index integer :: p ! HLM patch index + integer :: yr ! year (0, ...) + integer :: mon ! month (1, ..., 12) + integer :: day ! day of month (1, ..., 31) + integer :: sec ! seconds of the day integer :: nlevsoil ! number of soil layers at the site integer :: nld_si ! site specific number of decomposition layers - + integer :: current_year + integer :: current_month + integer :: current_day + integer :: current_tod + integer :: current_date + integer :: jan01_curr_year + integer :: reference_date + integer :: days_per_year + real(r8) :: model_day + real(r8) :: day_of_year !----------------------------------------------------------------------- ! --------------------------------------------------------------------------------- @@ -598,8 +606,24 @@ subroutine dynamics_driv(this, nc, bounds_clump, & ! and it keeps all the boundaries in one location ! --------------------------------------------------------------------------------- - ! Set the FATES global time and date variables - call GetAndSetTime + days_per_year = get_days_per_year() + call get_curr_date(current_year,current_month,current_day,current_tod) + current_date = current_year*10000 + current_month*100 + current_day + jan01_curr_year = current_year*10000 + 100 + 1 + + call get_ref_date(yr, mon, day, sec) + reference_date = yr*10000 + mon*100 + day + + call timemgr_datediff(reference_date, sec, current_date, current_tod, model_day) + + call timemgr_datediff(jan01_curr_year,0,current_date,sec,day_of_year) + + call SetFatesTime(current_year, current_month, & + current_day, current_tod, & + current_date, reference_date, & + model_day, floor(day_of_year), & + days_per_year, 1.0_r8/dble(days_per_year)) + do s=1,this%fates(nc)%nsites @@ -965,9 +989,6 @@ subroutine restart( this, bounds_proc, ncid, flag, waterstate_inst, & ! I think that is it... ! --------------------------------------------------------------------------------- - ! Set the FATES global time and date variables - call GetAndSetTime - if(.not.initialized) then initialized=.true. @@ -1155,6 +1176,8 @@ subroutine restart( this, bounds_proc, ncid, flag, waterstate_inst, & this%fates(nc)%sites, & this%fates(nc)%bc_out) + + ! ------------------------------------------------------------------------ ! Update history IO fields that depend on ecosystem dynamics ! ------------------------------------------------------------------------ @@ -1196,10 +1219,6 @@ subroutine init_coldstart(this, waterstate_inst, canopystate_inst, soilstate_ins integer :: s integer :: c - - ! Set the FATES global time and date variables - call GetAndSetTime - nclumps = get_proc_clumps() !$OMP PARALLEL DO PRIVATE (nc,bounds_clump,s,c,j,vol_ice,eff_porosity) @@ -1404,13 +1423,6 @@ subroutine prep_canopyfluxes(this, nc, fn, filterp, photosyns_inst) do s = 1, this%fates(nc)%nsites ! filter flag == 1 means that this patch has not been called for photosynthesis this%fates(nc)%bc_in(s)%filter_photo_pa(:) = 1 - - ! set transpiration input boundary condition to zero. The exposed - ! vegetation filter may not even call every patch. - - this%fates(nc)%bc_in(s)%qflx_transp_pa(:) = 0._r8 - - end do end subroutine prep_canopyfluxes @@ -2219,7 +2231,6 @@ end subroutine ComputeRootSoilFlux ! ====================================================================================== subroutine wrap_hydraulics_drive(this, bounds_clump, nc, & - fn, filterp, & soilstate_inst, waterstate_inst, waterflux_inst, & solarabs_inst, energyflux_inst) @@ -2228,8 +2239,6 @@ subroutine wrap_hydraulics_drive(this, bounds_clump, nc, & class(hlm_fates_interface_type), intent(inout) :: this type(bounds_type),intent(in) :: bounds_clump integer,intent(in) :: nc - integer, intent(in) :: fn - integer, intent(in) :: filterp(fn) type(soilstate_type) , intent(inout) :: soilstate_inst type(waterstate_type) , intent(inout) :: waterstate_inst type(waterflux_type) , intent(inout) :: waterflux_inst @@ -2240,7 +2249,6 @@ subroutine wrap_hydraulics_drive(this, bounds_clump, nc, & integer :: s integer :: c integer :: j - integer :: f ! loop index for the patch filter integer :: ifp integer :: p integer :: nlevsoil @@ -2277,28 +2285,12 @@ subroutine wrap_hydraulics_drive(this, bounds_clump, nc, & soilstate_inst%eff_porosity_col(c,1:nlevsoil) do ifp = 1, this%fates(nc)%sites(s)%youngest_patch%patchno - p = ifp+col%patchi(c) - ! fsa_patch was filled on the nourban_pa filter, which should cover - ! all fates patches. - ! These are not currently used anyway (RGK 07/30/19) - this%fates(nc)%bc_in(s)%swrad_net_pa(ifp) = solarabs_inst%fsa_patch(p) - this%fates(nc)%bc_in(s)%lwrad_net_pa(ifp) = energyflux_inst%eflx_lwrad_net_patch(p) + p = ifp+col%patchi(c) + this%fates(nc)%bc_in(s)%swrad_net_pa(ifp) = solarabs_inst%fsa_patch(p) + this%fates(nc)%bc_in(s)%lwrad_net_pa(ifp) = energyflux_inst%eflx_lwrad_net_patch(p) + this%fates(nc)%bc_in(s)%qflx_transp_pa(ifp) = waterflux_inst%qflx_tran_veg_patch(p) end do - - end do - - - ! The exposed vegetation filter "filterp" dictates which patches - ! had their transpiration updated during canopy_fluxes(). Patches - ! not in the filter had been zero'd during prep_canopyfluxes(). - - do f = 1,fn - p = filterp(f) - c = patch%column(p) - s = this%f2hmap(nc)%hsites(c) - ifp = p - col%patchi(c) - this%fates(nc)%bc_in(s)%qflx_transp_pa(ifp) = waterflux_inst%qflx_tran_veg_patch(p) - end do + end do ! Call Fates Hydraulics ! ------------------------------------------------------------------------------------ @@ -2415,61 +2407,4 @@ subroutine hlm_bounds_to_fates_bounds(hlm, fates) end subroutine hlm_bounds_to_fates_bounds - ! ====================================================================================== - - subroutine GetAndSetTime() - - ! CLM MODULES - use clm_time_manager , only : get_days_per_year, & - get_curr_date, & - get_ref_date, & - timemgr_datediff - - ! FATES MODULES - use FatesInterfaceMod , only : SetFatesTime - - ! LOCAL VARIABLES - integer :: yr ! year (0, ...) - integer :: mon ! month (1, ..., 12) - integer :: day ! day of month (1, ..., 31) - integer :: sec ! seconds of the day - integer :: current_year - integer :: current_month - integer :: current_day - integer :: current_tod - integer :: current_date - integer :: jan01_curr_year - integer :: reference_date - integer :: days_per_year - real(r8) :: model_day - real(r8) :: day_of_year - - - ! Get the current date and determine the set the start of the current year - call get_curr_date(current_year,current_month,current_day,current_tod) - current_date = current_year*10000 + current_month*100 + current_day - jan01_curr_year = current_year*10000 + 100 + 1 - - ! Get the reference date components and compute the date - call get_ref_date(yr, mon, day, sec) - reference_date = yr*10000 + mon*100 + day - - ! Get the defined number of days per year - days_per_year = get_days_per_year() - - ! Determine the model day - call timemgr_datediff(reference_date, sec, current_date, current_tod, model_day) - - ! Determine the current DOY - call timemgr_datediff(jan01_curr_year,0,current_date,sec,day_of_year) - - ! Set the FATES global time variables - call SetFatesTime(current_year, current_month, & - current_day, current_tod, & - current_date, reference_date, & - model_day, floor(day_of_year), & - days_per_year, 1.0_r8/dble(days_per_year)) - - end subroutine GetAndSetTime - end module CLMFatesInterfaceMod From 615a306612fb1c2f726ee9fa489ab019175243ad Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 16 Jan 2020 15:31:43 -0700 Subject: [PATCH 54/62] Fix #871 so resolution is NOT checked before running build-namelist --- bld/namelist_files/namelist_defaults_overall.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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 From 137cd0e396e7bfeafd352ad4093debc2182f60a7 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 16 Jan 2020 15:34:06 -0700 Subject: [PATCH 55/62] Update to latest cism release version for cesm2.1.2 --- Externals.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals.cfg b/Externals.cfg index da82eb82b7..090732ee79 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -8,7 +8,7 @@ required = True local_path = components/cism protocol = git repo_url = https://github.com/ESCOMP/CISM-wrapper -tag = release-cesm2.0.04 +tag = cism-release-cesm2.1.2_01 externals = Externals_CISM.cfg required = True From 2887c561e9972bca166fd0dfc300657505a678c1 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 17 Jan 2020 22:31:35 -0700 Subject: [PATCH 56/62] Fix the threading problem by declaring numdims as private --- src/main/histFileMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index e1c16415e3..ca9c64e476 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -1069,7 +1069,7 @@ subroutine hist_update_hbuf(bounds) !----------------------------------------------------------------------- do t = 1,ntapes -!$OMP PARALLEL DO PRIVATE (f, num2d) +!$OMP PARALLEL DO PRIVATE (f, num2d, numdims) do f = 1,tape(t)%nflds numdims = tape(t)%hlist(f)%field%numdims From 73977e54b791cbdc60a2de1496b949b408a66890 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 20 Jan 2020 00:08:01 -0700 Subject: [PATCH 57/62] Update module init version, and remove version specific information from all of the module module settings --- test/tools/test_driver.sh | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) 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 From 258bdea52d840f63782c5ee79e5eb234673d0416 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 21 Jan 2020 13:27:32 -0700 Subject: [PATCH 58/62] Update change files --- doc/ChangeSum | 2 +- doc/release-clm5.0.ChangeLog | 25 ++++++++++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/doc/ChangeSum b/doc/ChangeSum index 8008353413..b377f166a2 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,6 +1,6 @@ Tag Who Date Summary ============================================================================================================================ -release-clm5.0.30 erik 11/19/2019 Update FATES to sci.1.30.0_api.8.0.0 +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 1a93c93ce8..7a414dbbc8 100644 --- a/doc/release-clm5.0.ChangeLog +++ b/doc/release-clm5.0.ChangeLog @@ -1,7 +1,7 @@ =============================================================== Tag name: release-clm5.0.30 Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Tue Nov 19 16:34:38 MST 2019 +Date: Tue Jan 21 13:27:16 MST 2020 One-line Summary: Update FATES to sci.1.30.0_api.8.0.0 Purpose of this version: @@ -10,12 +10,19 @@ 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. + +Fixes #847 + CTSM Master Tag This Corresponds To: ctsm1.0.dev025 (with many other changes) Summary of changes: ------------------- -Issues fixed (include CTSM Issue #): None +Issues fixed (include CTSM Issue #): #847 + #847 -- issues with prescribed soil moisture Science changes since: release-clm5.0.28 FATES science update from sci-1.27.1 to sci.1.30.0 @@ -41,11 +48,11 @@ Testing: tools-tests (components/clm/test/tools): - cheyenne - NOT run + cheyenne - PASS PTCLM testing (components/clm/tools/shared/PTCLM/test): - cheyenne - NOT run + cheyenne - OK regular tests (aux_clm): @@ -70,12 +77,12 @@ Changes answers relative to baseline: Yes, but only when running with FATES Detailed list of changes: ------------------------ -Externals being used: FATES updated +Externals being used: all externals updated - cism: release-cesm2.0.04 - rtm: release-cesm2.0.03 - mosart: release-cesm2.0.03 - cime: cim5.6.25 + 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_180611 From 90f598958ed8552323848ba5eb7ef69df8fd3300 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 21 Jan 2020 13:40:47 -0700 Subject: [PATCH 59/62] Pass git-describe down, since you can only get it from within the git clone (so potentially have to cd to it), also make files in current directory (unless within the CTSM structure, so that testing will work --- tools/mkmapdata/mknoocnmap.pl | 23 ++++++++++++++--------- tools/mkmapdata/mkunitymap.ncl | 8 +++++++- tools/mkmapgrids/mkscripgrid.ncl | 8 +++++++- 3 files changed, 28 insertions(+), 11 deletions(-) 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); From 4713406a8a83ffca59754e07932bf5714a455429 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 21 Jan 2020 13:45:42 -0700 Subject: [PATCH 60/62] Update PTCLM --- Externals_CLM.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index c289adec62..f38a229b9f 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -9,7 +9,7 @@ required = True local_path = tools/PTCLM protocol = git repo_url = https://github.com/ESCOMP/PTCLM -tag = PTCLM2_180611 +tag = PTCLM2_20200121 required = True [externals_description] From 30ceef044893df94a7207912902364af125184ab Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 21 Jan 2020 13:47:50 -0700 Subject: [PATCH 61/62] Update change file --- doc/release-clm5.0.ChangeLog | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/doc/release-clm5.0.ChangeLog b/doc/release-clm5.0.ChangeLog index 7a414dbbc8..1241f36d0f 100644 --- a/doc/release-clm5.0.ChangeLog +++ b/doc/release-clm5.0.ChangeLog @@ -1,7 +1,7 @@ =============================================================== Tag name: release-clm5.0.30 Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Tue Jan 21 13:27:16 MST 2020 +Date: Tue Jan 21 13:46:01 MST 2020 One-line Summary: Update FATES to sci.1.30.0_api.8.0.0 Purpose of this version: @@ -14,8 +14,6 @@ One change to soil-moisture (also check if gridcell weight is non-zero, before s 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. -Fixes #847 - CTSM Master Tag This Corresponds To: ctsm1.0.dev025 (with many other changes) Summary of changes: @@ -84,7 +82,7 @@ Externals being used: all externals updated mosart: release-cesm2.0.04 cime: cim5.6.28 FATES: sci.1.30.0_api.8.0.0 - PTCLM: PTCLM2_180611 + PTCLM: PTCLM2_20200121 CTSM Tag versions pulled over from master development branch: None From eea20afff7a90128057e259993fa7b9ae3d3ebac Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 21 Jan 2020 13:51:02 -0700 Subject: [PATCH 62/62] Update doc --- doc/release-clm5.0.ChangeLog | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/release-clm5.0.ChangeLog b/doc/release-clm5.0.ChangeLog index 1241f36d0f..4d43ab1115 100644 --- a/doc/release-clm5.0.ChangeLog +++ b/doc/release-clm5.0.ChangeLog @@ -1,7 +1,7 @@ =============================================================== Tag name: release-clm5.0.30 Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Tue Jan 21 13:46:01 MST 2020 +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: @@ -19,8 +19,9 @@ CTSM Master Tag This Corresponds To: ctsm1.0.dev025 (with many other changes) Summary of changes: ------------------- -Issues fixed (include CTSM Issue #): #847 - #847 -- issues with prescribed soil moisture +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